Re: SMTP errors I can't fix
What kind of exception does it throw?
Re: SMTP errors I can't fix
Sometimes I wonder... why people think that the error message isn't important. No one walks into the Doc's office and says "It hurts" and expects the doc to know instantly what the issue is. At least we got code, and the line the error happens on.
@pcesarano - a couple things 1) kudos for posting the code and the line the error happens one. Usually we need three things code - error - and line... we typically get two of the three, usually it's the code and the error. 2) please when you post code use the [code][/code] or [highlight][/highlight] tags around your code. They will preserve the formatting. you can also optionally include the language with the highlight tag ([highlight=vb.net] for example) to get pretty formatting with colors. Which ever option you use, the rest of us would appreciate it.
Thanks.
-tg
Re: SMTP errors I can't fix
Gotcha, I'm sorry. The line throwing the exception is "SMTP.Send(message1)", which is the last line of the short block pasted below (it's line 54, in red). After the code block I placed a link with two images--one of the Visual Studio error message (and line 54 highlighted) and one with the error message which appears on the aspx webpage when the exception is thrown. I hope this helps.
Dim SMTP As New SmtpClient(smtpServer)
SMTP.EnableSsl = True
SMTP.Credentials = New System.Net.NetworkCredential("thirddcahs", "thirddcahs_pswd")
SMTP.Port = 465
SMTP.Send(message1)
EXCEPTION IMAGES (x2); FOLLOW LINK
http://www.thirddcahistoricalsociety.org/Exception.html
Re: SMTP errors I can't fix
Quote:
Originally Posted by
pcesarano
Gotcha, I'm sorry. The line throwing the exception is "SMTP.Send(message1)", which is the last line of the short block pasted below (it's line 54, in red). After the code block I placed a link with two images--one of the Visual Studio error message (and line 54 highlighted) and one with the error message which appears on the aspx webpage when the exception is thrown. I hope this helps.
Dim SMTP As New SmtpClient(smtpServer)
SMTP.EnableSsl = True
SMTP.Credentials = New System.Net.NetworkCredential("thirddcahs", "thirddcahs_pswd")
SMTP.Port = 465
SMTP.Send(message1)
EXCEPTION IMAGES (x2); FOLLOW LINK
http://www.thirddcahistoricalsociety.org/Exception.html
Well, the code below works for me (which is what your code looks like):
Code:
Try
Dim smtpServer As New SmtpClient("smtp.gmail.com", 587)
smtpServer.EnableSsl = True
smtpServer.Credentials = New Net.NetworkCredential("[email protected]", "jpass")
Dim message As New MailMessage("[email protected]", "[email protected]", "TEST SUBJECT", "TEST BODY")
smtpServer.Send(message)
Catch ex As Exception
MessageBox.Show("Error Occured: " & ex.ToString)
End Try
But, the code only works on the condition that I have turned off two-step verification for my account. If you have two-step verification enabled, this is probably your issue. Try taking a look at this:
https://support.google.com/mail/answer/1173270?hl=en
Re: SMTP errors I can't fix
YOU ARE AWESOME! It's working now...thank you so much for your help, you're a lifesaver.
Patrick