Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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)
- Host: GitHub
- URL: https://github.com/iamd3vil/postal_go
- Owner: iamd3vil
- License: mit
- Created: 2022-05-17T05:34:16.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-05-17T06:46:59.000Z (over 2 years ago)
- Last Synced: 2024-06-20T12:01:16.544Z (5 months ago)
- Language: Go
- Size: 9.77 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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).