Page 1 of 1

send mail from problem

Posted: Fri Nov 12, 2004 8:30 am
by phpScott
error:
Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing on mypage.com

Code: Select all

<?php
$headers='';
$message="some dynamic message";
$email="phpscott@gmail.com";
$subject='confrimation email from my company for invoice # $sc';

$headers .= "MIME-Version: 1.0\r\n";
 $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: scott.martin@sanderson.com\r\n";
$headers .= "Reply-To: phpScott@gmail.com\r\n" ;
$headers .= "Cc:phpscott@gmail.com\r\n";

mail($email, $subject, $message, $headers);
?>
I can't figure out why the FROM isn't being set. most is cut paste from manual after orginal code not working, although it is very simillar.

Posted: Fri Nov 12, 2004 2:14 pm
by rehfeld
try adding this before calling mail()


ini_set('sendmail_from', 'foo@bar.com');

windows needs that i beleive(or just set it in your php.ini)

adding the from: header as the 5'th arg to the mail function might work too

Posted: Sat Nov 13, 2004 3:03 pm
by ramagates
how to redirect after send form? what is the code?