Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bourgeoisbear/email.v2

An E-Mail Interface for Nerds
https://github.com/bourgeoisbear/email.v2

attachments email gmail go golang helo office365 postfix smtp smtp-client ssl starttls tls

Last synced: 1 day ago
JSON representation

An E-Mail Interface for Nerds

Awesome Lists containing this project

README

        

# email.v2
Yet another SMTP client!

[![GoDoc](https://godoc.org/github.com/BourgeoisBear/email.v2?status.svg)](https://godoc.org/github.com/BourgeoisBear/email.v2)

![SMTP Logging](smtp_logging.png)

## Features

This package currently supports the following:

* From, To, Bcc, and Cc fields
* Email addresses in both "[email protected]" and "First Last <[email protected]>" format
* Text and HTML Message Body
* Attachments
* Read Receipts
* Custom Headers
* SMTP Logging
* Integrated Client Settings

## Installation

```go get github.com/BourgeoisBear/email.v2```

## Simple Usage

```go

oCfg := SMTPClientConfig{
Server: "mx.test.com",
Port: 587,
Username: "[email protected]",
Password: "...",
Mode: ModeSTARTTLS,
// SMTPLog: "-", // note: uncomment to log SMTP session to STDOUT
}

oEmail := NewEmail()
oEmail.From = "[email protected]"
oEmail.To = []string{"[email protected]"}
oEmail.Subject = "Test Message"
oEmail.Text = []byte("Whoomp there it is!")

E := oCfg.SimpleSend(oEmail)
if E != nil { return E }

```

## Reasons for Fork

This is a fork of https://github.com/jordan-wright/email

* ripped out connection pooling (sending via long-term connections to SMTP servers has not been reliable)
* condensed multiple Send... methods into NewClient() & Send() to
* provide a more generic way of establishing unauthenticated, SSL, and STARTTLS connections
* send multiple messages from within a single established SMTP session
* make direct use of outside net.Conn interfaces, so as to set dial and I/O deadlines
* added `LoginAuth` authentication interface for use with Office 365
* added `TextprotoLogged` for full logging of SMTP traffic

## Testing

To run unit tests, add the proper credentials to `email_test_settings.json` for accounts you choose to test with. Examples for O365, GMAIL, & CUSTOM have been provided.