Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 3.5 Professionals If you are an experienced ASP.NET programmer, this is the forum for your 3.5 questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Professionals section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old September 6th, 2009, 10:26 PM
Authorized User
 
Join Date: Dec 2007
Location: , , Vietnam.
Posts: 59
Thanks: 9
Thanked 0 Times in 0 Posts
Post Failure sending mail.

Server Error in '/' Application.

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 209.85.147.27:25

In few day ago, my email is work fine, but today, i do not know why it does not work.
Can you give me your ideal about the issues?
Best Regards
Phuc Hoang

  #2 (permalink)  
Old September 7th, 2009, 02:00 AM
Friend of Wrox
Points: 2,473, Level: 20
Points: 2,473, Level: 20 Points: 2,473, Level: 20 Points: 2,473, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2004
Location: India
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

If you are getting error at following line:
Code:
Mailclient.Send(msg)
Then this might be connection issue.
You can try using the following command:TELNET with a "25" after the host ID or IP address (209.85.147.27:25)
Please check the following link which gives general troubleshooting steps for these type of issues:
http://support.microsoft.com/kb/115492/en-us
__________________
Om Prakash Pant
Click the "Thanks" button if this post helped you.
  #3 (permalink)  
Old September 7th, 2009, 03:27 AM
Authorized User
 
Join Date: Dec 2007
Location: , , Vietnam.
Posts: 59
Thanks: 9
Thanked 0 Times in 0 Posts
Default

This is the whole my code that i want to do.

Shared Function SendMail(ByVal mailFrom As MailAddress, ByVal mailTo As MailAddress, ByVal strSubject As String, ByVal strContent As String, Optional ByVal CCaddress As String = "", Optional ByVal BCCaddress As String = "") As Boolean
Dim smtpClient As New SmtpClient()
Dim message As New MailMessage()
Dim kq As Boolean
'Try
'You can specify the host name or ipaddress of your server
'Default in IIS will be localhost gsmtp185-2.google.com |gsmtp147.google.com
smtpClient.Host = "gsmtp147.google.com"
message.From = mailFrom
message.To.Add(mailTo)
If CCaddress.Length > 7 Then message.CC.Add(CCaddress)
If BCCaddress.Length > 7 Then message.Bcc.Add(BCCaddress)
message.IsBodyHtml = True
message.BodyEncoding = System.Text.Encoding.UTF8
message.ReplyTo = mailFrom
message.Priority = MailPriority.High
'Message body content
message.Subject = strSubject
message.Body = strContent
'Send SMTP mail
smtpClient.Send(message)
kq = True
'Catch ex As Exception
kq = False
'End Try
Return kq
End Function
  #4 (permalink)  
Old September 7th, 2009, 06:54 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

GMail's web server requires you to use SSL. This means you need to set EnableSsl to true and use a different port number.

For more info: http://www.google.com/search?hl=en&q...t&aq=f&oq=&aqi=

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #5 (permalink)  
Old September 7th, 2009, 09:26 PM
Authorized User
 
Join Date: Dec 2007
Location: , , Vietnam.
Posts: 59
Thanks: 9
Thanked 0 Times in 0 Posts
Default

Thanks for replying me and this is the whole my code.
I think there is something wrong on that so Can you help me how can i fix it and work fine.
it work but when i check my email box so i can not receive any letter from submit form.
Shared Function GMailSend(ByVal mailFrom As MailAddress, ByVal mailTo As MailAddress, ByVal strSubject As String, ByVal strContent As String, Optional ByVal CCaddress As String = "", Optional ByVal BCCaddress As String = "") As Boolean
Dim mail As System.Net.Mail.MailMessage = New System.Net.Mail.MailMessage()
Dim kq As Boolean
mail.From = mailFrom
mail.To.Add(mailTo)
mail.Subject = strSubject
mail.Body = strContent
mail.IsBodyHtml = True
mail.BodyEncoding = System.Text.Encoding.UTF8
mail.ReplyTo = mailFrom
If CCaddress.Length > 7 Then mail.CC.Add(CCaddress)
If BCCaddress.Length > 7 Then mail.Bcc.Add(BCCaddress)

Dim credential As System.Net.NetworkCredential = New System.Net.NetworkCredential("username@nhatrang.co m", "password")
Dim smtp As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient("smtp.gmail.com")
smtp.Credentials = credential
smtp.UseDefaultCredentials = False

smtp.EnableSsl = True
smtp.Port = 587 'also tried 587,465, 25
smtp.Host = "smtp.gmail.com"
Try
smtp.Send(mail)
kq = True
Catch ex As Exception
kq = False
End Try
Return kq
End Function

Thanks for all thing.
Best Regards,
Phuc Hoang

Last edited by phuc2583; September 7th, 2009 at 09:34 PM..
  #6 (permalink)  
Old September 8th, 2009, 04:16 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Try disabling the line that sets the UseDefaultCredentials or at least move it to before you assign the Credentials property. This works fine for me:
Code:
 
Dim mySmtpClient As New SmtpClient("smtp.gmail.com")
mySmtpClient.Port = 587
mySmtpClient.Credentials = New NetworkCredential("Your.Account@gmail.com", " YourPassword")
mySmtpClient.EnableSsl = True
mySmtpClient.Send(mail)
Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
phuc2583 (September 8th, 2009)
  #7 (permalink)  
Old September 8th, 2009, 08:34 PM
Authorized User
 
Join Date: Dec 2007
Location: , , Vietnam.
Posts: 59
Thanks: 9
Thanked 0 Times in 0 Posts
Default

I have done it, it is perfectly.
Thanks for helping me
Best Wishes
Phuc Hoang


Similar Threads
Thread Thread Starter Forum Replies Last Post
Failure sending email shoakat ASP.NET 2.0 Professional 1 July 4th, 2007 09:05 PM
problems sending mail with java mail gandacuboy J2EE 2 December 20th, 2006 03:05 PM
sending mail ashokparchuri General .NET 3 May 5th, 2005 02:42 AM
Sending e-mail to different mail box! Calibus Classic ASP Databases 4 September 3rd, 2004 05:48 PM
Sending both text mail and HTML mail - CDONTS madhukp Classic ASP Basics 1 October 8th, 2003 01:05 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.