Sendmail Tips & Tricks
Setup Sendmail for incoming mails (RedHat Linux)
Backup sendmail.cf before we proceed... ;-)
cp -p /etc/sendmail.cf /etc/sendmail_bak1.cf
vi /etc/mail/sendmail.mc
dnl This changes sendmail to only listen on the loopback device 127.0.0.1
dnl and not on any other network devices. Comment this out if you want
dnl to accept email over the network.
dnl XX DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')
m4 /etc/mail/sendmail.mc > /etc/sendmail.cf
vi /etc/mail/local-host-names
add domain name at the beginning of a line:
yourdomain.com
/etc/rc.d/init.d/sendmail restart
process the queue:
sendmail -v -q
Sendmail at shell prompt:
/usr/sbin/sendmail -f reply@yourhost.com youralias < /tmp/date.txt
220 your-mail-host.ch ESMTP Service (7.0.008) ready
helo dude
250 your-mail-host.ch
mail from: <root@your-mail-host.ch>
250 MAIL FROM:<root@your-mail-host.ch> OK
rcpt to:<retoh@your-mail-host.ch>
250 RCPT TO:<retoh@your-mail-host.ch> OK
data
354 Start mail input; end with <CRLF>.<CRLF>
From: sender@anydomain.ch
To: foo@bar.com
Subject: hi
bla
.
250 <3E5CF7BB00000003> Mail accepted
quit
Setup a Relay Server
Just edit relay-domains:
vi /etc/mail/relay-domains
Add every source IP address you would like to allow for mail relay.
Sample:
# foo
192.168.1.111
192.168.1.112
192.168.1.
You have to restart Sendmail after changing this file.
Stop spamming Domains
vi /etc/mail/access
# comment here
localhost.localdomain RELAY
localhost RELAY
127.0.0.1 RELAY
mailhosting.ifxnetworks.com DISCARD
ifxnetworks.com DISCARD
Debugging Sendmail
Testen von Mailinglists in /etc/aliases
sendmail -bv -v your_alias
For a complete list of the available debug flags:
ident /usr/sbin/sendmail | grep Debug
Running in foreground for debugging purposes
Start Sendmail in forground debugging mode
sendmail -bD -d 30
Tips
Generic method to find out your version of Sendmail:
sendmail -d0.1 </dev/null