-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
24 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,27 @@ | ||
# gomap | ||
|
||
Go module for interfacing with [JMAP](https://jmap.io) servers | ||
Go module for interfacing with [JMAP](https://jmap.io) mail servers, such as [Fastmail](https://www.fastmail.com/). | ||
|
||
## 🚧 under construction 🚧 | ||
## Usage | ||
|
||
To add the module to your project: | ||
|
||
```sh | ||
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](https://www.fastmail.com/settings/security/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. | ||
|
||
```go | ||
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](https://pkg.go.dev/github.com/cwinters8/gomap#pkg-examples) for full details on how to send and find emails. |