Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

im facing error when sending email. here is the error

Error Email Sending Failure

what is the actual error for this exception because i newbie in in this, by the way here is my code line:

 Try
                Dim SmtpServer As New SmtpClient()
                Dim mail As New MailMessage()

                SmtpServer.Credentials = New  _
                Net.NetworkCredential("[email protected]", "passwordexample")
                SmtpServer.EnableSsl = True
                SmtpServer.Port = 587
                SmtpServer.Host = "smtp.gmail.com"

                mail = New MailMessage()
                mail.From = New MailAddress("[email protected]")
                mail.To.Add("[email protected]")
                mail.Subject = "Change Request Submitted"
                mail.Body = "Dear User, " & Environment.NewLine & Environment.NewLine & Environment.NewLine & Environment.NewLine & "One Notification have been submitted," & Environment.NewLine & "Please check the change request on the intranet application"

//ad this line the error SmtpServer.Send(mail)
                SmtpServer.EnableSsl = True
                MsgBox("Notification emailed successfully")
            Catch ex As Exception
                MsgBox(ex.ToString)
            End Try
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
519 views
Welcome To Ask or Share your Answers For Others

1 Answer

Please see this answer...

Sending Email from Visual Basic

If you still can't send the email....

Have you enabled POP or IMAP in Gmail? Sign in to the Gmail web interface.Open the 'Forwarding and POP/IMAP' tab on your 'Settings' page, and configure IMAP or POP. After enabling this in Gmail, make sure you click 'Save Changes' so Gmail can communicate with your mail client.

If you have 2 step verification..

Get an Application-Specific Password Google will automatically generate a password that you will need only once, when you set up Google Mail on your mobile device or email software. You can easily generate a password for each device or email software you want to use.

Step 1: At the bottom of the 2-step verification screen, next to Application-specific passwords, click Manage application-specific passwords. The Authorized Access to your Google Account screen will open.

Step 2: On the Authorized Access to your Google Account screen, in the Name field, type in a name to help you remember what application you are using to access your account and click Generate password. You will then see a password which you will use to configure your mobile device or email software. Keep this screen open until you are ready to enter the password (see part 4, below). The password creation with the device name will show at the bottom. When you are done using the password, click Done.

Step 3: To set up a password for another device or email software, simply type in the name of it in the Name field and click Generate password. You will receive another password.

See more here...

http://www.oit.umass.edu/support/google-apps/configure-google-mail-email-software-mobile-devices


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...