notifications

package module
v1.2.15 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2022 License: MIT Imports: 8 Imported by: 0

README

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)
	}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendEmail

func SendEmail(email Email) error

func SendRawEmail

func SendRawEmail(data []byte) error

Types

type Attachment

type Attachment = marcel.Attachment

type Email

type Email = marcel.Email

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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