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

    Joined:
    Oct 2, 2013
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hello,

    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:

    PHP:
    mail($to$subject$body$headers$ffrom);
    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:

    Code:
    Event:			success
    User:			this_account_user
    Domain:			this-website-domain.co.uk
    Sender:			this_account_user@cpanel.mydomain.com
    Sent Time:		Sep 23, 2013 2:16:14 PM
    Sender Host:		localhost
    Sender IP:		127.0.0.1
    Authentication:		localuser
    Spam Score: 
    Recipient:		test@my-domain.co.uk
    Delivered To:		my_user@my-domain.co.uk
    Delivery User:		my_user
    Delivery Domain:	my-domain.co.uk
    Router:			localuser
    Transport:		local_delivery
    Out Time:		Sep 23, 2013 2:16:14 PM
    ID:			1VO600-00022G-O4
    Delivery Host:		localhost
    Delivery IP:		127.0.0.1
    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 (my_user@my-domain.co.uk).

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

    Code:
    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 <= this_account_user@cpanel.my-domain.com U=this_account_user P=local S=658 T="Brochure Request" for testemail@any-old-domain.co.uk
    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 <testemail@any-old-domain.co.uk> 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.
    Thanks
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    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.
     
Loading...

Share This Page