[英]cannot send mail using php mail function
我試圖在我的本地計算機上使用 PHP 郵件,但它只是不起作用。 我正在使用來自 php 網站的標准腳本:
PHP 錯誤我得到
SMTP server response: 550 Error sending message: Error: FROM address is invalid
實際 PHP
$to = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
我下載了一個本地郵件服務器,argosoft。 它說服務 URL 是http://services.argosoft.com/RelayService/Service.asmx 。 我假設這就是我在 php.ini 中放入的內容。
php ini。
For Win32 only.
SMTP = services.argosoft.com/RelayService/Service.asmx
smtp_port = 25
我以前遇到過這個錯誤,我相信您所要做的就是將 email webmaster@example.com
更改為真正的 email。 確保您也將其發送到真正的 email。
將 @example.com 替換為真實的 email 地址。
並在 PHP.ini 設置
SMTP = localhost
顯然,許多郵件系統在回車\r
方面存在問題。 您可能希望修改$header
以僅使用換行符\n
。 看看這是否有效。
此外,您可能想嘗試使用完整的 From header:
From: Some Name Here <real_email@notAnExample.com>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.