Menu

email not sending (has to do with $message)

Help
Babs
2012-06-21
2013-06-03
  • Babs

    Babs - 2012-06-21

    My form worked at this time last year, but is not working this year.

    When I created a simple php file, the e-mail would be sent, however, if the mail function calls a variable, it won't send.

    This works:

    <?php
    mail(you@example.com, testing, test);
    ?>

    But, this does not:

    <?php
    $to = 'barbara@turusmedia.com';
    $subject = 'the subject';
    $message = 'hello';
    $headers = 'From: barbara@turusmedia.com' . "\r\n" .
        'Reply-To: barbara@turusmedia.com' . "\r\n" .
        'X-Mailer: PHP/' . phpversion();
    mail($to, $subject, $message, $headers);
    echo "<li>Mail message has been sent!";
    ?>

    When I removed $message from the mail function in my process.php file, it will send.  Suggestions?  My process.php file is below:

    <?php
    include("global.inc.php");
    $errors=0;
    $error="The following errors occured while processing your form input.<ul>";
    pt_register('POST','LastName');
    pt_register('POST','StreetAddress');
    pt_register('POST','FirstName');
    pt_register('POST','City');
    pt_register('POST','MiddleInitial');
    pt_register('POST','State');
    pt_register('POST', 'DL');
    pt_register('POST','ZIP');
    pt_register('POST','Phone');
    pt_register('POST','emailAddress');
    pt_register('POST','Make');
    pt_register('POST','Model');
    pt_register('POST','Year');
    pt_register('POST','StateCar');
    pt_register('POST','Color');
    pt_register('POST','LicensePlate');
    pt_register('POST','Class');
    pt_register('POST','Description');
    $Description=preg_replace("/(\015\012)|(\015)|(\012)/","&nbsp;<br />", $Description);pt_register('POST','Agreement');
    pt_register('POST','Signature');
    if($LastName=="" || $FirstName=="" || $StreetAddress=="" || $City=="" || $State=="" || $ZIP=="" || $Phone=="" || $emailAddress=="" || $Make=="" || $Model=="" || $Year=="" || $Color=="" || $LicensePlate=="" || $StateCar=="" || $Class=="" || $Description=="" || $Agreement=="" || $Signature="" ){
    $errors=1;
    $error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
    }
    if(!eregi("^+(+)*" ."@"."(+(+)*)+"."\\.{2,}"."$",$emailAddress)){
    $error.="<li>Invalid email address entered";
    $errors=1;
    }
    if($errors==1) echo $error;
    else{

    $message="Last Name: ".$LastName."
    First Name: ".$FirstName."
    Driver's License: ".$DL."
    Middle Initial: ".$MiddleInitial."
    Street Address: ".$StreetAddress."
    City: ".$City."
    State: ".$State."
    ZIP: ".$ZIP."
    Phone: ".$Phone."
    email Address: ".$emailAddress."
    Make: ".$Make."
    Model: ".$Model."
    Year: ".$Year."
    Color: ".$Color."
    License Plate: ".$LicensePlate."
    State Car: ".$StateCar."
    Class: ".$Class."
    Description: ".$Description."
    Agreement: ".$Agreement."
    Signature: ".$Signature."
    "
    ;
    $message = stripslashes($message);
    mail("you@example.com","Car Show Form Submitted", $message, "Car Show Registration");

    header("Refresh: 0;url=http://www.example.com");
    ?><?php
    }
    ?>

     
  • Babs

    Babs - 2012-06-21

    Oops - I messed up the simple code at the top.  I don't remember exactly what I did, but it didn't call any variables and the e-mail would send.

    Also, I forgot to remove my e-mail address, but can't see where I can edit/delete my post?

     
  • Babs

    Babs - 2012-06-21

    Nevermind - apparently the server was having some issues…  I'd delete if I could see how!

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.