gsmtp

package
v1.13.3-0...-5aac4af Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package gsmtp provides a simple SMTP client to access remote mail server.

Eg: s := smtp.New("smtp.exmail.qq.com:25", "notify@a.com", "password") glog.Println(s.SendMail("notify@a.com", "ulric@b.com;rain@c.com", "subject", "body, <font color=red>red</font>"))

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SMTP

type SMTP struct {
	Address  string
	Username string
	Password string
}

SMTP is the structure for smtp connection

func New

func New(address, username, password string) *SMTP

New creates and returns a new SMTP object.

func (*SMTP) SendMail

func (s *SMTP) SendMail(from, tos, subject, body string, contentType ...string) error

SendMail connects to the server at addr, switches to TLS if possible, authenticates with the optional mechanism a if possible, and then sends an email from address <from>, to addresses <to>, with message msg.

The parameter <contentType> specifies the content type of the mail, eg: html.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL