Configure sendmail as an MTA relay on Slackware

On February 22, 2011, in GNU/Linux, by Vegard Haugland

My landlord recently changed to a different ISP that blocks all outgoing requests on port 25, except towards their own SMTP-server. After getting my hands dirty by plowing throgh the sendmail documentation, located here, I figured out that it wasn’t very difficult to configure sendmail to relay all outgoing e-mails towards this server, thus solving the entire problem.

If you want all outgoing mail to go to a central relay site, define SMART_HOST.

I started by checking the sendmail configuration file, /etc/mail/sendmail.cf, that strictly specified “DO NOT EDIT THIS FILE!  Only edit the source .mc file.“. Following this advice, I had to figure out where this .mc file was located.

I did a quick search for all files containing sendmail and cf on my local system, and discovered “/usr/share/sendmail/cf/cf/sendmail-slackware.mc“. That was indeed the correct file, and I simply added “define(`SMART_HOST’, `smtp.online.no’)“. To see the entire configuration file, expand the spoiler below.

Spoiler Inside: modified sendmail-slackware.mc SelectShow

Once that was done, I had to compile the configuration file with “m4 /usr/share/sendmail/cf/cf/my-sendmail.slackware.mc > /etc/mail/sendmail.cf“, and restart inetd and sendmail by running /etc/rc.d/rc.inetd restart && /etc/rc.d/rc.sendmail restart.

Problem solved, and I’m receiving my emails again!

Tagged with: