Skip to content

davidbanham/notifications

Repository files navigation

Notifications

PkgGoDev

Notifications is a util to send emails via Amazon SES.

Notifications supports:

  • HTML bodies
  • Text bodies
  • Emails with only an HTML or Text body
  • Attachments
  • JSON serialisation of emails and attachments
  • Emails sent to an icloud address and read via the Mail app on iOS (harder than you think!)

Notifications does not support:

  • Inline attachments

Example

package main

import (
	"log"
	"strings"

	"github.com/davidbanham/notifications"
)

func main() {
	if err := notifications.SendEmail(notifications.Email{
		To:      "to@example.com",
		From:    "from@example.com",
		ReplyTo: "reply_to@example.com", //optional
		Text:    "this is the text part of a test run",
		HTML:    "this <i>is the HTML part of a test</i> run",
		Subject: "Simple Test Run",
		Attachments: []notifications.Attachment{
			notifications.Attachment{
				ContentType: "text/plain",
				Filename:    "test_data.txt",
				Data:        strings.NewReader("oh hi I am an attachment"),
			},
		},
	}); err != nil {
		log.Fatal(err)
	}
}

About

Notification driver for go

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages