I am trying to connect to a smtp server that allows for smtp relays.
I have already tried it using Thundrebird and it works.
Now I have to do it using asp.net code to send emails.
Here is my code so far:
Dim basicAuthenticationInfo As New System.Net.NetworkCredential("user@mydomain.com", "Password")
Dim Msg As MailMessage = New MailMessage()
Dim MailObj As New SmtpClient("smtpout.secureserver.net", "465")
Msg.From = New MailAddress("user@mydomain.com, "user")
Msg.Sender = New MailAddress("user@mydomain.com", "user")
Msg.To.Add(New MailAddress("senduser@mydomain.com", "send userl"))
yzidell
Member
620 Points
422 Posts
Connecting to a smtp server
Jan 23, 2013 12:52 AM|LINK
Hi,
I am trying to connect to a smtp server that allows for smtp relays.
I have already tried it using Thundrebird and it works.
Now I have to do it using asp.net code to send emails.
Here is my code so far:
Dim basicAuthenticationInfo As New System.Net.NetworkCredential("user@mydomain.com", "Password")
Dim Msg As MailMessage = New MailMessage()
Dim MailObj As New SmtpClient("smtpout.secureserver.net", "465")
Msg.From = New MailAddress("user@mydomain.com, "user")
Msg.Sender = New MailAddress("user@mydomain.com", "user")
Msg.To.Add(New MailAddress("senduser@mydomain.com", "send userl"))
Msg.Subject = "Subject"
Msg.IsBodyHtml = "True"
Msg.Priority = MailPriority.Normal
Msg.Body = "Body"
MailObj.Credentials = CredentialCache.DefaultNetworkCredentials
MailObj.EnableSsl = False
MailObj.Send(Msg)
and the result that I get is:
Unable to read data from the transport connection: net_io_connectionclosed.
Thanks for your help
cnranasinghe
Star
8885 Points
1798 Posts
Re: Connecting to a smtp server
Jan 23, 2013 03:00 AM|LINK
This may have some different causes. IIS, ISP, SPAM protection, Virus gaurd etc.
check this thread
http://forums.asp.net/t/924682.aspx/1
dyyo
Participant
1076 Points
202 Posts
Re: Connecting to a smtp server
Jan 23, 2013 03:11 AM|LINK
you change the SMTP port in your code:
Dim MailObj As New SmtpClient("smtpout.secureserver.net", "465")
into
Dim MailObj As New SmtpClient("smtpout.secureserver.net")
or
Dim MailObj As New SmtpClient("smtpout.secureserver.net", "25")
or
Dim MailObj As New SmtpClient("smtpout.secureserver.net", "587")
Dyyo - Microsoft Recommended ASP.NET Hosting
Pengzhen Son...
Star
8140 Points
837 Posts
Microsoft
Re: Connecting to a smtp server
Jan 24, 2013 05:32 AM|LINK
Hi,
You can try opening SMTP Virtual Server properties and setting IP address of the Web server instead of "All Unassigned".
Please refer this http://stackoverflow.com/questions/3165721/mailbox-unavailable-the-server-response-was-5-7-1-unable-to-relay-for-abcxyz
Hope it can help you.
Feedback to us
Develop and promote your apps in Windows Store