cwinters8 / gomap

Go module for interfacing with JMAP servers
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link
fastmail go jmap jmap-client

Go Reference Go Report Card License

gomap

Go module for interfacing with JMAP mail servers, such as Fastmail.

Usage

To add the module to your project:

go get -u github.com/cwinters8/gomap

First, create a new mail client. You will need a session URL and a bearer token from your JMAP mail server. For Fastmail, the session URL is https://api.fastmail.com/jmap/session, and you can create an API token in Settings > Privacy & Security > Integrations > API tokens. You will most likely need to give access to Email (for querying and reading email contents) and Email submission (for sending emails) when you create the token.

mail, err := gomap.NewClient(
  "https://api.fastmail.com/jmap/session",
  os.Getenv("BEARER_TOKEN"),
  gomap.DefaultDrafts,
  gomap.DefaultSent,
)
if err != nil {
  log.Fatal(err)
}

Then you can use the client for your chosen operations. Check out the examples for full details on how to send and find emails.