April 26

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


Copyright 2021. All rights reserved.

Posted April 26, 2012 by Timothy Conrad in category "Linux

About the Author

If I were to describe myself with one word it would be, creative. I am interested in almost everything which keeps me rather busy. Here you will find some of my technical musings. Securely email me using - PGP: 4CB8 91EB 0C0A A530 3BE9 6D76 B076 96F1 6135 0A1B