Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP sendmail - emails never leave the server

Discussion in 'E-mail Discussions' started by yellowbelly, Oct 2, 2013.

  1. yellowbelly

    yellowbelly Registered

    Oct 2, 2013
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator

    I am transferring some websites to a new VPS running WHM/cPanel on CentOS (previously used Plesk).

    One of my clients has a website hosted on my VPS, and their email hosted elsewhere.

    On this website I am trying to send emails using a PHP script i.e:

    This worked on the old server. However emails are not leaving the server.

    When I look within WHM at Home » Email » Mail Delivery Reports the emails are shown as accepted. When I look at the Delivery Event Details for the email it shows the following:

    Event:			success
    User:			this_account_user
    Sent Time:		Sep 23, 2013 2:16:14 PM
    Sender Host:		localhost
    Sender IP:
    Authentication:		localuser
    Spam Score: 
    Delivered To:
    Delivery User:		my_user
    Delivery Domain:
    Router:			localuser
    Transport:		local_delivery
    Out Time:		Sep 23, 2013 2:16:14 PM
    ID:			1VO600-00022G-O4
    Delivery Host:		localhost
    Delivery IP:
    Size:			698 bytes
    Result:			Message accepted
    As you can see the 'Recipient' and 'Delivered To' addresses are different and not what I want. It looks like whatever I try to do these emails are actually being sent to the root user (

    This is the corresponding entry in the /var/log/exim_mainlog

    2013-09-23 13:29:28 cwd=/home/this_account_user/public_html 3 args: /usr/sbin/sendmail -t -i
    2013-09-23 13:29:28 1VO5Ga-0001np-RN <= U=this_account_user P=local S=658 T="Brochure Request" for
    2013-09-23 13:29:28 cwd=/var/spool/exim 3 args: /usr/sbin/exim -Mc 1VO5Ga-0001np-RN
    2013-09-23 13:29:29 1VO5Ga-0001np-RN => my_user <> R=localuser T=local_delivery
    2013-09-23 13:29:29 1VO5Ga-0001np-RN Completed
    I have several questions:
    1) Where does the 'Delivered To' address actually come from? Because the address that is used is not provided by me as far as I am aware.
    2) Even when the 'Delivered To' address is a valid email address and everything looks OK in the exim log, it still doesnt get delivered even though it shows as success/completed.

    Any help with this is much appreciated.
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Apr 11, 2011
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator
    Hello :)

    Please browse to:

    "WHM Home » DNS Functions » Edit DNS Zone"

    Select the domain name, and click on "Edit". Scroll down to the "Email Routing" section and ensure it's configured to:

    "Remote Mail Exchanger"

    This will ensure email is routed to the remote mail server where the email accounts are hosted at.

    Thank you.

Share This Page