[smtp] Gmail: 530 5.5.1 Authentication Required. Learn more at

This Go program successfully sends email from my home computer, but on a virtual server on DigitalOcean receives the following error:

panic: 530 5.5.1 Authentication Required. Learn more at

Here's the code:

auth := smtp.PlainAuth("", "[email protected]", "PASSWORD", "smtp.gmail.com")
msg := "Subject: Hello\r\n\r\nWorld!"
e = smtp.SendMail("smtp.gmail.com:587", auth, "[email protected]", []string{email}, []byte(msg))
if e != nil { panic(e) }

This question is related to smtp gmail go smtp-auth

The answer is


Derp! I signed into the account and there was a "Suspicious login attempt" warning message at the top of the page. After clicking the warning and authorizing the access, everything works.


in may case setting SMTPAuth to true fixed it. Of-course you need to set permissions for "Less secure apps" to Enabled.

$mail->SMTPAuth = true;


You need turn on the POP mail and IMAP mail feature in setting of the email you are using to send mail. Good luck!


You need to go here https://security.google.com/settings/security/apppasswords

then select Gmail and then select device. then click on Generate. Simply Copy & Paste password which is generated by Google.


Get to your Gmail account's security settings and set permissions for "Less secure apps" to Enabled. Worked for me.


Examples related to smtp

5.7.57 SMTP - Client was not authenticated to send anonymous mail during MAIL FROM error PHPMailer - SMTP ERROR: Password command failed when send mail from my server php function mail() isn't working Gmail Error :The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required "An attempt was made to access a socket in a way forbidden by its access permissions" while using SMTP Getting error while sending email through Gmail SMTP - "Please log in via your web browser and then try again. 534-5.7.14" SmtpException: Unable to read data from the transport connection: net_io_connectionclosed How to configure SMTP settings in web.config Send mail via CMD console Mail not sending with PHPMailer over SSL using SMTP

Examples related to gmail

Expected response code 250 but got code "535", with message "535-5.7.8 Username and Password not accepted How to to send mail using gmail in Laravel? HTML image not showing in Gmail Gmail Error :The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required Send email from localhost running XAMMP in PHP using GMAIL mail server The server response was: 5.7.0 Must issue a STARTTLS command first. i16sm1806350pag.18 - gsmtp Gmail: 530 5.5.1 Authentication Required. Learn more at Sending mail attachment using Java Javamail Could not convert socket to TLS GMail Unable to send email using Gmail SMTP server through PHPMailer, getting error: SMTP AUTH is required for message submission on port 587. How to fix?

Examples related to go

Has been blocked by CORS policy: Response to preflight request doesn’t pass access control check Go test string contains substring Golang read request body How to uninstall Golang? Decode JSON with unknown structure Access HTTP response as string in Go How to search for an element in a golang slice How to delete an element from a Slice in Golang How to set default values in Go structs MINGW64 "make build" error: "bash: make: command not found"

Examples related to smtp-auth

Getting error while sending email through Gmail SMTP - "Please log in via your web browser and then try again. 534-5.7.14" Gmail: 530 5.5.1 Authentication Required. Learn more at Login credentials not working with Gmail SMTP How to send email using simple SMTP commands via Gmail? Sending emails through SMTP with PHPMailer How to resolve javax.mail.AuthenticationFailedException issue?