027-87227388
2024年澳门原料免费老澳

windows下xampp发邮件的配置方法

发布时间:2013-01-24 浏览:2873

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…";
}

?>