How to configure sendmail to use different SMTP relay servers.

For example: For all gmail.com recipients sendmail should use gmail SMTP server obviously with Gmail smtp auth. For all yahoo.com recipients it should use yahoo.com SMTP with yahoo.com username and password. And for rest of the recipients it should use my dedicated SMTP server.

closed as off-topic by TomTom, Sven, MadHatter supports Monica, ceejayoz, Ward - Reinstate Monica Dec 7 '13 at 17:35

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must demonstrate a minimal understanding of the problem being solved. Try including attempted solutions, why they didn't work, and the expected results. See How can I ask better questions on Server Fault? for further guidance." – TomTom, Sven, MadHatter supports Monica, ceejayoz, Ward - Reinstate Monica
If this question can be reworded to fit the rules in the help center, please edit the question.


Why would you want to do that this way?

  • It's not going to work. At least GMail rewrites all mail it receives via an authenticated connection to the mail address connected with this account, so a mail from user@example.com would be rewritten to come from yourgmail@gmail.com. Try to explain to your users why all mail they send to GMail appears to come from you to the recipients.
  • It's not necessary. If your mail server is setup correctly, Gmail etc. will deliver your mail anyway, otherwise everyone sending a mail to a GMail user would be forced to have a Google account as well.
  • Doing this the reverse way sometimes makes sense, and I have such a setup with a private server. It acts as a normal SMTP server/gateway, but when I use it as a relay, it will deliver mails with authenticated SMTP according to the sender address, so a message from my gmail address would be relayed via authenticated gmail SMTP etc. This is a very special case and doesn't scale into a real production system.

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