Solved One more problem with the smtp of my ISP

Well, you could change perodic to create log files,
Code:
       To log periodic output instead of receiving it as email,    add  the  fol-
       lowing lines to /etc/periodic.conf:

         daily_output=/var/log/daily.log
         weekly_output=/var/log/weekly.log
         monthly_output=/var/log/monthly.log

       To  only     see  important     information from daily    periodic jobs, add the
       following lines to /etc/periodic.conf:

         daily_show_success=NO
         daily_show_info=NO
         daily_show_badconfig=NO

and have another script pickup the logs and email those to you. Then you can create the headers as you like.
 
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.
 
He can also use the built in DMA instead of sendmail or ssmtp using smarthost to replay the e-mails. Some ISP blocks smtp port to reduce and fight against spam and only allows MTA via they MX or 465/587 which requires auth to public MX.
 
Thanks you all. But, as always, I take the simplest path to reach the objective. I know well that one day, I will be obliged to set my own mail server (not open to internet) and I will just read these mails on my local network. I'm not in hurry at all to live this day because it's something complex. Also, these periodic mails aren't of the utmost importance, they come from a home server.

The solution I used is:
Modification of /etc/mail/mailer.conf
#
# mailer.conf for use with dma(8)
#
# If dma(8) is installed, an example mailer.conf that uses dma(8) instead can
# can be found in /usr/share/examples/dma.
#
sendmail /root/sm
send-mail /usr/local/sbin/ssmtp
mailq /usr/local/sbin/ssmtp
newaliases /usr/local/sbin/ssmtp
hoststat /usr/bin/true
purgestat /usr/bin/true
/root/sm is this script:
Code:
#!/bin/sh

# Remove first line: "To: root"
read line

# To avoid a blank line starting the mail
read mail
while read line
do
    mail="$mail
$line"
done

echo "$mail" | ssmtp "MyEmailAddress"
 
Back
Top