mailer

package module
v0.0.0-...-8c9f8d1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2017 License: BSD-3-Clause Imports: 8 Imported by: 0

README

Mailer

Simple E-mail sender.

Build status

Installation

$ go get github.com/get-ion/mailer

Docs

  • New returns a new, e-mail sender service.
  • Send send an e-mail, supports text/html and sendmail unix command
Send(subject string, body string, to ...string) error

Table of contents

Contributing

If you are interested in contributing to this project, please push a PR.

People

List of all contributors

Documentation

Overview

Package mailer is a simple e-mail sender.

Index

Constants

View Source
const (
	// Version is the current version number of mailer
	Version = "0.0.2"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Host is the server mail host, IP or address
	Host string
	// Port is the listening port
	Port int
	// Username is the auth username@domain.com for the sender
	Username string
	// Password is the auth password for the sender
	Password string
	// FromAddr is the 'from' part of the mail header, it overrides the username
	FromAddr string
	// FromAlias is the from part, if empty this is the first part before @ from the Username field
	FromAlias string
	// UseCommand enable it if you want to send e-mail with the mail command  instead of smtp
	//
	// Host,Port & Password will be ignored
	// ONLY FOR UNIX
	UseCommand bool
}

Config keeps the configs for mail sender service

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default configs for Mail returns just an empty Mail struct

func (Config) IsValid

func (m Config) IsValid() bool

IsValid returns true if the mail configs are valid

type Service

type Service interface {
	// Send sends a mail to recipients
	// the body can be html also
	//
	// Note: you can change the UseCommand in runtime
	Send(string, string, ...string) error
	// UpdateConfig replaces the current configuration with the receiver
	UpdateConfig(Config)
}

Service is the interface which mail sender(mailer) should implement

func New

func New(cfg Config) Service

New creates and returns a new mail service

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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