我一直在尝试从xampp发送邮件这么多次,因为我设置了所有必需的东西,但仍然没有邮件功能。
我尝试过以下步骤:
从;
php.ini
文件中删除extension=php_openssl.dll
[邮件功能]
SMTP=smtp.gmail.com
smtp_port=587
sendmail_from = shail.gandhi132@gmail.com
sendmail_path = "\"c:\xampp\sendmail\sendmail.exe\" -t"
C:\ XAMPP \ sendmail的
[sendmail的]
smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=shail.gandhi132@gmail.com
auth_password=(My passowd)
force_sender=shail.gandhi132@gmail.com
我的PHP代码是
$to = 'sgandhi132@gmail.com';
$subject = 'This is subject';
$message = 'This is HTML message';
$header ='From:shail.gandhi132@gmail.com';
$send = mail($to,$subject,$message,$header);
if($send == true)
{echo "Mail Sent";}
else
{ echo "Error";}