Own postfix smtp server as relay for Google Apps Premier Edition

Posted on 2009-02-11
Medium Priority
Last Modified: 2013-11-10
Hi, I have a domain set for use with Google Apps and, apart from my main email address, I also use with gmail another email address with different domain.
Using the "send email as" feature as it is, if the person who receives my email uses Outlook, (s)he can see my original email address which instead I don't want to be shown.
Similarly, my original address is clearly visible in the headers.
Following some research, I have found that by upgrading to Premier Edition (which I have done already), I could tell Google Apps to use my own STMP server.
This should remove the sender header and therefore my original email address should remain hidden.
I have a VPS with Slicehost, with Ubuntu 8.04, and postfix is just installed but not yet configured.
How shall I proceed in order to use this postfix server as relay for my Google Apps accounts?
I don't really have much experience specifically with these things, but I can easily understand and follow instructions, so I would appreciate if somebody could illustrate the process in steps.
Many thanks in advance.
Question by:Sisupoika
  • 2
LVL 19

Assisted Solution

by:Gabriel Orozco
Gabriel Orozco earned 400 total points
ID: 23624940
I would say this is the easier and simplest howto for postfix in ubuntu 8.04:


If you setup smtp-auth in your google apps, then this setup should be secure enough to be used in production.

there are other much more complete setups that you can use, but I see them as unnecessary:


Accepted Solution

Sisupoika earned 0 total points
ID: 23628899
Well... as said I had postfix already installed and the reason I asked a "step-by-step" help is that I couldn't find a clear answer to my question by googling...

By the way, I have found now after further googling the fewest steps required to use a postfix server as relay for Google Apps, AND strip the "sender" header which causes Outlook to show "address 1 on behalf of address 2".

Here is what I found and did, and that's working, in case somebody else has the same problem.

Assumed that you have already
- upgraded Google Apps to the Premier Edition
- set the outbound gateway with the ip/hostname of the postfix server
- opened the port 25

All you need to do additionally is
- download dig (http://members.shaw.ca/nicholas.fong/dig/)
- type the command "dig txt _spf.google.com > google.txt" from the command prompt, to obtain the IP addresses used by google mail
- create the folder /etc/postfix/maps if it does't exist already
- edit /etc/postfix/main.cf, and add to the setting "mynetworks" Google's IPs
- still in main.cf, add the line "header_checks = regexp:/etc/postfix/maps/header_checks"
- edit the file /etc/postfix/maps/header_checks, and add the line "/^Sender:/ IGNORE"

That's it.
Now emails should be sent by Google Apps through your relay and the "sender" header removed => Outlook should no longer show the " ... on behalf of..." thing.
For the same reasons about privacy, you might also want to strip/replace other headers such as "received" and "return-path".

Hope this helps others who might want to achieve the same.

(for reference: http://www.posluns.com/guides/hedrem.html)

Expert Comment

ID: 24806311
The only thing I question about the solution is... what do you do when Google adds more IP's?  There's gotta be a way to allow based on DNS rather than IP, I would think...

Author Comment

ID: 24813573
Good question.... I have no idea of those DNS. So far it is still working :D

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Local Continuous Replication is a cost effective and quick way of backing up Exchange server data. The following article describes the steps required to configure Local Continuous Replication. Also, the article tells you how to restore from a backup…
As cyber crime continues to grow in both numbers and sophistication, a troubling trend of optimization has emerged over the last year.
In this video we show how to create a User Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Mailb…
In this video we show how to create an email address policy in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Mail Flow…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question