Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 a VPS server at and requires that I use "Smart Relay" when sendning emails. However I cannot send mail using the php mail() function.

Here is an article they have on Smart Relay:

The setting shown there is in my Exim config.

I have also tried configure my sendmail as suggested here

However I cannot find my on my centOS server. The command "whereis" says sendmail: /usr/sbin/sendmail /usr/lib/sendmail

The server is using cpanel and exim

I sent the following support ticket:

How do I configure the server to send mail using php. I am writting a script that will send the users passwsord usigng PHPs mail function. However the emails sent are never delivered. Does this have to do with "smart relay"? Any guide on how to configure this?

Response was:

While we do not provide scripting support of any kind, if you simply

ensure the smart host is hard coded in your script (no authentication is necessary) the email should be forwarded accordingly.

If your script uses the server's SMTP server to send out email, you'll

have to ensure the MTA is configured to use the smart host


Could anyone please clarify what I need to do in order to fix this so I can use PHPs mail function?

share|improve this question
up vote 1 down vote accepted

In the routers section of your exim config, you'll have a router that looks something like this:

    driver = lookuphost
    transport = remote_smtp

This is what tells exim to deliver mail directly. You need to tell it to use the smarthost instead.

Replace the above router with something like this:

   driver = manualroute
   domains= ! +local_domains
   transport = remote_smtp 
   route_list = *  byname
   host_find_failed = defer

Make sure that the transport name in the new router is the same as in the original (remote_smtp in this example).

Also, you'll need to restart exim after making these changes.

share|improve this answer
Thanks, made a fresh config and added code. Now my maillog says: Sender address rejected: need fully-qualified address, when sending to an gmail account. But I suppose thats another issue – John Oct 8 '10 at 1:55

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.