1 php.ini
SMTP =smtp.126.com
smtp_prot =25
sendmail_from = xxxx@126.com
sendmail_path = "D:\xampp\sendmail\sendmail.exe -t"
2 D:\xampp\sendmail\sendmail.ini
smtp_server=smtp.126.com
error_logfile=error.log
debug_logfile=debug.log
auth_username=xxxx@126.com
auth_password=mailpassworld
force_sender=xxxx@126.com
<?php
$txt = "First line of text\nSecond line of text";
$txt = wordwrap($txt,70);
//$v = mail("subject",$txt);
//var_dump($v);
$from_name = "Justrealized";
$from_email = "";
$headers = "From: $from_name <$from_email>";
$body = "Hi, \nThis is a test mail from $from_name <$from_email>.";
$subject = "Test mail from Justrealized";
$to = "";
if (mail($to, $subject, $body, $headers)) {
echo "success!";
} else {
echo "fail…";
}
?>