• GoDaddy Community
  • Websites + Marketing | Website Builders
  • Websites + Marketing | Website Builders

    cancel
    Showing results for 
    Show  only  | Search instead for 
    Did you mean: 
    New

    PHP mailer (contact form) will not send mail outside my cPanel domain

    Have a very simple contact form with a standard php script. I can show it to you but basically the problem is as follows. On my domain we have a Linux hosting plan for the website and use Office 365 for our email. So the mail server for our website is pointing to office365, not the local Linux mail server.

     

    My default email on the linux box is "myname@a2plcpnl0625.prod.iad2.secureserver.net", where I have changed my login to "myname" in the example . I can send email to this address and access webmail via my cPanel control panel. If I put any other email address as the "$to" in my php script, no email is ever delivered. If I change the "$to" to the address above, it works.

     

    For example, in the php script,  if I have the following:

     

    $to = "myname@comcast.net,myname@a2plcpnl0625.prod.iad2.secureserver.net";

    or:

    $to = "myname@comcast.net";

    or:

    $to = "myname@spotlighttherapy.com";  <--  my domain 

    or:

    $to = "myname@a2plcpnl0625.prod.iad2.secureserver.net";

     

    email is *never* delivered to "myname@comcast.net" or "myname@spotlighttherapy.com" but it is *always* delivered to "myname@a2plcpnl0625.prod.iad2.secureserver.net"

     

    The relevant line is the ph script is:

    $suc = @mail($to,$subject,$message,$headers);

     

    I REALLY need help with this. Customers are filling in my contact form but I am missing their inquiries. Not good.

     

    Help would be very much appreciated

    8 REPLIES 8
    Anonymous
    Not applicable

    Re: PHP mailer (contact form) will not send mail outside my cPanel domain


    @Micmb wrote:

    Have a very simple contact form with a standard php script. I can show it to you but basically the problem is as follows. On my domain we have a Linux hosting plan for the website and use Office 365 for our email. So the mail server for our website is pointing to office365, not the local Linux mail server.

     

    My default email on the linux box is "myname@a2plcpnl0625.prod.iad2.secureserver.net", where I have changed my login to "myname" in the example . I can send email to this address and access webmail via my cPanel control panel. If I put any other email address as the "$to" in my php script, no email is ever delivered. If I change the "$to" to the address above, it works.

     

    For example, in the php script,  if I have the following:

     

    $to = "myname@comcast.net,myname@a2plcpnl0625.prod.iad2.secureserver.net, ";

    $to .= "myname@comcast.net, ";

    $to .= "myname@spotlighttherapy.com, ";  

    $to .= "myname@a2plcpnl0625.prod.iad2.secureserver.net ";

     

    email is *never* delivered to "myname@comcast.net" or "myname@spotlighttherapy.com" but it is *always* delivered to "myname@a2plcpnl0625.prod.iad2.secureserver.net"

     

    The relevant line is the ph script is:

    @$suc = @mail($to,$subject,$message,$headers);

     

    I REALLY need help with this. Customers are filling in my contact form but I am missing their inquiries. Not good.

     

    Help would be very much appreciated


    Try my alteration above, see what I have done. The '.=' concatenates.

    New

    Re: PHP mailer (contact form) will not send mail outside my cPanel domain

    Hi and thanks for your reply.

     

    I don't understand the suggested fix? What I am looking for ultimately is for the script / server configuration to deliver mail to "me@spotlighttherapy.com".  I don't want email delivered to "myname@a2plcpnl0625.prod.iad2.secureserver.net". 

     

    the multiple "or:" in my OP above were meant to show the various email address that I have tried. Not an 'or' in a PHP script

    Anonymous
    Not applicable

    Re: PHP mailer (contact form) will not send mail outside my cPanel domain

    Hi @Micmb,

    it helps when giving examples of code to show where you have made notes or such................

    It helps if you can clearly state your problem / issue too!

    I wish you luck getting someone to write your code for free.............................. 

    New

    Re: PHP mailer (contact form) will not send mail outside my cPanel domain

    Hello, I apologize, but I don't understand the reply. I am not trying to get someone to write code for free. I assume the php script works ok since it does deliver mail depending upon which email address is used.

     

    My assumption is, and maybe I'm wrong is that there is a configuration problem with how mail is being sent from my server. In my example, only the address, "myname@a2plcpnl0625.prod.iad2.secureserver.net" works in the script. Any other email address that I use that is outside of domain, "a2plcpnl0625.prod.iad2.secureserver.net" which I guess is localhost does not work in the script. For example, setting the email to "myname@comcast.net" does not work, and email is never delivered.

     

    This is the entire script showing the various email's that I've tried in the comments.

     

    In the script, 

     

    $to = "myname@comcast.net,myname@a2plcpnl0625.prod.iad2.secureserver.net";

     

    email is only delivered to "myname@@a2plcpnl0625.prod.iad2.secureserver.net" which I can see by accessing webmail from my cPanel control panel, email is *not* delivered to "myname@comcast.net".

     

    I hope that makes things clearer. I've been trying to post the script but I keep getting an error from the forum

    Anonymous
    Not applicable

    Re: PHP mailer (contact form) will not send mail outside my cPanel domain

    Hi @Micmb,

    sorry but your issue is as clear as mud to me. I don't wish to sound offensive and I have been coding my own forms sending the data by php mail for years. I never have any problems except if I make a syntax error occasionally. Usually easily fixed.

    You can seek more enlightenment on the official php.net website about the mail function.

     

    Sorry!

    New

    Re: PHP mailer (contact form) will not send mail outside my cPanel domain

    Ok, well I apologize that I wasn't able to adequately explain the situation. In my OP I stated that the php script worked fine, but only when an email addressed to an account that resides on localhost worked, whereas email sent to domains outside of the local server never got delivered. I have a mixed environment, a website hosted on a Linux server but since we use Office365 for email the mail server for my domain is over at Microsoft.

     

    The solution was to go into the MX Entry in cPanel and change the email routing from "Local Mail Exchanger" to "Remote Mail Exchanger" and then add an MX record for outlook.com. 

     

    No php changes needed

    New

    Re: PHP mailer (contact form) will not send mail outside my cPanel domain

    // But their documentation CLEARLY states that the Local Mail Server of theirs is supposed to handle this without issue. So we're supposed to setup a crazy loop de loop to get this resolved ?   This is, pardon me, but it's asinine. Godaddy needs to do better.
    -------------
    Anyhow..
    Your problem makes sense, sadly the GoDaddy community is rather slim on talent and skill..heck even the GoDaddy company is not doing so well seeing this issue of yours is the same issue as thousands of others...and there's various supposed fixes that are to work for the varying server age and types they've offered, but non work..and their documentation is lacking. AKA: you're not going crazy or anything.
    -- The most odd thing is most blame an issue from 2016 that was a security fix, but I laugh because my website email form worked  until October 2018.
    It's almost as if they're trying to break stuff so we'll pay for something. Why else would something suddenly stop working and various forms of the same concept all fail ?
    ...SIGH...
    I've read 50+ pages on this subject and no one acts like a mature person when they reply..so I apologize if I sound a bit harsh right now. I'm rather frustrated and I dislike having to call goDaddy support staff as I find they shuffle me around until I get lucky enough to find a support person that understands half of what I elucidate.  Heck, half of them become confused at basic web server specifications and standards....
    SIGH..
    I will be moving away from GoDaddy, as this has become all too painful to deal with..
    **I mean; We're losing business because Godaddy is failing to handle webserver standards and this has been a problem for alot of people for many years now  !!** It's peculiar beyond measure.
    ..
    Micmb..I suggest you move to another server host like  I will be doing asap.

    New

    Re: PHP mailer (contact form) will not send mail outside my cPanel domain

    Sorry you are having such a problem with your script, but my issue was resolved over a year ago and continues to work well. In fact I found an example script from Godaddy files in my web account and used the syntax from that. Everything's fine now