AtlatestRepositorysigil-ses
1
# sigil-ses3
A Sigil library for the [Amazon SES v2](https://docs.aws.amazon.com/ses/latest/APIReference-V2/) API. Send email, manage suppression lists, and parse bounce/complaint notifications.5
## Features7
- **Send email** -- simple text/HTML emails with To/Cc/Bcc/Reply-To support8
- **Bulk email** -- send to multiple recipients with template substitution9
- **Suppression list** -- add, remove, query, and list suppressed addresses10
- **Account info** -- sending quota, daily usage, enforcement status11
- **Identity verification** -- check domain/email DKIM and MAIL FROM status12
- **Bounce/complaint parsing** -- stateless SNS notification parsing with typed records13
- **AWS SigV4 signing** -- full implementation of AWS Signature Version 415
## Usage17
```scheme18
(import (amazon ses))20
;; Create a client (defaults to us-east-2 region)21
(define client (ses-client access-key-id: "AKIA..."22
secret-access-key: "wJalr..."))24
;; Send a simple email25
(ses-send-email client28
"Hello from Sigil"29
"This is the plain text body."30
html: "<h1>Hello from Sigil</h1><p>HTML body here.</p>"31
reply-to: "[email protected]")33
;; Send to multiple recipients34
(ses-send-email client36
'("[email protected]" "[email protected]")37
"Newsletter #42"38
"Plain text content."39
html: "<p>Newsletter content.</p>"40
bcc: '("[email protected]"))42
;; Check account quota43
(let ((acct (ses-get-account client)))44
(display (ses-account-send-quota acct))45
(display (ses-account-sent-last-24h acct)))47
;; Manage suppression list48
(ses-put-suppressed client "[email protected]" "BOUNCE")49
(ses-list-suppressed client)50
(ses-delete-suppressed client "[email protected]")52
;; Check domain identity53
(let ((id (ses-get-identity client "systemcrafters.net")))54
(ses-identity-verified? id)55
(ses-identity-dkim-status id))56
```58
## Bounce/Complaint Notifications60
Parse SNS notifications from SES:62
```scheme63
(import (amazon ses notify))65
;; In your webhook handler, parse the SNS JSON body:66
(let ((notif (parse-ses-notification json-body)))67
(when notif68
(cond69
((ses-hard-bounce? notif)70
;; Remove permanently bounced addresses71
(for-each remove-subscriber (ses-notification-addresses notif)))72
((ses-complaint? notif)73
;; Unsubscribe complainers74
(for-each unsubscribe (ses-notification-addresses notif))))))75
```77
## Configuration79
SES requires AWS credentials with `ses:SendEmail` and related IAM permissions.81
Environment variables (load with your preferred method):82
- `AWS_ACCESS_KEY_ID`83
- `AWS_SECRET_ACCESS_KEY`84
- `AWS_REGION` (optional, defaults to us-east-2)86
## Dependencies88
- sigil-stdlib89
- sigil-http90
- sigil-json91
- sigil-crypto93
## Building95
```bash96
sigil deps install97
sigil build98
sigil test99
```101
## License103
BSD-3-Clause