-
Dec 28th, 2020, 05:25 PM
#1
Thread Starter
Hyperactive Member
Error Sending Email from VB. (System.Net.Mail)
http://vb.net-informations.com/commu..._smtp_mail.htm
Working on simple program that sends emails.
This used to work.
Error: Unable to read data from transport connection.
Any ideas?
Code:
Try
Dim SmtpServer As New SmtpClient()
Dim mail As New MailMessage()
SmtpServer.EnableSsl = True
SmtpServer.Credentials = New System.Net.NetworkCredential("XXX@gmail.com", "XXX")
'SmtpServer.Port = 587
SmtpServer.Port = 465
SmtpServer.Host = "smtp.gmail.com"
mail = New MailMessage()
mail.From = New MailAddress("XXX@gmail.com")
mail.To.Add("XXXXXXXX@hotmail.com")
mail.Subject = "Subj"
mail.Body = "Body"
SmtpServer.Send(mail)
MsgBox("mail send")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
-
Dec 29th, 2020, 12:27 PM
#2
Re: Error Sending Email from VB. (System.Net.Mail)
I Googled that using:
vb .net Error: Unable to read data from transport connection
and it appears there can be a variety of reasons for that. I think you will need to do the same to eliminate the various reasons if you haven't already.
Please remember next time...elections matter!
-
Dec 30th, 2020, 11:48 PM
#3
Lively Member
Re: Error Sending Email from VB. (System.Net.Mail)
This error usually means that the target machine is running, but the service that you're trying to connect to is not available. (Either it stopped, crashed, or is busy with another request.)
In English: The connection to the machine (remote host/server/PC that the service runs at) was made but since the service was not available on that machine, the machine didn't know what to do with the request.
If the connection to the machine was not available, you'd see a different error. I forget what it is, but it's along the lines of "Service Unreachable" or "Unavailable".
It IS possible that this is being caused by a firewall blocking the port, but given that you say it's intermittent ("sometimes when the client tries to connect"), that's very unlikely. I didn't include that originally because I had ruled it out mentally before replying.
Reference: link
-
Dec 31st, 2020, 09:35 AM
#4
Thread Starter
Hyperactive Member
Re: Error Sending Email from VB. (System.Net.Mail)
I think Google blocks the activity
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|