Forum Moderators: bakedjake
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?
Thanks
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.
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:
#!/usr/bin/php
<?php
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...
For the PHP you might need to change your SMTP settings in your php.ini configuration file for it to work correctly.
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.