Answer the question
In order to leave comments, you need to log in
How to send an email using Go (JP)?
I need to send an email to @gmail. How can I do this on GO? Tried like this:
auth := smtp.PlainAuth("", "[email protected]", "....", "smtp.gmail.com")
to := []string{"[email protected]"}
msg := []byte("To: [email protected]\r\n" +
"Subject: YES!\r\n" +
"\r\n" +
"This is the email body.\r\n")
err := smtp.SendMail("smtp.gmail.com:587", auth, "[email protected]", to, msg)
if err != nil {
log.Fatal(err)
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question