January 10th 2012

Prevent Google Apps Mail Service from Rewriting the Sender Address

I recently set up the mail service for my new smartcode domain using Google Apps. Subscription and setup of the Google Apps account with some mail addresses is a simple and straightforward process.

However, when I sent mails from my server (using sSMTP) with sender addresses like blog@smartcode.ch or wiki@smartcode.ch, they all arrived in my inbox with the sender address set in the ssmtp.conf file.

Read on for instructions to configure Google Apps mail service to allow some kind of alias addresses for a mail address.

First of all, login to the Google Apps administration site and create a new user, which servers as the mail account for all the aliases you create afterwards. I named mine mailer@smartcode.ch.

Google Apps create user

Next, log in to google mail with your newly created account, and open the Mail settings. Select the Accounts tab, and click the Add another email address you own link. Enter your desired mail address in the Pop-Up, go on to the Next Step and click the Send Verification button.

The verification mail is sent to your administrative account of your Google Apps account. Spot the verification code and verify the account.

If you want to make the mail alias a no-reply address, change to the Filters tab in the mail settings view, and Create a new filter.

 

Insert the mail alias address in the To: field and click Next Step. Select the Delete it action and create the filter.

 

This is all there is for the Google Apps / Mail configuration.

On the server side, configure sSMTP for your mailer account. My ssmtp.conf file looks as follow:

#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=
 
# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtp.gmail.com:587
 
# Where will the mail seem to come from?
rewriteDomain=
 
# The full hostname
hostname=smartcode.ch
 
UseTLS=Yes
UseSTARTTLS=YES
 
AuthUser=mailer@smartcode.ch
AuthPass=**********
 
# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=YES

With this setup I can configure my services (e.g. DokuWiki) running on the server to send mails from any desired mail address using Google Apps.

Leave a Reply

 (required)
 (required)