1 php.ini
SMTP =smtp.126.com
smtp_prot =25
sendmail_from = [email protected]
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
[email protected]
auth_password=mailpassworld
[email protected]
<?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…";
}
?>