send mail from problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

send mail from problem

Post 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.
rehfeld
Forum Regular
Posts: 741
Joined: Mon Oct 18, 2004 8:14 pm

Post 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
ramagates
Forum Newbie
Posts: 6
Joined: Thu Nov 11, 2004 12:16 pm
Location: Sri Lanka

Post by ramagates »

how to redirect after send form? what is the code?
Post Reply