Jump to content

[SOLVED] Mail() will only e-mail 5 thing I need more


fishmaster0

Recommended Posts

the mail() function will send as much as you want. Sounds like there's a problem with your form code, where you have different inputs having the same name.  In the absence of relevant code, anything else requires a crystal ball. Post relevant parts of your problem code.

this is the code that is in a sendeail.php it is what sends the e-mail to me

<?php

$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$lastName = $_POST['lastName'];
$visitormail = $_POST['visitormail'];
$phoneNum = $_POST['phoneNum'];
$arrival = $_POST['arrival'];
$departure = $_POST['departure'];
$total = $_POST['total'];
$kids = $_POST['kids'];

$notes = $_POST['notes'];
$attn = $_POST['attn'];


if (eregi('http:', $notes)) {
die ("Do NOT try that! ! ");
}
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
echo $badinput;
die ("Go back! ! ");
}

if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
die ("Use back! ! ");
}

$todayis = date("l, F j, Y, g:i a") ;

$attn = $attn ;
$subject = $attn;

$notes = stripcslashes($notes);

$message = " $todayis [EST] \n
Attention: $attn \n
Message: $notes \n
From: $visitor ($visitormail)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";

$from = "From: $visitormail\r\n";


mail("[email protected]", $from, $message, $visitor, $lastName, $phoneNum);

?>

Ure using mail() the wrong way:

 

mail("[email protected]", $from, $message, $visitor, $lastName, $phoneNum);

 

U cant assign random variables to act like headers, as the syntax of mail is:

 

bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )

 

U have to concatenate all the input fields data to the $message variable:

 

<?php
$to = '[email protected]';
//the subject
$subject = 'Mail from the website';
//construct the mail message
$message = 'Lastname: ' . $_POST['lastName'] . "\n";
$message .= 'Visitor: ' . $_POST['visitor'] . "\n";
$message .= 'Total: ' . $_POST['total'] . "\n";
//construct also the additional headers
$headers = 'From: ' . $visitor . ' <' . $visitormail . "> \r\n";
$headers .= 'Reply-To: ' . $visitor . ' <' . $visitormail . "> \r\n";
$headers .= 'X-Mailer: PHP/' . phpversion();
//this is the correct way of using mail()
mail($to, $subject, $message, $headers);
?>

 

I thank you all for your quick responses but obviously I am not the best at php. So I don't think I really understand. What would be he best way for me to send the form that people are filling out. Or maybe you could point me somewhere that has this already answered.

The example i gave or those pretty similiar found at php.net are basic structure of an email message. Assign $_POST variables to your variables, like u did in the code and construct the $message string the way u want the message to be sent. In the example i gave, the message body would be like:

 

Lastname: Smith
Visitor: John
Total: $1300

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.