我看到了堆棧溢出的許多問題和答案,並嘗試了很多從XAMPP本地主機發送郵件,但所有的嘗試都是徒勞的。 這裏是我的semdmail.ini文件:發送郵件從本地主機在XAMPP與PHP
smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=******@gmail.com
auth_password=***
force_sender= *****@gmail.com
我的php.ini文件中包含此
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
mail.add_x_header = Off
我的PHP文件如下
<?php
if(mail ('[email protected]', 'asdf', 'asdf', 'From: [email protected]'))
{
echo 'success';
}else
{
echo 'sorry';
}
?>
雖然我淨看見了,我無法找到工作解決方案。
'sendmail_path =「C:\ xampp \ sendmail \ sendmail.exe -t」'看看是否有所作爲。在打開'<?php'標籤後立即在文件頂部添加錯誤報告 'error_reporting(E_ALL); ini_set('display_errors',1);'看看它是否產生任何東西。 – 2014-11-03 18:46:20
沒有顯示錯誤。而且它仍然提供相同的輸出。 「對不起」 – bulbasaur 2014-11-03 19:04:48
http://stackoverflow.com/questions/712392/send-email-using-the-gmail-smtp-server-from-a-php-page – mkaatman 2014-11-03 19:22:02