Unable to send email in go smtp library with gmail - email

I'm trying to send email through golang's smtp library using my gamil account.
It was working fine when I try to send emails a few days ago.
But suddenly today, I am not able to send email and the error shown is:
535 5.7.8 Username and Password not accepted. Learn more at\n5.7.8 https://support.google.com/mail/?p=BadCredentials h3sm2390100pji.16 - gsmtp
I'm sure that it succeed in signing into gmail because, 1. the username and password are correct, 2. When I push my code to the server and try to send the email again, my gmail account receive a "Critical Security Alert" email, saying that I have less secure access on, and I have selected that I have recognized the activity.
This shows that I have indeed able to login to gmail through my golang program, yet it was unable to send any email.
I have already turned on allow less secure access and I also have tried this https://accounts.google.com/DisplayUnlockCaptcha, and my password for gmail is "upper case letter + lower case letter + special symbols + numbers"
I have been stuck in this since I have tried all possible solution on the internet and still could not able to send email again using the golang program.
And the port I was using is 587.
By changing it to 465, it gives an error of EOF instead.

Related

How to identify whether Google SMTP server has been blocked when used by an application to send emails

My web application sends email to users on certain business events. For this im using a Google SMTP server with both username password mode as well as OAuth 2.0.
Other props are as follows :
smtpHost: smtp.gmail.com
smtpPort: 587
Now the issue is, after some emails being marked as spams Google blocks the domain and the account. Is there a way to avoid happening this? And is there a way to identify the error thrown when tries to send the email when the domain is blocked, so I can create an alert about the domain and account being blocked.. For now its not possible to access the past logs either, but can get access to the new logs. Suggestions would be highly appreciated.

Sending mail by CDO success only if there are two recipients

I use CDO to send emails for years and since last month there is a strange behaviour when the recipient is yahoo. I get an error:
554 5.7.1 : Data command rejected: SMTP authentication is required for Yahoo mail delivery
However, if I enter TWO recipients separated by comma (even the same address twice), there is no problem and the mail goes ok!!!
Has anybody faced such a problem? It's crazy, isn't it?
Well it seems yahoo has introduced a new security check and do does not accept email from unauthenticated senders of any domain (my case).
So If I enter my email smtp password to send email, there is no problem at all.
Please note that I don't hav a yahoo account, my email is #otenet.gr (which permits unathenticated send mail).
PS
However, the security chek is easily bypassed by just having TWO recipients...

Mailbox unavailable. The server response was: This domain is not hosted here

I am performing some tests on my Nopcommerce site that should allow the user to type a message in to the contact box of the site and that message should be sent by email to a user.
When setting up and testing said user on the site, I am able to perform an email test against an internal email address and this works fine, I receive the email. However, if I try and send the email to an external email address, such as hotmail etc, I receive no error logs at all.
Has anyone ever come across this issue when trying to set up an email on a Nopcommerce site?
I am using port 25 however I have tried to use port 587 with no luck
The answer was that the username and password no longer existed for the server I was sending mail from. Moreover, another issue I had was that the mail still wasn't sending and was sitting in the Message queue. To overcome this I had to make sure that the bindings for the site on IIS were identical to the host values on the site. Doing this allowed me to send mail.

How to send Email to every host in scala play framework?

Right now, i am able to send my email to current host where i have declared in the scala code application.conf
smtp.host=apps.hubino.com, smtp.port=25
but i am unable to send my mail to other host like gmail and yahoo. Can anyone help me how to achieve sending mails to every host in scala.
I am sending email through google smtp server with these configuration.
smtp.host=smtp.gmail.com
smtp.port=465
smtp.ssl=yes
smtp.user=“********#gmail.com"
smtp.password=“**********"
This should work. Also if you make small changes in host and port you should be able to send email to any other smtp servers.
Which scala plugin you are using to send email? You can check MailerPlugin of Play or Courier plugin. Both are very simple to use.
And first time google will block sending email through you application as it is less secured so you need to make changes in your gmail account settings to allow sending email through less secure clients. This link can help you do that or else if you try to send email without making these setting you will received email from google saying securing 'Blocked sign-in attempt' which will contain URL to make changes in your account setting to allow sending email through api client.

Script Sending mails with Gmail: Failed to authenticate on SMTP server

I am having some hard time getting my PHP script to send emails with a SMTP Gmail account. I am using PHP and Symfony2 SwiftMailer, but it seems that the problem lies with my Gmail account configuration. In my logs, I end up with the following error message:
"ERROR - Exception occurred while flushing email queue: Failed to authenticate on SMTP server with username "new.user.name#gmail.com" using 1 possible authenticators"
Luckily, I had another Gmail account working with another application, seemlessly. Rescuing these parameters (user and password) on my new box, eveything works just fine.
in parameters.yml I have (working fine):
parameters:
mailer_transport: gmail
mailer_host: ~
mailer_user: old.user.account#gmail.com
mailer_password: old-password
And here is the version giving auth error message:
parameters:
mailer_transport: gmail
mailer_host: ~
mailer_user: new.user.account#gmail.com
mailer_password: new-password
Needless to say I have checked, rechecked and checked yet again user and password.
I reviewed my Gmail account settings under "Forwarding and POP/IMAP" in my new account: I could find nothing about SMTP.
Searches made me aware some captcha policy may interfere with SMTP accounts. I read here that I should try to enter a captcha phrase, which I do here, and get the nice message:"Account access enabled", "Please try signing in to your Google account again from your new device or application."
Trying again. No luck.
All this is happening from my local dev environment (both OK mails, and NOT OK mails).
How I could get to use SMTP with a newly created Gmail Account ? Any idea ?
Actually, double-checking my inbox, I saw I received a mail from Google explaining someone was trying to enter my account. There, I found a link to the configuration parameter I was looking for:
https://www.google.com/settings/security/lesssecureapps
==> I just had to check: "Make my account less secure.", and was able to get mails sent.
In the mean time, I have found that Gmail SMTP service is getting pretty unrelyable and introduces captcha every now and again (here). I seems there is not much you can do about it. On the other hand, I read stronger passwords seem to help in some cases (here).
I must also say that with a newly created account, I was not able to get this working. Even unchecking the "make my account overly secure" option. It really looks like Gmail is phasing out its SMTP service.
UPDATE
I wanted to mention that there are some excellent and free (or very, very cheap for high volumes) alternatives for sending emails. For example, you could check Mandrill, SendGrid or Amazon SES, among others.
Using the link https://www.google.com/settings/security/lesssecureapps gave me the message: this setting is disabled by your administrator.
I had to go to admin.google.com and login with the same account details and look for the same setting there. Full url was https://admin.google.com/AdminHome#ServiceSettings/notab=1&service=securitysetting&subtab=lesssecureappsaccess
Then the first link worked, so also there I enabled less secure apps. Now I was able to use Gmails SMTP.
Maybe this helps someone: I had the same encounter with gmail, but in my case, when I logged into the gmail account that I configured in my code as SMTP mail sender user, I was greeted by a warning message saying that somebody tried to use my user and pass and that attempt was blocked (hence my error message). It asked me to confirm if that was me or not, so after I clicked the 'That was me' button and tried my code again all worked fine.
Making my account less secure helped me https://myaccount.google.com/lesssecureapps