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!

Email PHP form

Discussion in 'E-mail Discussion' started by nsz, Nov 30, 2006.

  1. nsz

    nsz Well-Known Member

    Joined:
    Apr 28, 2004
    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    156
    I just moved to a new server with Cpanel, I had a php form that e-mails from the server but now it does not. Any idea what has changed that would send out blank emails?

    Thanks,

    If it helps here is the script


     
  2. nickp666

    nickp666 Well-Known Member

    Joined:
    Jan 28, 2005
    Messages:
    769
    Likes Received:
    2
    Trophy Points:
    168
    Location:
    /dev/null
    looks as if register_globals is off on the new server, move the message variable and mail command below the $_POST definitions and it will work.

    You will also want to properly clean the strings before emailing them, as the above code is vulnerable to spammers
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #2 nickp666, Dec 1, 2006
    Last edited: Dec 1, 2006
  3. nsz

    nsz Well-Known Member

    Joined:
    Apr 28, 2004
    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    156
    That worked! Thanks so much.
     
  4. ullalla

    ullalla Well-Known Member

    Joined:
    Jan 20, 2006
    Messages:
    192
    Likes Received:
    0
    Trophy Points:
    166
    Mine script is as then whats wrong with it : I am facing the same issue


    <?php
    $to = "frreehost@gmail.com";
    $fromname = "test@mydomian.com";
    $subject = "Testing EMail";
    $mailheaders ="From: test <test@mydomain.com> \n";
    $msg = "This is a test message from Sushil.\n";
    mail($to, $subject, $msg, $mailheaders);
    echo "Done!";
    ?>
     
  5. nickp666

    nickp666 Well-Known Member

    Joined:
    Jan 28, 2005
    Messages:
    769
    Likes Received:
    2
    Trophy Points:
    168
    Location:
    /dev/null
    that code should work fine, if your server isnt running phpsuexec please check that you dont have 'prevent user nobody from sending email' option in WHM > tweak settings enabled

    EDIT: in fact, have you actually checked the exim log to ensure the mail was delivered? could be in your gmail junk folder or you could even be blacklisted by gmail, change the address to another domain and see if it arrives
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #5 nickp666, Dec 18, 2006
    Last edited: Dec 18, 2006
  6. nickp666

    nickp666 Well-Known Member

    Joined:
    Jan 28, 2005
    Messages:
    769
    Likes Received:
    2
    Trophy Points:
    168
    Location:
    /dev/null
    Did you check that? do you have any software that may be limiting outgoing sending to certain binaries only (CSF has this option as do a couple of other things), Do you have the 'SMTP Tweak' option enabled in WHM?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. ullalla

    ullalla Well-Known Member

    Joined:
    Jan 20, 2006
    Messages:
    192
    Likes Received:
    0
    Trophy Points:
    166
    Hello Nick,

    Thanks for your quick attention on this but I have tried this for yahoo too. And when I sent a test mail from this domain to yahoo and gmail therough webmail then it goes fine.

    Please let me know if you have any info abt this.

    Thanks.
     
  8. ullalla

    ullalla Well-Known Member

    Joined:
    Jan 20, 2006
    Messages:
    192
    Likes Received:
    0
    Trophy Points:
    166
    but when I used the email account which is on the same domain then it works . only problem for gmail and yahoo :(
     
  9. nickp666

    nickp666 Well-Known Member

    Joined:
    Jan 28, 2005
    Messages:
    769
    Likes Received:
    2
    Trophy Points:
    168
    Location:
    /dev/null
    See reply above, yet again posted in the wrong order!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. nickp666

    nickp666 Well-Known Member

    Joined:
    Jan 28, 2005
    Messages:
    769
    Likes Received:
    2
    Trophy Points:
    168
    Location:
    /dev/null
    You are indeed correct with regard to the formmailer located in /cgi-sys/ but this is a custom php script that isnt sending.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. SageBrian

    SageBrian Well-Known Member

    Joined:
    Jun 1, 2002
    Messages:
    416
    Likes Received:
    2
    Trophy Points:
    318
    Location:
    NY/CT (US)
    cPanel Access Level:
    Root Administrator
    the formmail script may only allow mail to be sent to an account on your domain.

    If you need it to go to a yahoo or gmail account (or anywhere off the server), setup a forward for an email like form@domain.com to go to the gmail
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. mctDarren

    mctDarren Well-Known Member

    Joined:
    Jan 6, 2004
    Messages:
    664
    Likes Received:
    3
    Trophy Points:
    168
    Location:
    New Jersey
    cPanel Access Level:
    Root Administrator
    I think you are thinking of the CGI Formmail script perhaps? Not true of PHP customer mailers.

    If you use a local domain and it works then you need to check your /var/log/maillog and /var/log/exim_mainlog log files to see why it is failing for others. Perhaps that domain is listed on an RBL, or you have an SPF set up incorrectly, or DNS isn't working... multitude of possibilities...
     
  13. ullalla

    ullalla Well-Known Member

    Joined:
    Jan 20, 2006
    Messages:
    192
    Likes Received:
    0
    Trophy Points:
    166
    Hello,

    Thanks for your replies guys , I will check for all possibilites.

    Thanks.
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice