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.

Mail via form issue

Discussion in 'E-mail Discussions' started by DrChaos, Jul 28, 2004.

  1. DrChaos

    DrChaos Active Member

    Joined:
    Dec 23, 2001
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    We have a form that has stopped working after upgrading to php 4.3.8 Nothing else has changed.

    the contents of the order.php that the form submits to is as follows:

    Code:
    <?
    /*
    <form method="POST" action="order.php">
    <input type="hidden" name="to" value="name@domain.net">
    <input type="hidden" name="from" value="Website Order">
    <input type="hidden" name="subject" value="[WEBORDER] Gear Web Order">
    
    */
    $vars = $HTTP_POST_VARS;
    
    if ($vars) {
    while (list ($key,$value) = each ($vars)) {
    	if ($key == "to") { $toemail = $value; continue; }
    	if ($key == "subject") { $subject = $value; continue; }
    	if ($key == "from") { $from = $value; continue; }
    	if ($key == "submit") { continue; }
    	
    	if ($value == "ON") { $value = "YES"; }
    	
    	 $message .= "$key:   $value\n";
    }
    mail($toemail, $subject, $message, "From: $from\nX-Mailer: PHP/" . phpversion());
    
    echo "Thank you, your order has been sent.<br>".
         "<a href=\"javascript:history.back(1);\">Click here to return to our site.</a>";
    }
    ?>
    
    Has something changed that I need to fix? Is this a problem due to the upgrade? No mail is received at the address that is offsite. Any ideas? It has been working for approx a year without issues thru all the other upgrades. Thanks for your help
     
  2. OCX

    OCX Well-Known Member

    Joined:
    Sep 20, 2003
    Messages:
    232
    Likes Received:
    0
    Trophy Points:
    16
    try this?


    <?
    /*
    <form method=\"POST\" action=\"order.php\">
    <input type=\"hidden\" name=\"to\" value=\"name@domain.net\">
    <input type=\"hidden\" name=\"from\" value=\"Website Order\">
    <input type=\"hidden\" name=\"subjec\t" value=\"[WEBORDER] Gear Web Order\">


    notice the slashes? \ <--
     
  3. DrChaos

    DrChaos Active Member

    Joined:
    Dec 23, 2001
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    No, that didn't work either.... cpanel support said:
    It looks like you'll need a more robust SMTP session sending solution instead of mail() for your script to be able to send mail.

    Any ideas on what to use or how to accomplish this? It's funny, it's been working for over a year without changes, and now all of a sudden it isn't.
     
  4. asmithjr

    asmithjr Well-Known Member

    Joined:
    Jun 13, 2003
    Messages:
    475
    Likes Received:
    1
    Trophy Points:
    18
    I used this code and it worked to send mail to my local email account,

    Now, when I used one of my hosting accounts that has spamassassin enabled I did not get the email, one account without spam assassin enabled I get the email.

    Looks like a header problem.

    So I played around with it.
    You $from is the problem there is no email address in it.

    change this
    <input type="hidden" name="from" value="Website Order">

    to this
    <input type="hidden" name="from" value="Website Order<email@domainname.com>">

    that worked for me.
     
    #4 asmithjr, Jul 28, 2004
    Last edited: Jul 28, 2004
  5. DrChaos

    DrChaos Active Member

    Joined:
    Dec 23, 2001
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    I tried that as well...no go.
    We added a Fail message to it so we know if sendmail doesn't accept it and it fails each time to even send.
    If I try to use formail clone, it gives a missing field, no recipient found, even though both 2 and from are showing on the results page. Again, no mail is sent.
     
  6. DrChaos

    DrChaos Active Member

    Joined:
    Dec 23, 2001
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    Problem solved with a reinstall of exim. Everything working again.... will go over the backup file and try to find what was causing the error. Thanks for all your suggestions.
     
Loading...

Share This Page