I am writing a registration form using GoLang 1.5. I have it all working, but I've noticed if I attempt to sign up using an e-mail with a plus sign in it (someemail+theirlabel@theirdomain.com) I receive the following error:
Transaction failed: Illegal semicolon, not in group
Googling for this hasn't yielded much results, and it seems like Go should handle the plus sign just fine.
import (
"net/smtp"
"net/mail"
)
func sendEmail(t *Email) bool {
to := []string{"johndoe+test@gmail.com"}
err = smtp.SendMail(smtp_url, auth, from_email, to, buff.Bytes())
if err != nil {
log.Fatal(err)
// outputs: Transaction failed: Illegal semicolon, not in group
}
}
I appreciate any advice I get on this.
Thanks!
I was able to reproduce this error if and only if I had a semi-colon in the To
header within the message body. E.g.:
msg := []byte("To: email1@example.com;email2@example.com
Subject: foo
body
")
Double-check the To
header you're sending and make sure it uses commas instead of semi-colons to separate multiple recipients.