Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Possible Duplicate:
Postfix configuration: different outgoing hosts based on sender

I've got a problem that's driving me mad.

Basically, I run 10 virtualhosts in a CentOS distribution.

From now on, I'll call these virtualhost domains www.example1.com to www.example10.com

In the meanwhile, I've bought an external service, a mailserver, that will hold all the emails "related" to these domains. From now on I'll call these emails admin@example1.com to admin@example10.com. These email addresses are enabled to be used as "users" for the smtp relaying of emails through the mail server.

Obviously, all the MX records of these 10 domains have been configured to pinpoint to the correct external mailserver, so emails sent TO these addresses work as expected.

The problem is due to the fact that these 10 domains generate emails through PHP scripts. So, I need to configure my CentOS distribution to handle OUTGOING ( this is enough, I don't need the server to handle incoming emails as said before ) emails generated through PHP.

I would like to achieve a configuration like this:

1) www.example1.com generates an email through PHP

2) the MTA "understands" the fact I'm sending an email that "is arriving" from www.example1.com

3) the MTA picks up the correct SMTP username/password with which connect to the external smtp relay. ( that will be admin@example1.com - password-of-domain1 )

4) the MTA connects to the external SMTP with the credentials found above, and dispatches the email

I would like to use this external SMTP relay for outgoing emails for a matter of consistency of the system. I would like to let the web server do his job, and the mail server the other job.

Any ideas or hints to reach this type of configuration? Since now I've tried configuring sendmail and postfix to achieve this, but I was unlucky.

P.S: I'm using GoDaddy as external email server.

share|improve this question

marked as duplicate by mailq, Scott Pack, EEAA, Ward, rnxrx Aug 25 '12 at 5:42

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
10 domains - 10 different relays of you'll use one for all? –  Lazy Badger Oct 14 '11 at 16:27
    
One relay for all, with different username/password combination for each "From:" sender –  peter.bishop Oct 18 '11 at 9:18

1 Answer 1

You have not indicated what MTA you are using, But that should be fairly simple to implement with both postfix and exim.

For postfix look at http://www.postfix.org/SASL_README.html#client_sasl_sender

For exim you need to write a lookup to pick up the correct auth details from a data source, e.g file.

share|improve this answer

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