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 Form Mail script does not send mail

Discussion in 'E-mail Discussions' started by fr0gman, Jul 30, 2007.

  1. fr0gman

    fr0gman Member

    Joined:
    Jun 9, 2007
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    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.
     
    #1 fr0gman, Jul 30, 2007
    Last edited: Jul 30, 2007
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    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. tangowebs

    tangowebs Well-Known Member

    Joined:
    Oct 12, 2004
    Messages:
    93
    Likes Received:
    0
    Trophy Points:
    0
    I dont have enabled nobody to send email and I have php4, phpsuexec enabled... emails are not being sent.
    Any idea?
     
  4. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    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. tangowebs

    tangowebs Well-Known Member

    Joined:
    Oct 12, 2004
    Messages:
    93
    Likes Received:
    0
    Trophy Points:
    0
    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. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    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. tangowebs

    tangowebs Well-Known Member

    Joined:
    Oct 12, 2004
    Messages:
    93
    Likes Received:
    0
    Trophy Points:
    0
    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---
     
    #7 tangowebs, Nov 30, 2007
    Last edited: Nov 30, 2007
  8. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    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. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    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. tangowebs

    tangowebs Well-Known Member

    Joined:
    Oct 12, 2004
    Messages:
    93
    Likes Received:
    0
    Trophy Points:
    0
    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. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    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. kmpanilla

    kmpanilla Member

    Joined:
    Oct 24, 2003
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    1
    I was seeing this same type of issue. Recompiling php5 as CGI instead of DSO fixed it...for now.
     
Loading...

Share This Page