Skip to content
MailerAce

Integration · Go

Send email from Go with net/smtp

Go's net/smtp negotiates STARTTLS automatically when the server offers it.

Steps

  1. 1Build the RFC 5322 message.
  2. 2Authenticate with smtp.PlainAuth.
  3. 3Call smtp.SendMail on port 587.

Connection settings

Host
smtp.mailerace.com
Port
587 (STARTTLS) or 465 (TLS)
Auth
your SMTP credential
auth := smtp.PlainAuth("", os.Getenv("MAILERACE_SMTP_USER"), os.Getenv("MAILERACE_SMTP_PASSWORD"), "smtp.mailerace.com")
msg := []byte("From: [email protected]\r\n" +
  "To: [email protected]\r\n" +
  "Subject: Your receipt\r\n\r\n" +
  "Thanks for your order!\r\n")
err := smtp.SendMail("smtp.mailerace.com:587", auth, "[email protected]",
  []string{"[email protected]"}, msg)

Send from Go with confidence

Authenticated, signed and delivered from warm IPs, with a log of every message.