ses

package module
v0.0.0-...-0093a08 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2014 License: MIT Imports: 10 Imported by: 0

README

go-ses

This is a Go package to send emails using Amazon's Simple Email Service.

Installation

go get github.com/bearbin/go-ses

Usage

Then create and use an ses object:

ses, err := ses.Init(username, secretkey, endpoint)
response, err := ses.SendMail("info@example.com", "user@gmail.com", "Welcome!", "Welcome to our project!\n\n...")

The first return value is the response string from the server. To extract the message and request IDs:

var resp ses.AmazonResponse
err := xml.Unmarshal([]byte(response), &resp)
// resp.MessageId, resp.RequestId

About

The original library was written by Patrick Crosby at StatHat.

Documentation

Overview

ses is a Go package to send emails using Amazon's Simple Email Service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AmazonResponse

type AmazonResponse struct {
	MessageId string `xml:"SendEmailResult>MessageId"`
	RequestId string `xml:"ResponseMetadata>RequestId"`
}

for your convenience, a struct you can use with encoding/xml on the server's response

type SES

type SES struct {
	// contains filtered or unexported fields
}

func Init

func Init(accessKey, secretKey, endpoint string) (*SES, error)

Init creates a SES object that can be used to send email. accessKey and secretKey must be set, and it errors if they are not, but endpoint is assumed to be "https://email.us-east-1.amazonaws.com" if it is not set.

func (*SES) SendHTMLMail

func (ses *SES) SendHTMLMail(from, to, subject, body string) (string, error)

func (*SES) SendMail

func (ses *SES) SendMail(from, to, subject, body string) (string, error)

Jump to

Keyboard shortcuts

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