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

Is there any way to stop a mail server from checking locally when sending an email and have it send via the internet everytime?

An example:

I have a domain name attached to an account on my server to serve website traffic but the client wants to use another hosting company for their emails.

There website has a PHP contact form, using PHPMailer, that needs to send emails to both their email address info@example.com and the visitors email address visitor@live.com

Is there any way to do this without setting up an MX record everytime?

Thanks

share|improve this question
add comment

2 Answers 2

up vote 0 down vote accepted

If the client wants to use company B for mailhost service, then the MX resource records published in the public DNS database must exist, to show the world where company B's SMTP Relay servers actually are. It's that simple. If they don't, then the world looks for A/AAAA resource records, and finds you, company A, which is not what the customer wants.

Once you are in that situation and the MX resource record set exists, there's nothing that you, company A providing the content HTTP service, need do that is special. Your HTTP servers, and the MTA that they talk to, are by default in the same situation as the rest of Internet. They do what everyone else does: They find out that the mail is to be delivered to a remote domain, look up the remote domain's MX resource record set, and push the mail off to the SMTP Relay servers listed therein.

This is really only a problem where you've actually done something to explicitly change this default on your machines — such as, for example, explicitly telling your MTS that the domain in question is a local one. Most MTSes work on the principle that anything not explicitly stated to be local is remote, so you have to explicitly do something to tell an MTS not to treat a domain as remote. (For qmail a domain is remote if it is not explicitly listed in locals or virtualdomains. For Postfix, a domain is remote if it is not explicitly listed as mydestination, a virtual alias, or a virtual mailbox. Other softwares have different mechanisms but the same dichotomy.)

Maybe this is your standard procedure for customers — you tell your MTS that the domain is local at the same time that you tell your content HTTP servers that the domain is associated with a particular "document root" (or whatever) and you tell your content DNS servers that the domain is in their database. If so, the simple answer is don't do that, then. Simply do not do the part that involves modifying your MTS to treat the domain as a locally hosted one.

share|improve this answer
    
Thank you. I have contact my hosting provider as well and they have told me it is not possible either. Thanks for the link to qmail article, this is what we are using on the server. –  James Jun 20 '11 at 8:08
add comment

Depending on the MTA you are using you can set it up to send that domains mail directly to the host accepting the mail for the domain.

For sendmail you use mailertables, for postfix you use transport maps and for exim you create a router for that specific domain

share|improve this answer
    
I think it is a sendmail server but I am unsure sorry. Also I would want to set this up globally, in a set it and forget it manner. I get a number of clients requesting this and don't want to have to set each one up individually if possible. –  James Jun 17 '11 at 10:25
add comment

Your Answer

 
discard

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.