this post was submitted on 14 Apr 2024
31 points (91.9% liked)

Selfhosted

38768 readers
298 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

I'm looking for a simple sendmail replacement to receive local mail, such as from cron and service failures and forward it to on to a real SMTP server.

I have used msmtpd successfully but thought I'd ask if folks have other solutions they like.

you are viewing a single comment's thread
view the rest of the comments
[–] atzanteol 6 points 4 months ago (3 children)

ssmtp is what I've used before.

[–] [email protected] 6 points 4 months ago (3 children)

@atzanteol @[email protected]

ssmtp is unmaintained.

msmtp is the recommended successor. The Arch wiki recommends also considering OpenSMTPD, which I haven't looked at yet.

https://wiki.archlinux.org/title/SSMTP

[–] atzanteol 1 points 4 months ago
[–] [email protected] 1 points 4 months ago

@atzanteol

Looks like to setup OpenSMTP as a relay, you are recommended to use procmail, which is itself unmaintained.

https://wiki.archlinux.org/title/OpenSMTPD

Still msmtp lacks one feature that I had to workaround: It wasn't properly handling cron mail that was generated to a bare address like root or test. I solved that by writing an sendmail wrapper which rewrites the input just before it's handled to msmtp.

https://github.com/marlam/msmtp/issues/98
https://github.com/chriswayg/ansible-msmtp-mailer/issues/14

[–] [email protected] 1 points 4 months ago

I just started using OpenSMTPD as a backup relay and it seems to work for that. Very lightweight and easy to set up.

[–] [email protected] 2 points 4 months ago* (last edited 4 months ago)

ssmtp is also my go-to for this. Or dma (DragonFly Mail Agent) - if available - which provides a queue in case the delivery to the smarthost fails. But as it's not running as a daemon (saving resources), so you have to setup a regular cronjob to process the queued messages.

[–] synestine 1 points 4 months ago

I use ssmtp as well for a simple sendmail replacement. It takes over the sendmail command, doesn't open any ports. You configure it for the domain you want and tell it what server to send everything to and it works.