Dim myMessage = New Mail.MailMessage()
myMessage.From = New Mail.MailAddress(HttpUtility.HtmlEncode("a1@gmail.com"))
myMessage.To.Add(New Mail.MailAddress("a1@gmail.com"))
'myMessage.Bcc.Add("another mail address for (bcc)")
'myMessage.CC.Add("send copy to another mail address")
myMessage.Subject = "From : " & HttpUtility.HtmlEncode("testing") & " - " &
HttpUtility.HtmlEncode("testing")
myMessage.Body = HttpUtility.HtmlEncode("hi")
myMessage.IsBodyHtml = True
myMessage.Priority = Mail.MailPriority.Normal
Dim mySmtp = New SmtpClient()
mySmtp.Send(myMessage)
Response.Write("Thank you - your message was sent. ")
' LabelMessage.Text = "Thank you - your message was sent. "
Catch exp As Exception
Throw New Exception("ERROR : Unable to send mail - " & exp.Message.ToString(), exp)
End Try
bsarahim
Member
14 Points
145 Posts
The operation has timed out in smtp:
Jan 03, 2013 01:23 PM|LINK
Hi im using the below code
in web.config
<system.net>
<mailSettings>
<smtp>
<network host="smtp.ggggg.com" port="25" userName="gggg" password="ggggg"/>
</smtp>
</mailSettings>
</system.net>
----------------------
Imports System.Net
Imports System.Net.Mail
Try
Dim myMessage = New Mail.MailMessage()
myMessage.From = New Mail.MailAddress(HttpUtility.HtmlEncode("a1@gmail.com"))
myMessage.To.Add(New Mail.MailAddress("a1@gmail.com"))
'myMessage.Bcc.Add("another mail address for (bcc)")
'myMessage.CC.Add("send copy to another mail address")
myMessage.Subject = "From : " & HttpUtility.HtmlEncode("testing") & " - " &
HttpUtility.HtmlEncode("testing")
myMessage.Body = HttpUtility.HtmlEncode("hi")
myMessage.IsBodyHtml = True
myMessage.Priority = Mail.MailPriority.Normal
Dim mySmtp = New SmtpClient()
mySmtp.Send(myMessage)
Response.Write("Thank you - your message was sent. ")
' LabelMessage.Text = "Thank you - your message was sent. "
Catch exp As Exception
Throw New Exception("ERROR : Unable to send mail - " & exp.Message.ToString(), exp)
End Try
-------------------------------------------------
and im recieving a error
Line 27: mySmtp.Send(myMessage)The operation has timed out.
any help will be appreciated..
bsarahim
Member
14 Points
145 Posts
Re: The operation has timed out in smtp:
Jan 03, 2013 02:40 PM|LINK
change the exchange port name.. resolved