mailer

package module
v0.0.0-...-192e632 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2015 License: MIT Imports: 4 Imported by: 0

README

Go-mailer

Async and sync golang mailer

Installing

go get github.com/gronpipmaster/go-mailer

Usage

//create mail server
mailServer := mailer.New("example.com:587", "from", "pass")
//listen and wait messages
go mailServer.Listen()
//create message
subject := "Hi"
body := "Hello <a href=\"#\">Some link</a>"
msg := mailer.NewHtmlMessage(
    []string{"to@example.com"},
    "from@example.com",
    "from username",
    subject,
    body,
)
//send
mailServer.SendAsync(msg)

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//Set custom vars
	BufferSize int = 100
	Debug      bool
)

Functions

This section is empty.

Types

type Mailer

type Mailer struct {
	// contains filtered or unexported fields
}

Mailer represents mail service.

func New

func New(host, user, pass string) *Mailer

func (*Mailer) Listen

func (m *Mailer) Listen()

func (*Mailer) Send

func (m *Mailer) Send(msg *Message) (int, error)

Direct Send mail message

func (*Mailer) SendAsync

func (m *Mailer) SendAsync(msg *Message)

Async Send mail message

type Message

type Message struct {
	To      []string
	From    string
	Subject string
	Body    string
	User    string
	Type    string
	Info    string
}

func NewHtmlMessage

func NewHtmlMessage(to []string, from, userFrom, subject, body string) *Message

Create html mail message

func NewMessage

func NewMessage(to []string, from, userFrom, subject, body string) *Message

func (Message) Encode

func (m Message) Encode() string

Encode mail content body

Jump to

Keyboard shortcuts

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