Setup sendmail to forward to external smtp server


Screenshot from 2014-05-20 01:29:55

If you want your local installation of sendmail to forward all emails to certain, external smtp server, all you have to do is to enable and setup the smarthost feature on the sendmail.mc and sendmail.cf. To do that, open the sendmail.mc

[root@computron ~]# vi /etc/mail/sendmail.mc

Find the line that defines the smart host feature, uncomment, and point it to the external smtp server

dnl # Uncomment and edit the following line if your outgoing mail needs to
dnl # be sent out through an external mail server:
dnl #
define(`SMART_HOST', `[172.16.2.10]')dnl
dnl #

Please notice the bracket at the star and the end of the smtp server’s IP. Restart sendmail by issuing:

[root@computron ~]# service sendmail restart

check whether the change has been reflected on sendmail.cf

[root@computron ~]# vi /etc/mail/sendmail.cf

find the smart host entry, and make sure that the smart host Ip is pointed to the right server

# "Smart" relay host (may be null)
DS[172.16.2.10]

If it’s there, then we’re done!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s