func New(cfg Config) *Mailer {
	m := &Mailer{config: cfg}
	addr := cfg.FromAddr
	if addr == "" {
		addr = cfg.Username
	}
	if cfg.FromAlias == "" {
		if !cfg.UseCommand && cfg.Username != "" && strings.Contains(cfg.Username, "@") {
			m.fromAddr = mail.Address{Name: cfg.Username[0:strings.IndexByte(cfg.Username, '@')], Address: addr}
		}
	} else {
		m.fromAddr = mail.Address{Name: cfg.FromAlias, Address: addr}
	}
	return m
}
New creates and returns a new mail sender.
package mailer
import (
	"bytes"
	"encoding/base64"
	"fmt"
	"io"
	"io/ioutil"
	"net/mail"
	"net/smtp"
	"os/exec"
	"strings"
	"github.com/valyala/bytebufferpool"
)
const (
	Version = "0.1.0"
)
type Mailer struct {
	config        Config
	fromAddr      mail.Address
	auth          smtp.Auth
	authenticated bool
}