|
-
Dec 17th, 2022, 07:15 AM
#1
Thread Starter
Hyperactive Member
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:

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.
-
Dec 17th, 2022, 08:39 AM
#2
Re: Sending mail failure on VB.NET 2019
Firstly, your link doesn't work. Secondly, we shouldn't have to sign-in to read the correct link:
https://myaccount.google.com/lesssecureapps
A simple Google search, the information is readily available to read without signing in:
https://support.google.com/accounts/.../6010255?hl=en
On the link you provided, if it's what you saw signed in, if you would've click "Learn more", the next page will tell you everything you need to know to make your app meet Google's new stardards. You then follow the information, which might require more Googling of it, and you should be able to update your app to make it secure in order for it to sign into personal accounts.
Last edited by Peter Porter; Dec 17th, 2022 at 09:39 AM.
-
Dec 18th, 2022, 12:14 AM
#3
Thread Starter
Hyperactive Member
Re: Sending mail failure on VB.NET 2019
Based on last paragraph, our winform applications use less-secure-technology. Their recommendation is using a 16-digit app-password, The question is how? I googled. (Results may vary due to location differences, but not too much) What was your approach? Do we have to pay google? How about SSL things? You mean nobody did an auto-email app since may2022???
Update: VS codetooltip/help indicates the term "SecureString" but I did not follow how to use it.
Attachment 186453
-
Dec 18th, 2022, 05:13 AM
#4
Re: Sending mail failure on VB.NET 2019
Sign in to the relevant Google account and go to "Security". Turn on "2-step verification" and then click on "App passwords".
-
Dec 18th, 2022, 08:14 AM
#5
Re: Sending mail failure on VB.NET 2019
Sign in to the relevant Google account and go to "Security". Turn on "2-step verification" and then click on "App passwords".
Here's instructions on how to do this with some code:
https://stackoverflow.com/questions/...nger-available
Hopefully it still works.
After creating the app password for yourself, or under someone elses account, before it works Google will send a verification email to you or that person asking if you created an app password. After clicking yes, the app should have access.
Last edited by Peter Porter; Dec 18th, 2022 at 08:28 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|