cmdolcet
asked on
Email Automation in VB 2017
I am trying to automate an email inside my vb.net program. I am using the following line of code below.
I get to the SMTP.Send(Mail) and get an error. (See attached image). It will never show up in my mailbox.
I get to the SMTP.Send(Mail) and get an error. (See attached image). It will never show up in my mailbox.
Dim Mail As New Net.Mail.MailMessage
Mail.Subject = "Notification Email."
Mail.To.Add("********@gmail.com")
Mail.From = New MailAddress("*******@*******corporation.com")
Mail.Body = "This is a notice that a report was created."
Dim SMTP As New SmtpClient("smtp.gmail.com")
SMTP.EnableSsl = True
SMTP.Credentials = New System.Net.NetworkCredential("******@gmail.com ", "******")
SMTP.Port = "587"
SMTP.Send(Mail)
Email-Error.PNG
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Shaun,
Actually you are correct in your above statement. You just need to match up the SMTP client
Thanks!
Actually you are correct in your above statement. You just need to match up the SMTP client
Thanks!
ASKER
I believe that this is the credentials from the incoming connection so in my case gmail.
I want to send email through my office 365 account to my gmail account just for testing purposes.
I tried your suggestion and got the same result.