Documentation ¶
Index ¶
- func NewMailgun(cfg mail.Config) (mail.Mailer, error)
- func NewPostal(cfg mail.Config) (mail.Mailer, error)
- func NewPostmark(cfg mail.Config) (mail.Mailer, error)
- func NewSMTP(cfg mail.Config) (mail.Mailer, error)
- func NewSendGrid(cfg mail.Config) (mail.Mailer, error)
- func NewSparkPost(cfg mail.Config) (mail.Mailer, error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMailgun ¶
NewMailgun creates a new Mailgun client. Configuration is validated before initialisation.
Example ¶
cfg := mail.Config{ URL: "https://api.eu.mailgun.net", // Or https://api.mailgun.net APIKey: "my-key", FromAddress: "hello@gophers.com", FromName: "Gopher", Domain: "my-domain.com", } _, err := NewMailgun(cfg) if err != nil { log.Fatalln(err) }
Output:
func NewPostal ¶
NewPostal creates a new Postal client. Configuration is validated before initialisation.
Example ¶
cfg := mail.Config{ URL: "https://postal.example.com", APIKey: "my-key", FromAddress: "hello@gophers.com", FromName: "Gopher", } _, err := NewPostal(cfg) if err != nil { log.Fatalln(err) }
Output:
func NewPostmark ¶
NewPostmark creates a new Postmark client. Configuration is validated before initialisation.
Example ¶
cfg := mail.Config{ URL: "https://postal.example.com", APIKey: "my-key", FromAddress: "hello@gophers.com", FromName: "Gopher", } _, err := NewPostal(cfg) if err != nil { log.Fatalln(err) }
Output:
func NewSendGrid ¶
NewSendGrid creates a new sendGrid client. Configuration is validated before initialisation.
Example ¶
cfg := mail.Config{ APIKey: "my-key", FromAddress: "hello@gophers.com", FromName: "Gopher", } _, err := NewSendGrid(cfg) if err != nil { log.Fatalln(err) }
Output:
func NewSparkPost ¶
NewSparkPost creates a new SparkPost client. Configuration is validated before initialisation.
Example ¶
cfg := mail.Config{ URL: "https://api.eu.sparkpost.com", // Or https://api.sparkpost.com/api/v1 APIKey: "my-key", FromAddress: "hello@gophers.com", FromName: "Gopher", } _, err := NewSparkPost(cfg) if err != nil { log.Fatalln(err) }
Output:
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.