Configrue Exim Sendmail for relay

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?


Solution 1:

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

 lookuphost:
    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:

 smarthost:
   driver = manualroute
   domains= ! +local_domains
   transport = remote_smtp 
   route_list = *  smtp.ultrahosting.com  byname
   host_find_failed = defer
   no_more

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.