I have a VPS server at UltraHosting.com 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: support.ultrahosting.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=142

The setting shown there is in my Exim config.

I have also tried configure my sendmail as suggested here http://support.ultrahosting.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=175&nav=0

However I cannot find my sendmail.cg on my centOS server. The command "whereis sendmail.cf" 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?


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 = *  smtp.ultrahosting.com  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.

  • 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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