Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/iamd3vil/postal_go

Go client library for Postal(https://github.com/postalserver/postal)
https://github.com/iamd3vil/postal_go

Last synced: 9 days ago
JSON representation

Go client library for Postal(https://github.com/postalserver/postal)

Awesome Lists containing this project

README

        

# Postal-Go

This is a client library for sending emails through [Postal](https://github.com/postalserver/postal).

Uses the [Send a raw RFC2882 message](http://apiv1.postalserver.io/controllers/send/raw) api.

## Usage

```go
client, err := NewAPIClient(postalAddr, postalToken, &http.Client{
Timeout: 10 * time.Second,
})
if err != nil {
log.Fatalf("error creating api client: %v", err)
}

msg := Message{
From: fromAddr,
To: []string{toAddr},
Subject: "Test Email",
PlainBody: "Test Email from postal_go",
}
if err := msg.AttachFile("test/hello.txt"); err != nil {
log.Fatalf("error attaching file: %s", err)
}

resp, err := client.SendMessage(msg)
if err != nil {
log.Fatalf("error from send message: %v", err)
}
```

## Docs

See the docs at [Godoc](https://pkg.go.dev/github.com/iamd3vil/postal_go).