View Full Version : sendmail problem

02-01-2009, 03:06 PM
i am following the book php solutions by david powers
and i have got the following error message

Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\wamp\www\xxxxxx\index.php on line 25

i have been going round in circles for two days and can not find the problem

i have reset my php ini file as follows

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from = xxxxxxxx@hotmail.com

this is the same address as the address at $to in the following code if anyone can advise it would be much appreciated many thanks

<?php include('includes/title.inc.php');

//process the email
if(array_key_exists('send', $_POST))
$to = 'xxxxxxx@hotmail.com';
$subject = 'feedback';
$from = 'john';

// process the $_post variables
$name = $_POST['name'];
$email = $_POST['email'];
$comments = $_POST['comments'];

//build the message
$message = "Name: $name\n\n";
$message .= "Email: $email\n\n";
$message .= "Comments: $comments\n\n";

//limit line length
$message = wordwrap($message, 70);

//send it
$mailsent = mail($to, $subject, $message, $from);


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Japan Journey<?php if (isset($title)) {echo "{$title}";} ?></title>
<link href="assets/journey.css" rel="stylesheet" type="text/css" media="screen" />

<div id="header">
<h1>Japan Journey </h1>
<div id="wrapper">

<div id="maincontent">
<h1>Contact us </h1>
if ($_POST && !mailSent) {
<p class="warning"> Sorry there was a problem sending your message. Please try later.</p>
<?php }
elseif ($_POST && $mailSent){
<p><strong>Your message has been sent.Thankyou for your feedback.
<?php } ?>

<p>Ut enim ad minim veniam, quis nostrud exercitation consectetur adipisicing elit. Velit esse cillum dolore ullamco laboris nisi in reprehenderit in voluptate. Mollit anim id est laborum. Sunt in culpa duis aute irure dolor excepteur sint occaecat.</p>
<form id="feedback" method="post" action="">
<label for="name">Name:</label>
<input name="name" id="name" type="text" class="formbox"
<?php if (isset($missing)) {
echo 'value="'.htmlentities($_POST['name']).'"';
} ?>
<label for="email">Email:</label>
<input name="email" id="email" type="text" class="formbox"
<?php if (isset($missing)) {
echo 'value="'.htmlentities($_POST['email']).'"';
} ?>
<label for="comments">Comments:</label>
<textarea name="comments" id="comments" cols="60" rows="8"><?php
if (isset($missing)) {
echo htmlentities($_POST['comments']);
} ?></textarea>

<input name="send" id="send" type="submit" value="Send message" />


<?php include('includes/footer.inc.php'); ?>

02-01-2009, 03:50 PM
please ignore the following im thick

02-12-2009, 10:20 PM
message erased due to incorrect information sent

02-12-2009, 10:27 PM
Hi shimble,

I've used pretty much the same code as you however, I don't get any error but the emails have not reached the recipient used in the $to.

Where did these two files come from?


I replaced these two lines with the phpmailer php files.

Hope to hear from you or anyone else here who can help.