簡體   English   中英

無法從xampp發送郵件

[英]can't send mails from xampp

這是我在php.ini中所做的:

[mail function]
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"

在sendmail.ini中:

[sendmail]
smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=myemailid@gmail.com
auth_password=mypassword
force_sender=myemailid@gmail.com

這是我要運行的代碼:

 <?php
$to = 'anotheremail@gmail.com';
$subject = 'Hello from XAMPP!';
$message = 'This is a test';
$headers = "From: myemailid@gmail.com\r\n";
if (mail($to, $subject, $message, $headers)) {
   echo "SUCCESS";
} else {
   echo "ERROR";
}
?>

這向我顯示了成功作為輸出。 但是,我沒有收到任何電子郵件...

您是否將其用於本地項目? 由於mail()函數發送郵件失敗,該代碼將繼續顯示錯誤。 嘗試將sendmail_path變量設置為

sendmail_path="C:\xampp\mailtodisk\mailtodisk.exe"

這會將所有郵件發送到文件夾mailoutput中的xammp目錄。 就像“ C:\\ xampp \\ mailoutput

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM