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

Message

Overview

Message is an outbound email.

Part of the mail package — Node.js analog: nodemailer.

Message is a type exported by gox. Methods on this type are documented separately.

Signature

go
type Message struct {
	From    string
	To      []string
	Subject string
	Body    string
	HTML    string
}

Compare: Node.js · Standard Go · gox

js
// Typical nodemailer pattern in Node.js
go
smtp.SendMail(addr, auth, from, to, msg)
go
import "github.com/sahilkhaire/gox/mail"

msg := mail.Message{
    From: "noreply@example.com",
    To: []string{"user@example.com"},
    Subject: "Welcome",
    Body: "Hello!",
}

Example

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

msg := mail.Message{
    From: "noreply@example.com",
    To: []string{"user@example.com"},
    Subject: "Welcome",
    Body: "Hello!",
}

Tips

Browse methods on this type in the sidebar for handler-style APIs and options structs.

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