Quantcast
Channel: Hack Admin » relay
Viewing all articles
Browse latest Browse all 2

How To Make Sendmail Relay Everything

$
0
0

I knew I had done this before, but all the explanations I found today were amazingly long and convoluted, which is not what I remembered from the first go around.

Basically, I wanted sendmail to take all inbound email and immediately relay it to another host. In my situation it makes sense because my servers have no direct access to the outside world (security thing). But in reality with the complexities involved in sending email these days, why bother setting up every host or every NAT to be capable of dependably delivering email.

So the solution is, setup one host that you know is a good mail host, and one host that you can monitor for throughput, then point all your other hosts at it for delivery. Piece of cake right? Odd that it took me 30 minutes and then a final trip to the sendmail documentation to find it.

In the end we’re talking about 1 line in your sendmail.mc (I’ve consistently found that most of life’s problems can be solved with 5 to 50 characters in the right text file).

At any rate, the directive you are looking for is:

define(`SMART_HOST', `smart.host.com')dnl

Just replace “smart.host.com” with the smtp server you intend to use as the relay.

For those of you who don’t use the sendmail.mc, you need to modify the DS variable in your sendmail.cf (but really, find something better to do with your time than edit that file).

For all you sendmail.mc users, once that line is in place, run a “make” in your /etc/mail directory and then restart sendmail.

Actually, I was using this mess of a line to test:

touch /tmp/mail.txt; /etc/init.d/sendmail restart ; mail -s "Test2" me@myemail.com < /tmp/mail.txt ; tail -f /var/log/maillog

You’ll come up in a tail of maillog and you should watch for the relay host accepting your message. If it doesn’t get delivered, it’s time to look at the relay server.

That is all, have fun!


Viewing all articles
Browse latest Browse all 2

Trending Articles