php 使用sendmail发送邮件


1.配置php.ini

SMTP=smtp.163.com

sendmail_from = 17760273453@163.com

sendmail_path = "C:/xampp/sendmail/sendmail.exe -t"

 

2.配置sendmail.ini

smtp_server=smtp.163.com

auth_username=17760273453@163.com
auth_password=sqm100

force_sender=17760273453@163.com


3.测试

<?php

if (mail("657642432@qq.com", "测试", "测试邮件")) {
echo 'success!';
} else {
echo 'fail';
}