How to send email from a Red Hat box

Every time I set up a box our DNS and network trips me up. Intelliware doesn’t publish an MX record with a local address to the internal lan. So Sendmail tries to connect to our external address, and nothing happens. The answer is to explicitly relay through our mailhub using a Sendmail SMART_HOST.

I’m starting with a minimal RedHat EL 4 installation:

You need to install the sendmail macro package.

# rpm -Uvh sendmail-cf-8.13.1-2.i386.rpm

Then add the SMART_HOST definition to the sendmail.mc file.

# cd /etc/mail
# vi sendmail.mc

You will find a section like this

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

Edit the provider and uncomment it

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',`mailserver.intelliware.ca')

Run make from /etc/mail

# pwd
/etc/mail
# make

Restart sendmail

# service sendmail status

Done.

Note: this will only allow email to Intelliware addresses. If you need to send mail to external addresses (e.g. customers), you will need to allow relaying from this machine.