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) errorCompare: Node.js · Standard Go · gox
js
sendMailgo
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)