em

package module
v0.0.0-...-79f32f8 Latest Latest
Warning

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

Go to latest
Published: May 12, 2016 License: MIT Imports: 12 Imported by: 0

README

emailbuilder

license

A Go (golang) wrapper around mailbuilder that provides a different syntax.

Documentation

Overview

Package em is a wrapper around mailbuilder that provides a different syntax for using the mail builder.

// (C) Philip Schlump, 2014-2015. // (C) Rod Brown, 2014.

Use a JSON file that looks like

-- cut --

{
	 "Username":"yourname@gmail.com"
	,"Password":"yourpassword"
	,"EmailServer":"smtp.gmail.com"
	,"Port":587
}

-- cut --

Put the file in $HOME/.email/email-config.json

Index

Constants

View Source
const (
	Version = "Version: 1.0.0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EM

type EM struct {
	EmailCfgFn  string
	EmailConfig EmailUser
	SmtpAuth    smtp.Auth
	Message     *mailbuilder.Message
	Alt         *mailbuilder.MultiPart
	Mixed       *mailbuilder.MultiPart
	Err         error
	// contains filtered or unexported fields
}

func NewEm

func NewEm(ec EmailUser) *EM

func NewEmFile

func NewEmFile(fn string, pe bool) *EM

func (*EM) Attach

func (this *EM) Attach(fn string) *EM

Attach a file to the email - may be a relative path. The file name that is sent in the email will be the base file name.

func (*EM) Bcc

func (this *EM) Bcc(addr string, name string) *EM

Set the BCC: destination address, may be called more than onece.

func (*EM) Cc

func (this *EM) Cc(addr string, name string) *EM

Set the CC: destination address, may be called more than onece.

func (*EM) From

func (this *EM) From(addr string, name string) *EM

Set the source of the message

func (*EM) HtmlBody

func (this *EM) HtmlBody(s string) *EM

Send a HTML body with the email.

func (*EM) SendIt

func (this *EM) SendIt() (err error)

Last call. This sends the message.

func (*EM) SetMaxLineLength

func (this *EM) SetMaxLineLength(n int)

The default is 500 wich is a good length for liens. If you need ti to be shorter then this schould be called afer NewEmFile or NewEm

func (*EM) SetPrintErrors

func (this *EM) SetPrintErrors(b bool)

em will print out error messages by default. If you need to turn this off so that error messages are only returnd then pass 'false'. Should be called after NewEmFile or NewEm

func (*EM) Subject

func (this *EM) Subject(s string) *EM

Set the Subject for the email.

func (*EM) TextBody

func (this *EM) TextBody(s string) *EM

Send a Text body with the email.

func (*EM) To

func (this *EM) To(addr string, name string) *EM

Set the destination address, may be called more than onece.

type EmailUser

type EmailUser struct {
	Username    string // Something like you@yourdomain.com
	Password    string // Your paassword like password123
	EmailServer string // smtp.gmail.com
	Port        int    // 587 for example
}

---------------------------------------------------------------------------------------------------------------------

Jump to

Keyboard shortcuts

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