我已将php.ini和sendmail.ini更改为以下设置:smtp.gmail.com(已启用TLS,端口587)然后我将auth_username和auth_password。
<?php
$to = "myemail@gmail.com";
$subject = "subject";
$txt = "How are you ?";
$headers = "From: example@example.com" . "\r\n";
$send=mail($to,$subject,$txt,$headers);
if($send){
echo "sent";
}else{
echo "not sent";
}
?>
我尝试使用hotmail发送电子邮件并更改上述设置但是有效,但gmail无法正常工作...