amzses

package module
v0.0.0-...-0e9bf6f Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2012 License: MIT Imports: 11 Imported by: 0

README

amzses

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

Installation

Use go get:

go get github.com/alltom/amzses

If you are building your code with goinstall, you can skip the previous step and just import amzses as follows:

import (
        "github.com/alltom/amzses"
)

Using go install will automatically install its one external dependency, jconfig.

Usage

Optionally, save your credentials in /etc/aws.conf:

{
    "aws_access_key": "XXX_YOUR_ACCESS_KEY_XXX",
    "aws_secret_key": "YYY_YOUR_SECRET_KEY_YYY"
}

Then create and use an ses object:

ses := amzses.Init() // credentials loaded from /etc/aws.conf
ses := amzses.InitAuth("XXX_YOUR_ACCESS_KEY_XXX", "YYY_YOUR_SECRET_KEY_YYY")

_, 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 amzses.AmazonResponse
err := xml.Unmarshal([]byte(s), &resp)
// resp.MessageId, resp.RequestId

Status

The modifications in this fork (alltom/amzses) haven't really been tested at all, but the original library (stathat/amzses) was in use at StatHat in production, so it's probably in pretty good shape.

About

The original library was written by Patrick Crosby at StatHat. Twitter: @stat_hat

Documentation

Overview

amzses 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() *SES

func InitAuth

func InitAuth(accessKey, secretKey string) *SES

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