Off Topic mailer problem

Hello everyone:

I've got a mailer problem. Although I'm pretty sure it doesn't have anything to do with zenphoto (I love it!), maybe some of you guys got a clue, why my formmailer won't work (yes, I'm a total php newb).

`

<?php<br />
if(isset($_POST['submit'])){

echo "Thanky you for the request, we'll handle it as soon as possible.";

$recipient="name@provider.com";

$header="From: " . $_POST['email']."\n";

$mail_body ="The Form-File from" . date("d.m.Y")." um ".date("H:i")."got transmitted .\n";

$mail_body.="The follow Data got transmitted: \n\n";

$mail_body.="Name: ".$name."\n";

$mail_body.="E-Mail: ".$email."\n\n";

$mail_body.="Request:\n";

$mail_body.=$request."\n\n --- end of the auto-mail ---";

mail($recipient, $subject, $mail_body, $header);

}else{

?>

"

method="POST">



Ask a question:



















<?php<br />
}

?>

`

So, after the form got filled it out, the mail arrives but no text in it, except for the data's I've filled out in advance. like "The follow Data got transmitted:" or "--- end of the auto-mail ---" etc.

Thanks for any helpful feedback, jim.

Comments

  • You have to retrieve all the field for the mail from the `$_POST`, so you will have to give a name to your `textarea` and retrieve it for the $mail_body.

    `<?php<br />
    if(isset($_POST['submit'])){

    $email = $_POST['email'];

    echo "Thanky you for the request, we'll handle it as soon as possible.";

    $recipient="name@provider.com";

    $header="From: " . $email."n";

    $mail_body ="The Form-File from" . date("d.m.Y")." um ".date("H:i")."got transmitted .n";

    $mail_body.="The follow Data got transmitted: nn";

    $mail_body.="Name: ".$_POST['name']."n";

    $mail_body.="E-Mail: ".$email."nn";

    $mail_body.="Request:n";

    $mail_body.=$_POST['body']."nn --- end of the auto-mail ---";

    mail($recipient, $subject, $mail_body, $header);

    }else{

    ?>

    "

    method="POST">



    Ask a question:



















    <?php<br />
    }

    ?>`
  • Hi there, thanks it works great.

    One tiny little thing (and i don't really need it, but): If I use `

    mail (...,...,$_POST('body')...);

    `

    Is there an option to still get the Email, Date and Name in the body of the message? With other words, can i bind other variables with the "." to the message body?

    Thanks again for the great help. Finally I got my own formmailer.

    (Next stop Newsletter ;-)).
  • I edited the code above to put the body in your $mail_body.
  • Works beautifully. I added another `$name = $_POST['name'];` and now everything gots displayed. Thank you very much. Just got that rating problem left, but that's a subject for another thread.

    Thanks again and good night.
Sign In or Register to comment.