postfix

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2019 License: MIT Imports: 5 Imported by: 0

README

postfix

Sending mail through postfix SMTP server

example

import (
	"github.com/vanng822/postfix"
)
fromAddr := postfix.NewAddress(from, fromEmail)
toAddr := postfix.NewAddress(to, toEmail)
msg, err := postfix.MultipartMessage(fromAddr, toAddr, subject, text, html)
if err != nil {
	log.Fatal("Postfix mailing with error", err)
}
err := postfix.Send(msg)
if err != nil {
	log.Fatal("Postfix mailing with error", err)
}

Documentation

Overview

Package postfix is for sending mail

import (

"github.com/vanng822/postfix"

)

fromAddr := postfix.NewAddress(from, fromEmail) toAddr := postfix.NewAddress(to, toEmail) msg, err := postfix.MultipartMessage(fromAddr, toAddr, subject, text, html)

if err != nil {
	log.Fatal("Postfix mailing with error", err)
}

err := postfix.Send(msg)

if err != nil {
	log.Fatal("Postfix mailing with error", err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MultipartMessage

func MultipartMessage(from *mail.Address, to *mail.Address, subject, text, html string) (*mail.Message, error)

MultipartMessage create a message with multipart text and html html part is parsed and applied css inline styling

func NewAddress

func NewAddress(name, address string) *mail.Address

NewAddress return new mail.Address

func Send

func Send(msg *mail.Message) error

Send connects to a smtp server and send the message to all recipients

func SetClientFactory

func SetClientFactory(f func() (c *smtp.Client, err error))

SetClientFactory for setting a smtp client if needed

func SetHost

func SetHost(h string)

func SetPort

func SetPort(p int)

Types

This section is empty.

Jump to

Keyboard shortcuts

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