Golang net/smtp.CRAMMD5Auth() function example

package net/smtp

Golang net/smtp.CRAMMD5Auth() function usage example

 ...
 crammd5Auth := smtp.CRAMMD5Auth("username", "password")

 // send out the email
 err := smtp.SendMail(smtpHost+":"+strconv.Itoa(emailConf.Port), //convert port number from int to string
 crammd5Auth,
 sender,
 receivers,
 message,
 )
 ...

Reference :

http://golang.org/pkg/net/smtp/#CRAMMD5Auth

Advertisement