Using SMTP and SASL with Postfix when your ISP won't relay

 by technosapien
Good day!

I recently spent several hours poring over configuration files and telnet sessions, trying to figure out why I couldn't send email from my linux machine any more.

For years I have used the postfix mailer to handle sending email out to the world, and enjoyed using dinosaurish text-based e-mail clients like pine and mutt, or web-based SquirrelMail. Email I write is dropped into the mail queue, and then postfix relays it to my ISP's mailserver and from there, to the world.

Well recently I changed ISPs, and I received errors from my ISP's mailserver: relay not available.
Turns out, my ISP requires authentication in order to relay mail through it - a reasonable yet annoying requirement. This is what I had to do to get it to work. Read on....

Caveat: this tutorial assumes you have a working postfix installation, and just need to add SASL authentication so that you can use your new ISP's mailserver as a relay when you didn't have to auth to a relay before.

Caveat 2: If your ISP does not want you to do this, then don't. I am not liable! I actually contacted my ISP and told them what I was doing, they didn't mind as long as I authed properly.
 
Remove these adsRemove these ads by Signing Up

Step 1: Determine AUTH method

Before starting, you might as well check what AUTH method your mailserver understands. Luckily, this is very easy to do with telnet (actual hostnames are masked for security).

At your shell prompt, type:

$ telnet mail.yourmailserver.com 25

This will establish a connection to your mailserver. You'll see something like this:
Trying [ip address of mail server]...Connected to mail.yourmailserver.com.Escape character is '^]'.220 YourMailServer SMTP Server Ready

The mailserver is waiting for you to send a command. Type
EHLO
and hit enter. You should see something like this:

250-SIZE 0250-AUTH LOGIN250-AUTH=LOGIN250 8BITMIME

What you're interested in is the AUTH line. My mailserver tells me it does authorization via LOGIN. You may also see PLAIN here, or potentially things like TLS or SSL. If you can use TLS or SSL, you should. The postfix website has good info on using TLS to secure your mail transactions, or google can help you with that as well.
cpotoso says: Aug 8, 2007. 9:32 PM
Thank you, this is a very useful tutorial. I will use it!
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!