Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 12 of 12
  1. #1
    Member
    Join Date
    Jun 2007
    Posts
    6

    Default PHP Form Mail script does not send mail

    I am sure that the problem here is a setting in WHM related to security, but dang if I know what to change.

    I am trying to run a simple form that emails the resulting user input to my email. I have tried 2 seemingly simple to setup forms and neither get mail to me. They both execute correctly and I am sent to the success page, but no mail hits the box... any ideas?

    UPDATE:

    I can get it to send to addresses within the same domain but not external addresses.
    Last edited by fr0gman; 07-30-2007 at 10:10 AM.

  2. #2
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by fr0gman View Post
    I am sure that the problem here is a setting in WHM related to security, but dang if I know what to change.

    I am trying to run a simple form that emails the resulting user input to my email. I have tried 2 seemingly simple to setup forms and neither get mail to me. They both execute correctly and I am sent to the success page, but no mail hits the box... any ideas?

    UPDATE:

    I can get it to send to addresses within the same domain but not external addresses.
    First thing I think of in a situation like this is if user nobody is able to send mail (a WHM setting) and if the script is running as user nobody (default, but would run as user if running SuExec/PhpSuExec/SuPHP).

  3. #3
    Registered User
    Join Date
    Oct 2004
    Posts
    93

    Default

    I dont have enabled nobody to send email and I have php4, phpsuexec enabled... emails are not being sent.
    Any idea?

  4. #4
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by tangowebs View Post
    I dont have enabled nobody to send email and I have php4, phpsuexec enabled... emails are not being sent.
    Any idea?
    Are you using the PHP mail() function to send the mail or some other mechanism? Perhaps check if the script is generating an error_log file (typically located in the same directory as the .php or .php4 file) that you can analyze to determine the cause of the issue.

  5. #5
    Registered User
    Join Date
    Oct 2004
    Posts
    93

    Default

    This is the form:

    Code:
    <?  
    
    /******************************************************
    **
    **   Flash Mx PHP Mailer
    **
    ** By - David Khundiashvili
    *******************************************************/
    
    /******************************************************* 
    
    Enter your site details below!
    
    *******************************************************/
    
    // Enter your contact email address here
    $adminaddress = "info@xxxxxxx"; 
    
    // Enter the address of your website here include http://www. 
    $siteaddress ="http://www.xxxxxx"; 
    
    // Enter your company name or site name here 
    $sitename = "xxxxx"; 
    
    /*******************************************************
    
    No need to change anything below ... 
    
    *******************************************************/
    
    $date = date("d/m/Y H:i:s");
    
    if ($REMOTE_ADDR == "") server_IP = "no ip";
    else $ip = getHostByAddr($REMOTE_ADDR);
    
    
    if ($action != ""): 
    mail("$adminaddress","Formulario xxx", 
    "Alguien visitó $sitename  y te ha dejado la siguiente información\n
    Nombre: $fname 
    Apellido: $lname
    Email: $email
    Teléfono: $telno\n
    Mensaje:
    ------------------------------
    $comments
    
    Información de conexión :
    ------------------------------
    Using: $HTTP_USER_AGENT
    Hostname: $ip
    IP address: $REMOTE_ADDR
    Date/Time:  $date","FROM:$adminaddress"); 
    
    mail("$email","Gracias por visitar $sitename", 
    "Hola $fname,\n
    Gracias por dejar su mensaje en $sitename!\n
    Saludos,
    $sitename
    $siteaddress","FROM:$adminaddress"); 
    
    $sendresult = "¡Gracias!";
    $send_answer = "answer=";
    $send_answer .= rawurlencode($sendresult);
    echo "$send_answer";
    
    endif;
    
    ?>

  6. #6
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by tangowebs View Post
    This is the form:

    Code:
    <?  
    
    /******************************************************
    **
    **   Flash Mx PHP Mailer
    **
    ** By - David Khundiashvili
    *******************************************************/
    
    /******************************************************* 
    
    Enter your site details below!
    
    *******************************************************/
    
    // Enter your contact email address here
    $adminaddress = "info@xxxxxxx"; 
    
    // Enter the address of your website here include http://www. 
    $siteaddress ="http://www.xxxxxx"; 
    
    // Enter your company name or site name here 
    $sitename = "xxxxx"; 
    
    /*******************************************************
    
    No need to change anything below ... 
    
    *******************************************************/
    
    $date = date("d/m/Y H:i:s");
    
    if ($REMOTE_ADDR == "") server_IP = "no ip";
    else $ip = getHostByAddr($REMOTE_ADDR);
    
    
    if ($action != ""): 
    mail("$adminaddress","Formulario xxx", 
    "Alguien visitó $sitename  y te ha dejado la siguiente información\n
    Nombre: $fname 
    Apellido: $lname
    Email: $email
    Teléfono: $telno\n
    Mensaje:
    ------------------------------
    $comments
    
    Información de conexión :
    ------------------------------
    Using: $HTTP_USER_AGENT
    Hostname: $ip
    IP address: $REMOTE_ADDR
    Date/Time:  $date","FROM:$adminaddress"); 
    
    mail("$email","Gracias por visitar $sitename", 
    "Hola $fname,\n
    Gracias por dejar su mensaje en $sitename!\n
    Saludos,
    $sitename
    $siteaddress","FROM:$adminaddress"); 
    
    $sendresult = "¡Gracias!";
    $send_answer = "answer=";
    $send_answer .= rawurlencode($sendresult);
    echo "$send_answer";
    
    endif;
    
    ?>
    You're using mail(), one thing you may want to do is check the Exim logs to see if the messages are making their way into the mail server.

  7. #7
    Registered User
    Join Date
    Oct 2004
    Posts
    93

    Default

    do you know how can I change this to php mail? or how can I verify if they are working?
    Exim is working on server...but those php mails no---
    Last edited by tangowebs; 11-30-2007 at 11:18 AM.

  8. #8
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by tangowebs View Post
    do you know how can I change this to php mail?
    Can you clarify what you mean by that? You are already using the PHP mail() function. PHP does not have an internal SMTP server, on a cPanel/WHM user, mail traverses through Exim.

  9. #9
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by tangowebs View Post
    do you know how can I change this to php mail? or how can I verify if they are working?
    Exim is working on server...but those php mails no---
    Try viewing the mail queue (WHM -> Email -> Mail Queue Manager) or checking the Exim logs:

    /var/log/exim_mainlog <- Message Delivery (and Receiving)
    /var/log/exim_rejectlog <- Rejections based on ACLs/Policies
    /var/log/exim_paniclog <- Stores all entries Exim doesn't know how to handle.

    Substitute _ for / if you are on a FreeBSD system.

  10. #10
    Registered User
    Join Date
    Oct 2004
    Posts
    93

    Default

    If I say to change the script will it work? I dont know if its a script problem or server configuration.
    Mails are working fine, but those php scripts are not being delivered.

  11. #11
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by tangowebs View Post
    If I say to change the script will it work? I dont know if its a script problem or server configuration.
    Mails are working fine, but those php scripts are not being delivered.
    The purpose of checking the exim logs is to see if the mail generated by PHP is making it to the mail server. Did you check the logs? Is the message there?

    If yes, then re-coding the script is likely unnecessary, it is a mail server issue.

    If no, re-code the script as needed.

  12. #12
    Member
    Join Date
    Oct 2003
    Posts
    19

    Default

    I was seeing this same type of issue. Recompiling php5 as CGI instead of DSO fixed it...for now.

Similar Threads & Tags
Similar threads

  1. Replies: 1
    Last Post: 05-04-2011, 11:10 AM
  2. Unable to send & recive the mail form any domain
    By sanjeet in forum E-mail Discussions
    Replies: 0
    Last Post: 04-17-2008, 02:29 AM
  3. problem with form mail php
    By upsforum in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 05-21-2007, 05:29 PM
  4. PHP mail script owner and exim mail logs
    By neo4242002 in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 05-16-2007, 08:06 AM
  5. Problem with e-mail and form mail script
    By dappadan in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 02-10-2005, 03:02 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube