smtpdrv

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2021 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package smtpdrv sends notification email using net/smtp

This driver is not mean to be high performance, just provides a simple way to send email without applying external services other than your mailbox. To make code simpler, it always sends email in MIME+base64 format, slow but always works.

Take a look at TestPayloadAttach(), it also demonstrates how to embed images in html email (works in some popular clients including gmail web/app).

Index

Constants

View Source
const SMTP = "SMTP"

SMTP is the driver type that sends plain text email

View Source
const SMTPHTML = "SMTPHTML"

SMTPHTML is the driver type that sends html email

Variables

This section is empty.

Functions

func New

func New(from mail.Address, addr string, auth smtp.Auth, tlshost string) (ret types.Driver)

New creates a driver that sends plain text email using net/smtp

This driver does not use endpoint info.

func NewHTML

func NewHTML(from mail.Address, addr string, auth smtp.Auth, tlshost string) (ret types.Driver)

NewHTML creates a driver that sends html email using net/smtp

This driver does not use endpoint info.

Types

type Attach

type Attach struct {
	Type       string
	RawContent string
	ID         string
	Filename   string
}

type Payload

type Payload struct {
	To      *mail.Address
	CC      []mail.Address
	BCC     []mail.Address
	Subject string
	Content string
	Attach  []Attach
}

func (*Payload) Message

func (p *Payload) Message(from mail.Address, html bool) (ret []byte, err error)

Jump to

Keyboard shortcuts

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