Send Mail by Go
package main import ( "log" "net/smtp" ) func main() { // Set up authentication information. auth := smtp.PlainAuth( "", "user@goyun.info", "password", "mail.goyun.info", ) // Connect to the server, authenticate, set the sender and recipient, // and send the email all in one step. err := smtp.SendMail( "mail.goyun.info:25", auth, "sender@goyun.info", []string{"recipient@goyun.info"}, []byte("This is the email body."), ) if err != nil { log.Fatal(err) } }
Comments
Post a Comment