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) servers for Gmail.
- This method should solve your issue, but if the issue persists, follow the next method.
2. Change the value of SmtpServer.EnableSsl
The code of your script should look like this :
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.
4. Use a third-party email client service
Alternatively, you can send the script by connecting your Gmail account to a third-party email client program. Software like Mailbird can fully sync and configure with Gmail, allowing you to manage your contacts and messages in one inbox.
Moreover, the program will detect the server settings automatically, so you won’t have to insert them manually.
Follow these steps to connect the two accounts:
- Download and install Mailbird for desktop
- Go to Settings and select Add account from the Accounts tab
- Enter your name and Gmail address
- Click Allow to load your Google emails and contacts into Mailbird
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.
- 5 best anti-spam software for your Exchange email server
- You can now use your finger or pen to ink in your Outlook emails
- Windows Backup Server execution failed (0x80080005) error [FIX]