mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 18:24:35 +03:00
add a webapi and webhooks for a simple http/json-based api
for applications to compose/send messages, receive delivery feedback, and maintain suppression lists. this is an alternative to applications using a library to compose messages, submitting those messages using smtp, and monitoring a mailbox with imap for DSNs, which can be processed into the equivalent of suppression lists. but you need to know about all these standards/protocols and find libraries. by using the webapi & webhooks, you just need a http & json library. unfortunately, there is no standard for these kinds of api, so mox has made up yet another one... matching incoming DSNs about deliveries to original outgoing messages requires keeping history of "retired" messages (delivered from the queue, either successfully or failed). this can be enabled per account. history is also useful for debugging deliveries. we now also keep history of each delivery attempt, accessible while still in the queue, and kept when a message is retired. the queue webadmin pages now also have pagination, to show potentially large history. a queue of webhook calls is now managed too. failures are retried similar to message deliveries. webhooks can also be saved to the retired list after completing. also configurable per account. messages can be sent with a "unique smtp mail from" address. this can only be used if the domain is configured with a localpart catchall separator such as "+". when enabled, a queued message gets assigned a random "fromid", which is added after the separator when sending. when DSNs are returned, they can be related to previously sent messages based on this fromid. in the future, we can implement matching on the "envid" used in the smtp dsn extension, or on the "message-id" of the message. using a fromid can be triggered by authenticating with a login email address that is configured as enabling fromid. suppression lists are automatically managed per account. if a delivery attempt results in certain smtp errors, the destination address is added to the suppression list. future messages queued for that recipient will immediately fail without a delivery attempt. suppression lists protect your mail server reputation. submitted messages can carry "extra" data through the queue and webhooks for outgoing deliveries. through webapi as a json object, through smtp submission as message headers of the form "x-mox-extra-<key>: value". to make it easy to test webapi/webhooks locally, the "localserve" mode actually puts messages in the queue. when it's time to deliver, it still won't do a full delivery attempt, but just delivers to the sender account. unless the recipient address has a special form, simulating a failure to deliver. admins now have more control over the queue. "hold rules" can be added to mark newly queued messages as "on hold", pausing delivery. rules can be about certain sender or recipient domains/addresses, or apply to all messages pausing the entire queue. also useful for (local) testing. new config options have been introduced. they are editable through the admin and/or account web interfaces. the webapi http endpoints are enabled for newly generated configs with the quickstart, and in localserve. existing configurations must explicitly enable the webapi in mox.conf. gopherwatch.org was created to dogfood this code. it initially used just the compose/smtpclient/imapclient mox packages to send messages and process delivery feedback. it will get a config option to use the mox webapi/webhooks instead. the gopherwatch code to use webapi/webhook is smaller and simpler, and developing that shaped development of the mox webapi/webhooks. for issue #31 by cuu508
This commit is contained in:
22
README.md
22
README.md
@ -33,6 +33,8 @@ See Quickstart below to get started.
|
||||
support is limited).
|
||||
- Webserver with serving static files and forwarding requests (reverse
|
||||
proxy), so port 443 can also be used to serve websites.
|
||||
- Simple HTTP/JSON API for sending transaction email and receiving delivery
|
||||
events and incoming messages (webapi and webhooks).
|
||||
- Prometheus metrics and structured logging for operational insight.
|
||||
- "mox localserve" subcommand for running mox locally for email-related
|
||||
testing/developing, including pedantic mode.
|
||||
@ -133,12 +135,13 @@ https://nlnet.nl/project/Mox/.
|
||||
|
||||
## Roadmap
|
||||
|
||||
- Aliases, for delivering to multiple local accounts.
|
||||
- Webmail improvements
|
||||
- HTTP-based API for sending messages and receiving delivery feedback
|
||||
- Calendaring with CalDAV/iCal
|
||||
- More IMAP extensions (PREVIEW, WITHIN, IMPORTANT, COMPRESS=DEFLATE,
|
||||
CREATE-SPECIAL-USE, SAVEDATE, UNAUTHENTICATE, REPLACE, QUOTA, NOTIFY,
|
||||
MULTIAPPEND, OBJECTID, MULTISEARCH, THREAD, SORT)
|
||||
- SMTP DSN extension
|
||||
- ARC, with forwarded email from trusted source
|
||||
- Forwarding (to an external address)
|
||||
- Add special IMAP mailbox ("Queue?") that contains queued but
|
||||
@ -447,6 +450,23 @@ messages, for example by replacing your Message-Id header and thereby
|
||||
invalidating your DKIM-signatures, or rejecting messages with more than one
|
||||
DKIM-signature.
|
||||
|
||||
## Can I use mox to send transactional email?
|
||||
|
||||
Yes. While you can use SMTP submission to send messages you've composed
|
||||
yourself, and monitor a mailbox for DSNs, a more convenient option is to use
|
||||
the mox HTTP/JSON-based webapi and webhooks.
|
||||
|
||||
The mox webapi can be used to send outgoing messages that mox composes. The web
|
||||
api can also be used to deal with messages stored in an account, like changing
|
||||
message flags, retrieving messages in parsed form or individual parts of
|
||||
multipart messages, or moving messages to another mailbox or deleting messages
|
||||
altogether.
|
||||
|
||||
Mox webhooks can be used to receive updates about incoming and outgoing
|
||||
deliveries. Mox can automatically manage per account suppression lists.
|
||||
|
||||
See https://www.xmox.nl/features/#hdr-webapi-and-webhooks for details.
|
||||
|
||||
## Can I use existing TLS certificates/keys?
|
||||
|
||||
Yes. The quickstart command creates a config that uses ACME with Let's Encrypt,
|
||||
|
Reference in New Issue
Block a user