Welcome to WebmasterWorld Guest from

Forum Moderators: bakedjake

Message Too Old, No Replies

How to setup Exim with multiple remote Gmail servers?

Want to configure exim to use multiple Gmail servers remotely.

1:44 pm on Jun 30, 2008 (gmt 0)

New User

5+ Year Member

joined:Feb 12, 2008
posts: 13
votes: 0

I have a server running Apache 2.2, PHP 5, and MySQL 5.0. There are three
vhosts on it at the moment and more envisioned in the future. We are a
start-up company and have not yet gone 'live' (our sites are currently
using restricted access).

The server uses Debian Etch.

It is time to add email services. I have been looking around and am not
finding the information for the setup that we want. I am sure that the
information is out there, I am either looking in the wrong place or am
searching for the wrong key words. I have read through the Exim docs.
If the information is in them, I did not recognize it.

We have an email account with Google. I have set up the MX record on our
DNA server as specified by Google; mail.demo.com points to the Google
server. We have set up accounts and can send/receive emails. Pinging
mail.demo.com gets returns from the Google server, as it should.

Exim4 is installed on the website server with whatever the default install
configuration is. The website server is not hosted on Google.

What we wish to do is allow the website for demo.com to send email via the
mail.demo.com sever. The demo.com email sender will be different users
such as customer.service@demo.com, john.doe@demo.com, etc. The demo.com
users will not check email on the demo.com server, we do not want to store
email on the demo.com server, and mail.demo.com users will only consist
of demo.com departments and employees.

This setup we want to use for all website domains served. For example,
demo.com, anotherdemo.com, and thirddemo.com. Each domain will be setup
with its own Google account.

PHP has the mail function that we wish to use. We do not plan mass emails
with PHP.

I have found several examples of how to set up Exim for use with a single
user account on gmail. I do not think that is what I want.

Again, I believe this must be a common problem that has been solved many
times. Would someone point me to web resources for doing this using Exim?


5:17 am on July 2, 2008 (gmt 0)

Senior Member

joined:Nov 12, 2005
votes: 0

Here's the documentation that might help: [exim.org...]

As for the rest, you can look at some of the user comments at php.net for the Mail Functions [us2.php.net] as they might provide some additional insight.

11:50 am on July 2, 2008 (gmt 0)

New User

5+ Year Member

joined:Feb 12, 2008
posts: 13
votes: 0

Thanks for the reply.

I looked at the Exim docs, but I just did not 'get it'. This is my first foray into email servers. I have been working with Linux since kernel 0.94 and have had exposure to just about everything else. Most of my work has been with embedded systems.

Anyway, I ran across this: http://www.debianhelp.co.uk/postfix.htm

It mentioned a satellite setup in Postfix that sounded like what I needed. So, I uninstalled Exim4 and installed Postfix. During the configuration I chose the satellite option and entered the Gmail domain (mail.mydomain.org) at the prompt for mydestination.

Then I built and ran this command line script:
mail("jdmelton@onedomain.com", "test - mailserver", "This is a test of mydomain.org command-line email from myserver via Gmail.\nPlease do not reply.", "From: me@mydomain.org"."\n"."Reply-To: me@mydomain.org"[smilestopper]);

And it worked. The were some issues with the From: and Reply-To: fields. At first I just used the from user name. For Gmail, I needed to use the user@mydomain.org form.

So, using Postfix instead of Exim, I have solved part of the problem. The command line email works, but not from Apache/PHP. I am looking into that...

3:23 pm on July 2, 2008 (gmt 0)

Senior Member

joined:Nov 12, 2005
votes: 0

Nice work :)

For the PHP you might need to change your SMTP settings in your php.ini configuration file for it to work correctly.

3:54 pm on July 2, 2008 (gmt 0)

New User

5+ Year Member

joined:Feb 12, 2008
posts: 13
votes: 0

More progress.

I tried sending from my web site and got local bounces because the user was not found. After some reading, I found several confusing answers. However, my web server never needs to receive email that is not locally generated, so I tried a couple of things. (None of the web user email recipients have local system accounts.)

First, I tried relayhost = mail.mydomain.org, but this broke the command line script and still did not deliver from the web server. The command line script resulted in connection timeouts. So I took this change back out.

Next, I tried changing the mydestination.
#mydestination = mydomain.org, localhost, localhost.localdomain, localhost <- original after satellite install
mydestination = localhost.localdomain, localhost

This did not break the command line script which I need to run a variant of.
It also sent the email from my website form.

Remember to run 'postfix reload' after changes.

So, I have made more progress. I have one domain working with Gmail at the moment. Next up is to figure out multiple domains from the same postfix on the web server.

eelixduppy - Since the command line php script worked, I made sure that the /etc/php5/apache2/php.ini had the same settings as /etc/php5/cli/php.ini for sendmail_path and mail.force_extra_parameters. Interestingly enough, both are commented out. Hmm...looking into that one as well.


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members