8000 GitHub - dkfbasel/postmark: Convenience wrapper for the postmarkapi.com email service
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

dkfbasel/postmark

Repository files navigation

Postmark module

Convenience wrapper for the postmarkapi.com email service. An example of the usage is given below. Batch email sending and postmark templates are also supported. The package does not depend on any other packages outside the standard go library.

import (
	"fmt"
	"log"

	"github.com/dkfbasel/postmark"
)

func ExampleService() {

	// initialize the service
	mailer, err := postmark.New(postmark.DefaultHost, postmark.TestApiKey,
		postmark.Address("DKFBasel", "i
595A
nfo@dkfbasel.ch"))

	if err != nil {
		log.Fatalf("could not initialize postmark service: %+v\n", err)
	}

	// compose a new message, use postmark.Emails for multiple email addresses
	// or postmark.Addresses for multiple addresses
	message := postmark.Message{
		To:       postmark.Emails("someone@dkfbasel.ch", "someone-else@dkfbasel.ch"),
		Subject:  "This is a subject",
		TextBody: "MESSAGE-BODY-AS-TEXT",
	}

	// send the message through the postmark service
	response, err := mailer.Send(&message)

	if err != nil {
		log.Fatalf("could not send the message: %+v\n", err)
	}

	fmt.Printf("%#v\n", response)
}

About

Convenience wrapper for the postmarkapi.com email service

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

0