Linux: Sendmail setup and forwarding root email to an external server
1. yum install sendmail
2. yum install sendmail-cf
3. nano sendmail.mc
Add smart host
define(`SMART_HOST’, `[your.smtpserver.com]’)dnl
*Make certain your smtp server is set to allow connections from your ip*
If you want your sendmail to accept remote connections add dnl:
dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA’)dnl
4. ./make sendmail.cf
5. service sendmail restart
6. nano /etc/aliases
root: [email protected]
7. newaliases
8. nano /etc/hosts
127.0.0.1 servername.domain.com localhost servername
::1 localhost6.localdomain6 localhost6
172.22.2.122 mailhost smtpmailserver.yourserver.com
9. echo “This is a test” | mailx -s “A test mail” root < /dev/null
To test is you are accepting SMTP traffic
telnet yourservername 25
HELO yourservername Like I am 🙂
MAIL FROM:root@yourservername My address
RCPT TO:therename@yourservername Your address
DATA
text message for therename. This is text message