A large number of users have reported having an issue when trying to use their written script to send emails through Gmail.
They report that the issue arises suddenly after using the same script for a long time:
This issue can be extremely annoying, especially if you need the script to run properly for a company or multiple users. This error message is caused by one of the following issues:
- the connection settings are incorrect (wrong port specified)
- the credentials provided are incorrect (username and password)
For these reasons in this article, we will explore some of the best methods to solve this problem, and be able to send emails using your scrip again. Please follow the steps closely to avoid any unnecessary issues.
What to do if Email server doesn’t support secure connection?
1. Change ‘client.port’ value
- If you find yourself in the same situation as the user mentioned above, you will simply need to stop using port 25, and change it to port 465 or 587.
- Using port 587 is a security requirement for outgoing mail (SMTP) server for Gmail.
- This method should solve your issue, but if the issue persists, follow the next method.
2. Change the value of SmtpServer.EnableSsl
Dim client As New Net.Mail.SmtpClient("smtp.gmail.com") client.Port = 587 client.EnableSsl = True client.UseDefaultCredentials = False client.Credentials = loginInfo client.Send(mm)
Change the value of SmtpServer.EnableSsl from ‘true’ to ‘false’.
SmtpServer.EnableSsl = true;
SmtpServer.EnableSsl = false;
After changing this value, check to see if the issue persists. If it does, please follow the next method.
3. Change settings of your Gmail app
- In order to access the link provided in the next step, you will need to make sure you’re logged into your Gmail account
- Visit this link and activate the option ‘Access for less secure apps’.
- Retry running your script to check if the issue is resolved.
In this article, we explored some of the best methods to solve the issue caused by an error in the script for sending emails through Gmail.
Please feel free to let us know if this guide helped you solve your issue, by using the comment section below.