Gmail: 530 5.5.1 Authentication Required. Learn more at

Calder picture Calder · Jun 21, 2013 · Viewed 134.8k times · Source

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) }

Answer

MichaelZi picture MichaelZi · Jul 24, 2014

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