簡體   English   中英

Windows主機上的php郵件功能錯誤

[英]php mail function error on windows hosting

郵件功能現在無法在我的服務器上運行。 我無法找到解決方案。 提交聯系表格時,出現以下錯誤。

警告: mail() [function.mail]:SMTP服務器響應:550不允許發件人。 在E:\\ HostingSpace \\ abayamtranslations.com \\ httpdocs \\ contact-form \\ classes \\ contact.php在第137行
錯誤! 請確保在此服務器上正確配置了PHP Mail()

$address = "info@abayamtranslations.com";

ini_set("SMTP","mail.abayamtranslations.com");
ini_set("smtp_port","25");
ini_set('sendmail_from','info@abayamtranslations.com');
$headers = "From: $email" . PHP_EOL;
$headers .= "Reply-To: $email" . PHP_EOL;
$headers .= "MIME-Version: 1.0" . PHP_EOL;
$headers .= "Content-type: text/plain; charset=utf-8" . PHP_EOL;
$headers .= "Content-Transfer-Encoding: quoted-printable" . PHP_EOL;

“不允許550發件人”表示SMTP阻止的發件人列表拒絕了發件人。 在您的SMTP日志中搜索“ 550發件人”,並確定哪個地址被阻止,然后更改您的列表以使其通過。

這就是您得到的錯誤的含義。 這來自hMailServer文檔

您是否可以嘗試以下方法?

<?php
mail('info@abayamtranslations.com','Test Email','This is a test email.',"From: info@abayamtranslations.com");
?>

如果它不起作用,則可能是由於hMailServer中的配置錯誤,您需要檢查hMailServer日志

嘗試以下

$emailFrom = "info@abayamtranslations.com"; // match this to the domain you are sending email from
$email = "example@example.com";
$subject = "Subject of email";
$headers = 'From:' . $emailFrom . "\r\n";
$headers .= "Reply-To: " . $email . "\r\n";
$headers .= "Return-path: " . $email;
$message = "Message of email";
mail($email, $subject, $message, $headers);

您在Windows服務器上,因此,您必須更改Windows服務器的SMTP。

更好的方法是使用PHPMailer庫。 https://github.com/PHPMailer/PHPMailer

在您的SMTP配置下缺少一些重要信息。...使用SMTP郵件服務器進行身份驗證需要用戶名和密碼 .....在php中使用以下SMTP郵件很容易:

PHPMailerhttps://github.com/Synchro/PHPMailerhttps://github.com/Synchro/PHPMailer

看看...。

謝謝....

暫無
暫無

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

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