Hi,
Referring to this post:
https://forums.freebsd.org/threads/run-your-own-mail-server-by-m-w-lucas.93777/#post-658356
My ISP hardened once again its rules concerning the use of its smtp. So, my
periodic mails aren't anymore delivered.
This time, it's the
to:
field that must either don't exist or be equal to the destination address of the mail.
I use
mail/ssmtp as MTA and the mails
periodic sent have the field
to: root
which is now rejected (exactly: accepted but never delivered). I didn't find a mean to modify this
to:
field.
So, my question is: is it possible to modify or delete this field with ssmtp or any specific
periodic setting?
If not, what is the simplest MTA that allows this?
Ideally you don't want your cron emails, or any email between servers on your network or emails from your laptop to yourself to be relayed through your ISP back to you. I don't know anything about ssmtp but on my network I use postfix and sendmail -- sendmail internally on some hosts postfix on others and postfix on my gateway.
My postfix transport file specifies which destinations are locally delivered, i.e. on my network, and which are forwarded (the rest of them) through my ISP. (My ISP blocks egress ports 25/tcp.) You can do the same with sendmail's mailertable.
Reiterating, I've never used ssmtp but doing a bit of reading about it, ssmtp has no facility to relay email based on destination.
To answer your last question, you have basically three options: postfix, sendmail, and exim.
IMO exim is the least secure option, though it probably handles heavy load better than any other MTA.
Sendmail is your second choice. It does have a bad reputation for bad security but there hasn't been a sendmail CVE for a decade or two. It's been cleaned up significantly. It's reliable and comes with FreeBSD. But there's a downside: It's got a steep learning curve. If you've used it before it's certainly an option. A copy of my mailertable on one of my machines is below:
Code:
cwsys.cwsent.com esmtp:[cwsys.cwsent.com]
bob.cwsent.com esmtp:[cwsys.cwsent.com]
. esmtp:cwfw.cwsent.com
Here we see forwarding for two destinations with a default to my gateway.
The last option is Postfix. I use postfix on most of my machines (with sendmail on the rest). IMO, of the three main MTAs it's probably the easiest to learn. And, it's secure. I think over it's 30 year history it might have had only one CVE. A sample of the transport file on my gateway is below:
Code:
komquats.com :
.komquats.com :
cschubert.com :
.cschubert.com :
vibsd.org :
.vibsd.org :
vibsd.net :
.vibsd.net :
cwsent.com :
.cwsent.com :
* smtp:mail.my-isp.com:587
In the above example email to all my domains are handled locally while everything else is sent to my ISP.
Sendmail and Postfix can handle authenticated SMTP. A sample saslpasswd for postfix might be:
Code:
mail.destination.ca me:password
smtp.gmail.com:587 me:password
mail.destination.org me:password
[mail.destination.com]:587 me:password
Exim, Sendmail, and Postfix have the capablity and flexability to do exactly what you're asking but at the cost of a steeper learning curve. My recommendation would be postfix or Sendmail. If you're a sysadmin or aiming to become one, learning one or all three of these MTAs would benefit your career. My choice of Postfix is because of its excellent security track record.
If you are a sysadmin or wanting to improve your marketability, consider that Exim handles over 50% of all email traffic on the Internet while Postfix is a distant second and Sendmail is in a more distant third place. See
https://www.securityspace.com/s_survey/data/man.202407/mxsurvey.html.