blog/content/post/disable-sendmail-in-freebsd.md

2.3 KiB

title date lastmod draft keywords description tags categories author comment toc autoCollapseToc postMetaInFooter hiddenFromHomePage contentCopyright reward mathjax mathjaxEnableSingleDollar mathjaxEnableAutoNumber hideHeaderAndFooter flowchartDiagrams sequenceDiagrams
Disable sendmail in FreeBSD 2021-12-11T09:57:29Z 2022-04-29T09:57:29Z false
sendmail freebsd
sendmail
freebsd
false false false true false false false false false false false
enable options
false
enable options
false

I do not use emails on my FreeBSD machine so I did not bother setting it up. But it runs at startup and apparently prevents other services from starting till it finishes its job (I cannot ssh into this machine till sendmail decides it has had enough and stops).

Change these lines to /etc/mail/mailer.conf to

sendmail   /usr/bin/true
mailq      /usr/bin/true
newaliases /usr/bin/true
hoststat   /usr/bin/true
purgestat  /usr/bin/true 

And in /etc/periodic/periodic.conf to

# disable sendmail (mailqueue) cleanups:
daily_clean_hoststat_enable="NO"
daily_status_mail_rejects_enable="NO"
daily_status_mailq_enable="NO"
daily_submit_queuerun="NO"

# disable periodic's emailing by logging!
daily_output=/var/log/daily.log
weekly_output=/var/log/weekly.log
monthly_output=/var/log/monthly.log

# put these into the log, instead of trying to mail them
daily_status_security_inline="YES"
weekly_status_security_inline="YES"
monthly_status_security_inline="YES"

And in /etc/rc.conf to

# disable sendmail
sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_msp_queue_enable="NO"
sendmail_outbound_enable="NO"

# don't allow cron to mail
cron_flags="-m ''"

Instructions taken from https://gist.github.com/igalic/c77ed494e102977c9fd06ce9b053cda0