[web] Some problems with "losing" packets

Started by
4 comments, last by Sander 18 years ago
Hmmm, I can't figure out what this problem is. I know it has something to do with email.php not getting "from" information from contact.html. But I'm not sure. Here is the error message I get when I try to send myself an email:

Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in E:\xampp\xampp\htdocs\skide\email.php on line 8



And here's the files: Contact.html

<html>
<head>
<title>Test</title>
</head>
<body>
<form method="post" action="email.php">
Name: <input name="from" type="text">
<br>
<textarea name="comment" rows="5" cols="20">
</textarea>
<input type="submit" value="Send email">
</form>
</body>
</html>





email.php

<html>
<body>
<?php
$from = $_POST['from'];
$text = $_POST['comment'];


mail("oyvind.ege@gmail.com", "SKIDE TEST", $text, $from);
?>
</body>
</html>






Thanks for any help![smile]
Hope I was helpful. And thank you if you were!
Advertisement
Nobody knows?
Hope I was helpful. And thank you if you were!
$from = 'From:'.$_POST['from'];
Dolphins - The sharks of the sea.
You have to include that?

Thanks for answering [smile].
Hope I was helpful. And thank you if you were!
yup,
as you can see here the 4th parameter is not the 'from' field. it is used for additional headers like Cc:, Bcc: and From:
Dolphins - The sharks of the sea.
The 4th field should be:

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

mail(.., .., .., $header);

<hr />
Sander Marechal<small>[Lone Wolves][Hearts for GNOME][E-mail][Forum FAQ]</small>

This topic is closed to new replies.

Advertisement