corecode / dma

The DragonFly Mail Agent, a small Mail Transport Agent (MTA), designed for home and office use.
Other
231 stars 50 forks source link

Feature request: Webhook support #135

Closed mohag closed 3 months ago

mohag commented 3 months ago

This might be completely out of scope, but it might have some interesting use cases... (and useful discussion)

Sending SMTP mails (and getting them delivered) is getting harder, especially directly from servers (for alerting) (which is what I suspect a lot of DMA use is)

IM platforms like Matrix / Discord / Slack / Teams are becoming quite common and mostly provide the option of using webhooks to send messages.

It would be useful if DMA could provide an option to send messages to webhooks instead of over SMTP. A URL in the aliases file is the obvious way, with fields from the mail being available to add (as URL parameters), however some kind of template for the message (ideally configurable per webhook would also be useful (but likely means a different alias entry format) (I suggest something like webhook:webhook-config, where webhook-config is a filename that provides the details of the webhook URL, header and body templates.). It might make sense for the templates to be a file reference, to allow them to be reused for multiple webhooks.

Examples could be included for common targets:

Another way, like scripts begin called from aliases might make more sense. (Including examples would remain useful) This likely keeps HTTP(S), JSON and templating code out of core DMA. (It is not clear from the man page if DMA supports "pipe" aliases, which would be one way of doing this)

PowerMTA seems to have some limited webhook support for mail delivery (the body is fixed, not templated)

mohag commented 3 months ago

Currently my main question / request is: Is pipe aliases supported? (My main problem is to keep email from accumulating on servers running in various environments with various issues sending emails and getting the mails into Teams)

(And how do they deal with failures (non-zero exit code) / retries?)

(And then to try and find / build something that can use pipe aliases to send webhooks)

corecode commented 3 months ago

pipe aliases are not supported. too many security considerations.

On July 30, 2024 3:47:06 AM CDT, Gert van den Berg @.***> wrote:

Currently my main question / request is: Is pipe aliases supported?

(And then to try and find / build something that can use pipe aliases to send webhooks)

-- Reply to this email directly or view it on GitHub: https://github.com/corecode/dma/issues/135#issuecomment-2257811375 You are receiving this because you are subscribed to this thread.

Message ID: @.***> -- Sent from my Android device with K-9 Mail. Please excuse my brevity.

mohag commented 3 months ago

Thanks. Some way to get mails out other than SMTP would be useful.

I later realised that direct webhook support likely requires way too much libraries.

Some option to call external tools is probably what makes sense. (mainly something to keep in mind if a good solution presents itself in the future)