Postmark is a transactional email service. Rye can compose and send emails through it using a Postmark server API token.
This package needs a build with -tags "b_contrib,b_postmark".
client: open-postmark "your-postmark-server-token"
; Create a blank message
msg: new-postmark-email
; Set the from/to, subject, and body
msg .From! sender@example.com
msg .To! customer@example.com
msg .Subject! "Your order"
msg .Text-body! "Thanks for your order!"
; Send it
msg .Send client
The ! methods mutate the message and return it, so you can chain them:
new-postmark-email
|From! sender@example.com
|To! customer@example.com
|Subject! "Welcome"
|Text-body! "Hi there!"
|Send client
Attach a file by giving a file URI. The content type is inferred from the file extension.
msg: new-postmark-email
msg .From! sender@example.com
msg .To! customer@example.com
msg .Subject! "Your invoice"
msg .Text-body! "Please find your invoice attached."
msg .Attach! file://./invoice.pdf
msg .Send client