Jump to content

Using SendMail - need some help


s2krazy_UK

Recommended Posts

I am hoping that someone could help me with a current problem or perhaps some advice with trouble shooting this.

 

I have an HTML web page with a form that the person viewing can enter contact information to.  It uses an html form to a sendmail.php file for processing, just using basic php code.  The ISP specified that this was the only way it can be done on their infrastructure.

 

The email arrives but there is no information in there.

 

The code I am using is below, any help would be appreciated

 

<html>

<head>

<title>Untitled Document</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

 

<body>

<?php

mail("[email protected]", "Register Interest Form Results", $_REQUEST[message], "From: $_REQUEST", "[email protected]".$_REQUEST);

 

$MESSAGE_BODY = "Name: ".$_POST["name"]." ";

$MESSAGE_BODY .= "Email: ".$_POST["email"]." ";

$MESSAGE_BODY .= "Phone: ".$_POST["phone"]." ";

$MESSAGE_BODY .= "Company: ".$_POST["company"]." ";

$MESSAGE_BODY .= "Jobtitle: ".$_POST["jobtitle"]." ";

$MESSAGE_BODY .= "Besttime2call: ".$_POST["besttime2call"]." ";

$MESSAGE_BODY .= "Howdidyouhear: ".$_POST["howdidyouhear"]." ";

$boxes = '';

if (isset($_POST['boxes']) && is_array($_POST['boxes']))

  $boxes = implode(', ', $_POST['boxes']);

 

$MESSAGE_BODY .= "Options: ".$boxes;

 

 

$MESSAGE_BODY .= "Comment: ".nl2br($_POST["comment"])." ";

mail($ToEmail, $EmailSubject, $MESSAGE_BODY) or die ("Failure");

 

header( "Location: http://www.yourturn.me.uk/thankyou.html" );

?>

 

</body>

</html>

 

 

Link to comment
https://forums.phpfreaks.com/topic/155810-using-sendmail-need-some-help/
Share on other sites

I might be missing something but - it seems like you never add "$message_body" to the sending clause. How can you send the clauses without declaring the variable and appending it to the send function?

 

EDIT: $_REQUEST is dangerous. Use $_POST instead.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.