Golang Sendmail: Sending mail using net/smtp package

  1. creation of a session and client initiation: the server sends a greeting message and client sends identity. (EHLO)
  2. Mail transactions: It consists of MAIL FROM command, RCPT TO command and DATA command.
func Dial(addr string) (*Client, error) 
func NewClient(conn net.Conn, host string) (*Client, error)
func (c *Client) Hello(localName string) error
func (c *Client) Mail(from string) error
func (c *Client) Rcpt(to string) error
func (c *Client) Data() (io.WriteCloser, error)
func (c *Client) Close() error
EHLO localhost
250-smtp.gmail.com at your service, [87.157.201.18]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store