I’m having trouble using smtp. I’m a novice user and tried modifying the code in the documentation:
package main
import (
“log”
“net/smtp”
)
// variables to make ExamplePlainAuth compile, without adding
// unnecessary noise there.
var (
from = “MYEMAIL_at_charter.net”
msg = []byte(“dummy message”)
recipients = []string{“MY_EMAIL_at_gmail.com”}
)
func main() {
// hostname is used by PlainAuth to validate the TLS certificate.
hostname := “mobile.charter.net”
auth := smtp.PlainAuth("", “MYEMAIL_at_charter.net”, “MY_CHARTER_PASSWD”, hostname)
err := smtp.SendMail(hostname+":587", auth, from, recipients, msg)
if err != nil {
log.Fatal(err)
}
}
This program never terminates or gives error messages.
I’m using the parameters that were successful in sending email sent via cURL:
curl --url smtps://mobile.charter.net:587 --ssl-reqd --mail-from MYEMAIL_at_charter.net --mail-rcpt MY_EMAIL_at_gmail.com --upload-file mail.txt --user MYEMAIL_at_charter.net:MY_CHARTER_PASSWD–insecure
Any help is appreciated.