【问题标题】:php mail function error on windows hostingWindows主机上的php邮件功能错误
【发布时间】:2013-12-26 07:07:31
【问题描述】:

邮件功能现在无法在我的服务器上运行。我找不到解决方案。当我提交联系表格时,我收到了这个错误。

警告: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;

【问题讨论】:

    标签: php email


    【解决方案1】:

    试试下面的

    $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);
    

    【讨论】:

      【解决方案2】:

      “550 Sender is not allowed”表示 SMTP 阻止发件人列表拒绝了该发件人。在您的 SMTP 日志中搜索 550 Sender is not allowed 并找出被阻止的地址,然后更改您的列表以使其通过。

      这就是您遇到的错误的含义。这是来自hMailServer Documentation

      你可以试试下面的方法是否可行?

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

      如果它不起作用,那么可能是由于您的 hMailServer 配置错误,您需要检查您的hMailServer Logs

      【讨论】:

        【解决方案3】:

        您在 windows 服务器上,因此您必须更改 windows 服务器的 SMTP。

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

        【讨论】:

          【解决方案4】:

          您的 SMTP 配置下缺少一些重要信息.... 用户名和密码需要通过 SMTP 邮件服务器进行身份验证..... 在 php 中使用 smtp 邮件很容易:

          PHPMailer (https://github.com/Synchro/PHPMailerhttps://github.com/Synchro/PHPMailer)

          看看吧....

          谢谢……

          【讨论】:

            猜你喜欢
            • 2022-08-22
            • 2013-10-17
            • 1970-01-01
            • 2019-11-17
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2013-06-11
            • 1970-01-01
            相关资源
            最近更新 更多