this post was submitted on 14 Apr 2024
32 points (92.1% liked)

Selfhosted

40695 readers
821 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 2 years 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
[–] markstos 1 points 8 months ago (1 children)

I have an SMTP server. I need a sendmail binary that does one thing well: send the message to the SMTP server.

[–] hperrin 1 points 8 months ago (1 children)

Can’t you use sendmail? Also, check out my updated message above. You’ll need to make sure you can send outbound traffic on port 25.

[–] markstos 1 points 8 months ago (2 children)

Sendmail is a binary provided by a mail system and no mail system is installed by default on Fedora.

I’m looking for a solution that’s as simple as possible: provide a sendmail binary to pass the message to a third-party SMTP server.

I’ll connect to Mailgun via TLS— no port 25 involved.

[–] [email protected] 2 points 8 months ago (1 children)

Not sure if it's in fedora, but I use nullmail as my mta. Simple to config and does just MTA

[–] markstos 1 points 8 months ago

Thanks. Turns out it's not in Fedora.

[–] hperrin 1 points 8 months ago* (last edited 8 months ago) (1 children)

Sendmail is provided by the sendmail package in Fedora. Here’s some instructions on installing and configuring it:

https://tecadmin.net/install-sendmail-on-fedora/

But you might instead be looking for an SMTP client (or a Mail User Agent), which is different:

https://www.baeldung.com/linux/send-emails-from-terminal

If you have SMTP credentials with Mailgun, and you’re using port 465 or 587, you want an MUA, not an MTA (Mail Transfer Agent).

Sendmail can be both, but there are better tools if you’re looking for an SMTP client.

[–] markstos 1 points 8 months ago (1 children)

Sendmail is a full-blown MTA released 41 years ago that is notoriously difficult to manage. There are reasons that it's market share has declined from 80% to about 3%. I'm also not looking for a MUA, like mutt. I'm looking for a simple MTA that that only relays outbound mail, like msmtp, ssmtp or nullmailer.

[–] hperrin 2 points 8 months ago* (last edited 8 months ago) (1 children)

Again, if you are not using port 25, you don’t need an MTA. Period.

MTAs are for sending mail from one mail server to another. That’s not what you are doing. You don’t need to be running your own mail server. You are sending mail to an MSA (Mail Submission Agent). Mailgun is the MSA you are submitting to and the MTA that will handle transferring your message to your destination MDA (Mail Delivery Agent).

If you were submitting mail to your destination server over port 25, you would need an MTA.

But, as you stated, you are submitting mail to an MSA using port 465 or 587. You need an MUA.

This terminology is important, because it determines what role the software you’re using plays and how you need to configure it.

There are plenty of tools that act as both MTAs and/or MUAs depending on how you configure them, because their functionality is very similar. I would guess nearly all tools that can do one can do the other. But if you want to use the right tool the right way, I am telling you, with 100% certainty, you should be looking for an “SMTP client”, “email client”, or “mail user agent” (they mean the same thing). You do not want a relay server, and you do not want an MTA.

What you probably mean by what you’re asking is something that receives mail addressed locally (acting as an MSA or an MDA), and fowards it (important: this is not the same as relaying, because the destination address is changed) to an MSA (therefore acting as a MUA). If something is forwarding mail like this, instead of relaying, and calling itself an MTA, that is not technically correct. But you probably don’t need that, unless you’re using something that won’t let you configure how/where it sends mail. You just need to set up something that provides a binary that acts as an MUA. Then set up your daemons to send mail to your actual email address using that.

I’m speaking from experience because I’ve written both an MTA and an MUA, but if you won’t take it from me, take it from Wikipedia:

An MTA works in the background, while the user usually interacts directly with a mail user agent. One may distinguish initial submission as first passing through an MSA—port 465 (or, for legacy reasons, optionally port 587) is used for communication between an MUA and an MSA, while port 25 is used for communication between MTAs, or from an MSA to an MTA.[5]this distinction is clarified in RFC 8314.

- https://en.wikipedia.org/wiki/Message_transfer_agent

[–] markstos 1 points 8 months ago

I need a sendmail binary that sends outgoing mail to an SMTP server with as few other features as possible.