Tag Archives: smtp

Configure Postfix for Multiple ISP Client SMTP Authentication

Some time ago I blogged about configuring Postfix to relay outgoing email through your gmail account. One of the commenters left a question asking how to achieve the same result, but use unique relays for each account attempting to send email. I’ve only just now been able to find time to write up an answer and find a good solution. This post will outline how to configure specific users of your mail server to relay through unique providers for outgoing email. For example:

user1@server1.com must relay through smtp.isp1.com
user2@server2.com must relay through mail.isp2.org
user3@server3.com must relay through mx.isp3.net
all others must relay through the default, smtp.hugecorp.biz

note: This is only supported on Postfix version v2.3+ and later. If you are using a recent version of Ubuntu or Debian you should be fine. To find out your current installed version you can run:

dpkg -l postfix

Step 1

Open your main.cf file:

vim /etc/postfix/main.cf

Add these lines to the configuration:

smtp_sender_dependent_authentication = yes
sender_dependent_relayhost_maps = hash:/etc/postfix/relayhost_map
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/passwd
relayhost = [smtp.hugecorp.biz]:submission

Step 2

Create /etc/postfix/relayhost_map file:

vim /etc/postfix/relayhost_map

Append entries for each unique sender => isp relay mapping you need. (note: our default relay, smtp.hugecorp.biz, is not included here):

# Per-sender provider
user1@server1.com [smtp.isp1.com]
user2@server2.com [mail.isp2.org]
user3@server3.com [mx.isp3.net]

Step 3

Update the /etc/postfix/passwd file with the user authentication information:

# Per-sender authentication
user1@server1.com user1@server1.com:SecretP@ssw0rd1
user1@server2.com user2@server2.com:SecretP@ssw0rd2
user1@server3.com user2@server3.com:SecretP@ssw0rd3
# Login for the default relayhost
[smtp.hugecorp.biz] defaultUsername:defaultPassword

Step 4
Hash the config files. Restart Postfix:

postmap hash:/etc/postfix/passwd
postmap hash:/etc/postfix/relayhost_map
/etc/init.d/postfix reload

Following these instructions you should be able to configure each of your users, or a specific subset of users, to relay their outgoing email through specific ISPs or even specific gmail accounts.  If my previous post is too limited for you–you don’t want everything authenticating and relaying through a single gmail account–these instructions should give you more flexibility.

Source: nixCraft

How To Manager Multiple Outbound Addresses In Evolution

I was just setting up Evolution again and went through the steps of setting up my personal account and my Ubuntu account.  I’ve heard some people run into problems doing this considering the Ubuntu account, on the incoming side, is bound to your default address in Launchpad, but you still need to send mail out.  Here is how I did it.

note: as you’ve likely noticed I don’t do a lot of screen shots on this blog primarily because I can’t ever get the formatting to look the way I’d like.  As you see below some of the text is not properly displaying under each picture, but tries to display to the right.  I’ve been fighting it for hours.  I finally decided to just post as-is.  If you have any suggestions on WP formatting with graphics let me know.

Creating an Outbound-Only Account in Evolution

  1. To create a secondary account to be used for sending mail (one that does not require receiving), we’ll need to open the Preferences Window, which is found in Edit > Preferences.
  2. Click “Add”, which will open the Account Assistant for creating new email account settings.  Click “Forward” on the first introductory window.
  3. Fill out the Identity information, ie; Full Name and your outbound email address.  In this case I am using my ubuntu.com address.  Click “Forward”.
  4. On the “Recieving Email” step we will set the Server Type to “None”, and click “Forward”.
  5. On the “Sending Email” step we will populate your SMTP settings.  In my case I am using my gmail account as the outbound SMTP server.  Click “Forward”.
  6. On the “Account Management” step we will give this account a unique name.  In this case “Ubuntu”.
  7. Click “Forward” and then “Apply” and you should be finished.

You can then repeat these steps for the total number of accounts that you need send-access with while the reply-to still goes elsewhere.  I’ve been using this setup for my Ubuntu account for a few years now and its simple enough, and quick to setup.

The steps are slightly different if you’re using Thunderbird.  Maybe I can get that installed here soon and walk through those steps as well.  Enjoy.