Help with connecting to an AT&T email account to send email using .NET
Any help that anyone can provide to my coding would be greatly appreciated here. I'm very frustrated that I can't figure this out. What am I missing or doing wrong?
Using VB 2010 Express, I have code for an AT&T email account that has worked great in the past, but since they have changed their login criteria, I have not been able to connect.
The old data was as follows:
The new settings are now:
SMTP required authentication.
Server requires an encrypted connection (SSL)
Here is my code with the old data commented out and the updates applied. At the end is the error message I receive.
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim SmtpServer As New SmtpClient()
Dim mail As New MailMessage()
SmtpServer.Credentials = New _
'SmtpServer.Port = 25 '<=== Old Port
SmtpServer.Port = 465 '<=== New Port
'SmtpServer.Host = "smtp.att.yahoo.com"'<=== Old Host
SmtpServer.Host = "outbound.att.net" '<=== New Host
SmtpServer.EnableSsl = True '<=== I added this code for new connection
mail = New MailMessage()
mail.From = New MailAddress("MyEmail@bellsouth.net")
mail.Subject = "My Test Mail"
mail.Body = "This is for testing SMTP mail using .NET"
Catch ex As Exception
When ran I get this error:
System.Net.Mail.SmtpException: Failure sending mail. - System.IO.IOExecption: Unable to read data from the transport connection: net_io_connectionclosed.
at SystemNet.Mail.SmtpReplyReaderFactory.ProcessRead(Byte buffer, Int32 read, Boolean readline)
at SystemNet.Mail.SmtpReplyReaderFactory.ReadLines(SmptReplyReader caller, Boolean online)
at SystemNet.Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader caller)
at SystemNet.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)
at SystemNet.Mail.SmtpClient.Send(MailMessage message)
---End of inner exception stack trace ---
at System.Net.MailSmtpClient.Send(MailMessage message)
at WindowsApplication1.Form1.Button1_Click(Object sender, EventArgs e) in C:\Documents and Settings\MyName\Local Settings\Application\Data\Temporary Projects\WindowsApplication1\Form1.vb:line 33
After an all day of frustrations I figured it out all by accident. I found a video on YouTube and the guy in the video was using port 587 even though he wasn’t trying to connect to AT&T. Well what the heck do I have to loose, so I tried port 587. IT WORKED! Why port 587 works and not port 465 that I use to send emails through Outlook is beyond me. But if it works, I’ll go with it, and I’m happy.
By helme_syahiemie in forum VB Classic
Last Post: 10-06-2006, 06:17 PM
Last Post: 12-29-2005, 12:29 PM
By Irene in forum ASP.NET
Last Post: 04-26-2001, 02:16 AM
By anonymous in forum VB Classic
Last Post: 02-16-2001, 09:38 AM
By nlw in forum Enterprise
Last Post: 06-22-2000, 03:10 PM
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center