Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an Ubuntu VPS/slice at Slicehost. Right now I use Exim (Exim4) as my mechanism to send email. I don't receive email on my slice; I only send email (for example, if someone leaves a comment on my blog, an email is sent to me telling me so).

I have a /etc/exim4/passwd.client file that has my credential information for sending the email, of the form:

### target.mail.server.example:login:password

Does anyone know a way how I can have multiple target mail servers depending on the website/domain visited? For example, I have one target mail server for when someone leaves a comment on my blog and another when sending out an order confirmation to someone.

Thank you!

share|improve this question
The question is a little unclear. I think you're being confused by the passwd.client file. Can you make your question a little more concrete? – David Pashley Jun 7 '09 at 23:02
David, I am by no means a mail expert. Basically I used the following as a guide to my setup: So there is a .conf that lists the initial setup parameters, but what email address mail is sent from is configured, as far as I understand it, from the passwd.client file. I am looking to see if there is a sort of "if/then" capability to direct what email address is used to send email. – Joel Marcey Jun 8 '09 at 0:22
Still unclear. Forget about exim and the passwd file for now. Depending on if the message is from your blog or a customer order... Do you want to have a different FROM address? Or do you want to send the email through a different gmail account? – Steven Jun 8 '09 at 1:02
My reading of Joel's comment is that he wants different From addresses. I believe the exim4 part due to Google requiring authenticated SMTP if you are going to use them as a smarthost. I don't know if Google check the From header against the authenticated user. – David Pashley Jun 8 '09 at 1:41
That's correct. I want a different FROM address. So for my blog, I want it to come from, but for orders (and I just use this as an example since i have no orders yet :-) ), I want I am sorry for the lack of clarity. – Joel Marcey Jun 8 '09 at 1:46

The From address isn't controlled by exim. The software submitting the message, blog or ecommerce site, has to set it.

As David said, I'm not sure if Google checks the from header, so you may have to add both from address into google first (settings -> account -> add email)

share|improve this answer
Damn. I misstated in my comments above. I want to send the email through a different Gmail account, which, of course, would imply a different FROM address. I did some testing -- in the passwd.client file, I put in one set of credentials for and the FROM address was, of course, Then I commented that out and put in another set of credentials for, and the FROM address was, as expected. What I want is to be able to have both as an option. – Joel Marcey Jun 8 '09 at 2:22
Of course I could be misunderstanding the way exim works, but from what I have found the passwd.client file does have an affect on the FROM address depending on the credentials you give it. – Joel Marcey Jun 8 '09 at 2:22
passwd.client has no affect on the from address, Gmail must be rewriting the FROM address. You could create two exim routers, one to send email through exim transport A (which then uses Gmail account A) and a router to use exim transport B (which then uses Gmail account B). However I can't think of how to make the different exim routers differentiate between the two types of messages you're generating. If the blog/ecommerce site have different from address (before the gmail rewrite) that could work. Or if they add special headers... – Steven Jun 8 '09 at 3:56
Why do you want to send through google in the first place? Configure your blog and ecommerce sites to use proper from addresses, then send email directly - not through google first. – Steven Jun 8 '09 at 3:57
Thanks for the insight Steven. I am coming around now. So basically, while the username I give in passwd.client (which for gmail is an email address), the FROM address being the same is just coincidence and I could change that within the Gmail settings for that account if I want to. I need to think about this some more regarding the best way to accomplish what I want to do. Maybe I move away from Exim. One thing I do know is that I don't want my server to be an email server. I use Gmail / Google Apps for that very reason....I want to offload email handling to them..... – Joel Marcey Jun 8 '09 at 5:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.