Outgoing emails w/ Sendmail

tested on Slackware 14.2

This is NOT an MX setup. We are merely relaying through a smarthost on the LAN in plain-text (without STARTTLS)

Warning: I like short hostnames hence I had trouble with Sendmail which needs an FQDN. I worked around it by adding .localdomain to the configuration and it goes through, but for the Return-path to be fixed (as the mail sender gets checked at the receiving MX), you might have to play with masquerading on some smtp relay

vi /etc/hosts

x.x.x.x      HOST.localdomain HOST
x.x.x.x      GW.localdomain GW

vipw

root:x:0:0:root@SHORT:/root:/bin/bash

cd /etc/mail/
vi aliases

root:       REAL-EMAIL-ADMIN

newaliases
mv -i sendmail.cf sendmail.cf.dist

cd /usr/share/sendmail/cf/cf
#cp sendmail-slackware-tls.mc custom.mc
cp sendmail-slackware.mc custom.mc
vi custom.mc

define(`confDOMAIN_NAME',`slack9.localdomain')
define(`SMART_HOST',`snegw')

m4 custom.mc > /etc/mail/sendmail.cf
diff -bu /etc/mail/sendmail.cf.dist /etc/mail/sendmail.cf | grep -v dnl

you might notice +Dj and +DS have changed

-#Dj$w.Foo.COM
+Djslack9.localdomain

-DS
+DSsnegw

now check the configuration, enable and restart the daemon

sendmail -d0.1 -bt < /dev/null
ls -lF /etc/rc.d/rc.sendmail
chmod +x /etc/rc.d/rc.sendmail
/etc/rc.d/rc.sendmail restart

Mail should pass through your dedicated internal network relay

tail -F /var/log/maillog
date | mail -s `hostname` root
mailq
sendmail -v -q

Troubleshooting

My unqualified host name (slack9) unknown; sleeping for retry

==> simply adding .localdomain in sendmail.cf, not even in /etc/hosts. We like short hostnames on the LAN. DNS is NOT the only way to deal with naming.

Although the smarthost is properly defined with A and PTR public DNS records, the return-path get’s checked at the receiving MX

Oct 17 13:08:20 malabar postfix/smtpd[17546]: NOQUEUE: reject: RCPT from std30.os3.su[188.130.155.62]: 554 5.1.8 <root@slack9.localdomain>: Sender address rejected: Domain not found; from=<root@slack9.localdomain> to=<pbraun@nethence.com> proto=ESMTP helo=<std30.os3.su>

==> do DOMAIN MASQUERADING on the relay

Resources

Sendmail Open Source https://www.proofpoint.com/us/open-source-email-solution

Forward-confirmed reverse DNS https://en.wikipedia.org/wiki/Forward-confirmed_reverse_DNS

Setup a SmartHost in Linux Sendmail https://rick.cogley.info/post/setup-smarthost-in-linux-sendmail/

Configuring sendmail https://etutorials.org/Linux+systems/red+hat+linux+bible+fedora+enterprise+edition/Part+IV+Red+Hat+Linux+Network+and+Server+Setup/Chapter+19+Setting+Up+a+Mail+Server/Configuring+sendmail/

E.3. m4 sendmail Macros https://docstore.mik.ua/orelly/networking_2ndEd/tcp/appe_03.htm

Force sendmail to deliver a message in sendmail’s mail queue https://www.cyberciti.biz/tips/force-sendmail-to-deliver-a-message-in-sendmails-mail-queue.html

How do I change the sendmail ‘from’ address and domain on the appliance emails? https://unitrends-support.force.com/UnitrendsBackup/articles/How_To/000004131

How to Specify outgoing HELO with sendmail? https://serverfault.com/questions/205271/how-to-specify-outgoing-helo-with-sendmail


Nethence | Pub | Lab | Pbraun | SNE Russia | xhtml