English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

When people sign upto my site it should send them an email talling them their password etc. How do i change the php.ini file to send all mail from my sites email. How do you get the php.ini file too?

2006-10-24 11:37:08 · 2 answers · asked by peter s 1 in Computers & Internet Programming & Design

2 answers

You shouldn't. Instead, you need to add a "From:" header to the e-mail.

2006-10-26 07:07:12 · answer #1 · answered by NC 7 · 0 0

You don't have to modify anything in your php.ini
the only thing you'll (maybe) need to modify is the "smtp" to point the smtp server you're using.
try this function ;

function sendmail($from,$to,$subject
,$message)
{

$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$from."\r\n";
$headers .= "Return-Path: ".$from."\r\n";

$body=$message;

/**modify this line to use alternate smtp server instead of default server **/

/**ini_set("SMTP",
"smtpserver.com");**/

if(mail($to, $subject, $body, $headers)){return 1;}else{return 0;}
}

/**USAGE**/

if (sendmail("your@email.com","destination@email.com","any subject","complete message") == 1) {
echo "Succeed";
}
else {
echo "Failed";
}
?>

2006-10-25 00:16:14 · answer #2 · answered by d@mn 2 · 0 0

fedest.com, questions and answers