Skip to content
Node: sendMailgithub.com/sahilkhaire/gox/mail

Send

Overview ​

Send delivers msg using SMTP. ctx cancellation is honored before connecting. Node: transporter.sendMail(msg)

If you are coming from Node.js, the closest pattern is sendMail.

Signature ​

go
func Send(ctx context.Context, msg Message, cfg SMTPConfig) error

Compare: Node.js · Standard Go · gox ​

js
sendMail
go
smtp.SendMail(addr, auth, from, to, msg)
go
import "github.com/sahilkhaire/gox/mail"

mail.Send(ctx, msg, SMTPConfig)

Example ​

go
import "github.com/sahilkhaire/gox/mail"

mail.Send(ctx, msg, SMTPConfig)

Tips ​

Import github.com/sahilkhaire/gox/mail and call Send directly. See the comparison below for the standard library equivalent.

Standard library alternative ​

Use the standard library directly:

go
smtp.SendMail(addr, auth, from, to, msg)

← Back to mail package overview

MIT Licensed · Built for Node.js developers moving to Go