我的发送邮件不起作用,我对php.ini,sendmail.ini进行了更改。
以下代码是sendmail.ini
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=587
;smtp_ssl=auto
error_logfile=error.log
;debug_logfile=debug.log
auth_username=abc@gmail.com
auth_password=password
pop3_server=
pop3_username=
pop3_password=
force_sender=abc@gmail.com
force_recipient=
hostname=
以下代码用于发送测试电子邮件 `
<html>
<head>
<title>Send Mail</title>
</head>
<body>
<?php
$to = "xyz@gmail.com";
$subject = "My Subeject";
$txt = "Hello World!";
$headers ="From: abc@gmail.com" . "\r\n" .
"CC: def@gmail.com";
// mail($to,$subject,$txt,$headers);
if(mail($to, $subject, $txt, $headers))
echo "Email sent";
else
echo "Email sending failed";
?>
</body>
</html>
`
先谢谢您