Tuesday, September 18, 2007

Sendmail Relay

How do you get root's mail to my inbox on a different PC?

1. Edit your sendmail.mc file to include "define(`SMART_HOST', `a.b.c.d')", where a.b.c.d is the ip of a mail server you are allowed to relay through.
2. Generate a new sendmail.cf file using the m4 utility
cd /etc/mail
m4 sendmail.mc > sendmail.cf
3. Restart sendmail
service sendmail restart
4. Edit /etc/aliases to point root's mail to your mail
root: user@domain.com
5. Run the newaliases command
6. It is always a good idea to insure that sendmail is only running on the localhost, this can be verified by checking the sendmail.mc file for

DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

Note: You can always edit the submit.cf file to change the relay host from the localhost to the actual mail relay server. This will allow you to get mail from cronjobs that have you specified in the mailto=... syntax. You would do this if sendmail was not running.

There may be better ways but I have not found them.

Matthew

No comments: