Results 1 to 5 of 5

Thread: Sending mail failure on VB.NET 2019

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member pourkascheff's Avatar
    Join Date
    Apr 2020
    Location
    LocalHost
    Posts
    384

    Sending mail failure on VB.NET 2019

    Hi all,
    I found this tutorial very easy and understandable. I followed it's instructions but following exception was thrown:
    Name:  MAILERROR.png
Views: 834
Size:  6.5 KB

    I turned off my email two-step verification but according to https://myaccount.google.com/lesssecureapps, this item is no longer supported.

    Code for record:
    Code:
    Imports System.Net.Mail
    Public Class Form2
        Private Sub SendBtn_Click(sender As Object, e As EventArgs) Handles SendBtn.Click
            Me.Cursor = Cursors.WaitCursor
            GroupBox1.Enabled = False
            Try
                Dim SMTP_SERVER As New SmtpClient
                Dim E_MAIL As New MailMessage
                SMTP_SERVER.UseDefaultCredentials = False
                SMTP_SERVER.Credentials = New Net.NetworkCredential(Usertxt.Text, Passtxt.Text)
                SMTP_SERVER.Port = 587
                SMTP_SERVER.EnableSsl = True
                SMTP_SERVER.Host = "smtp.gmail.com"
                E_MAIL = New MailMessage
                E_MAIL.From = New MailAddress(Usertxt.Text)
                E_MAIL.To.Add(Addresstxt.Text)
                E_MAIL.Subject = Subjecttxt.Text
                E_MAIL.IsBodyHtml = False
                E_MAIL.Body = Messagetxt.Text
                SMTP_SERVER.Send(E_MAIL)
                Me.Cursor = Cursors.Default
                GroupBox1.Enabled = True
                MsgBox("Successfully sent.", MsgBoxStyle.Information)
            Catch ex As Exception
                Me.Cursor = Cursors.Default
                MsgBox(ex.Message.ToString, MsgBoxStyle.Critical)
                GroupBox1.Enabled = True
                Addresstxt.Focus()
            End Try
        End Sub
    End Class
    - How can I rectify the matter?
    - What does the 'server response was: 5.7.0' mean?
    Last edited by pourkascheff; Dec 17th, 2022 at 11:37 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width