【问题标题】:php mail works but I'm unable to send mail to company webmailphp mail 有效,但我无法将邮件发送到公司 webmail
【发布时间】:2012-10-22 01:31:32
【问题描述】:

我正在尝试在 joomla 网站中设置联系表单模块。联系人模块适用于我的每个个人电子邮件地址,例如 xxxxxxxxxxxx@gmail.com 或 xxxxxxxxxxxx@libero.it 等。但是当我用我客户的公司邮件收件人测试它时,邮件功能无法正常工作。

为了获得有关失败的更多信息,我将 mailsender 属性设置为我的个人邮件地址,如下所示:

$mailSender->setSender('xxxxxxx@libero.it');
$mailSender->addReplyTo('xxxxxxx@libero.it');

这就是我得到的:

原始消息于 2012 年 10 月 21 日星期日 15:05:00 +0200 收到 来自 apache@localhost

----- 以下地址有永久致命错误-----

info@xxxxxx.it
(reason: 553 5.3.0 <info@xxxxxx.it>... No such user here)
(expanded from: info@xxxxxx.it)

----- 会议记录如下-----

... while talking to [127.0.0.1]:
>>> DATA
<<< 553 5.3.0 <info@xxxxxx.it>... No such user here
550 5.1.1 info@xxxxxx.it... User unknown
<<< 503 5.0.0 Need RCPT (recipient)

在附件中:

Reporting-MTA: dns; xxxxxx.yyyyyyy.com
Arrival-Date: Sun, 21 Oct 2012 15:05:00 +0200

Final-Recipient: RFC822; info@xxxxxx.it
Action: failed
Status: 5.3.0
Remote-MTA: DNS; [127.0.0.1]
Diagnostic-Code: SMTP; 553 5.3.0 <info@xxxxxx.it>... No such user here
Last-Attempt-Date: Sun, 21 Oct 2012 15:05:01 +0200

公司的 webmail 似乎不接受来自自己服务器的邮件。 我不是电子邮件专家,也不是专家 php 程序员。 有什么想法吗?

遵循我的 joomla 模块的部分,其中邮件功能被启动和启动:

 $mailSender = &JFactory::getMailer();
$mailSender->addRecipient($recipient);

$mailSender->setSender('xxxxxxxxxxxxx@libero.it');
$mailSender->addReplyTo('xxxxxxxxxxxxx@libero.it');

$mailSender->setSubject('Richiesta informazioni da sito web');
$mailSender->setBody($myMessage);

if ($mailSender->Send() !== true) {
  $myReplacement = '<span style="color: ' . $error_text_color . ';">' . $errorText . '</span>';
  //header("Location: $url",303);
  print $myReplacement;
  return true;
}
else {
  $myReplacement = '<span style="color: '.$thanksTextColor.';">' . $pageText . '</span>';
  print $myReplacement;
  return true;
}

【问题讨论】:

    标签: php apache email joomla


    【解决方案1】:

    您正在通过 localhost 中继邮件(您正在与127.0.0.1 交谈),因此您的本地 sendmail 安装可能认为它应该为您的域处理邮件,而不仅仅是中继。系统上没有名为info 的用户,因此它返回错误550 No such user here

    检查/etc/mail/local-host-names 并查看该域是否在其中列出,是否将其注释掉并使用service sendmail restart 重新启动sendmail。

    同时验证您是否允许在 /etc/mail/access 中中继本地主机,我的文件在 CentOS 5.8 和 Sendmail 8.13.8 上看起来像这样

    Connect:localhost.localdomain           RELAY
    Connect:localhost                       RELAY
    Connect:127.0.0.1                       RELAY
    

    另一种选择是使用真正的邮件服务器作为 SMTP 中继,而不是 localhost 上的 sendmail - 我不能说它对于有问题的域是什么,但可能是 smtp.example.commail.example.com。另一个需要注意的是,此服务器可能需要身份验证才能从您的 Web 服务器中继邮件 - 您需要与您的管理员核实并相应地更新您的 PHP 代码。

    【讨论】:

    • 我无法控制网络邮件,也无法控制我客户公司的服务器,我只能通过 ftp 访问我目前正在制作的网站的根目录。我可以用 php 脚本做你建议我做的测试吗?
    • 很遗憾,您需要 root 或 sudo 访问权限才能更改该文件。
    • 另一种选择是通过 localhost SMTP 服务器发送邮件。您确实失去了一些健壮性(如果您的 Web 服务器无法访问邮件服务器),但它应该可以工作。很难说主机是什么,但可能是 mail.example.com 或 smtp.example.com。相应地回答更新
    • 我遇到了类似的问题。这为我解决了问题serverfault.com/questions/65365/…'
    【解决方案2】:

    这可能是因为发件人的电子邮件不是您尝试发送电子邮件的邮件列表的注册成员。一些邮件列表只接受来自注册为成员的电子邮件地址的电子邮件(可以在允许的发件人中管理,在邮件列表的选项中)。

    【讨论】:

      【解决方案3】:

      让我看看我是否明白你告诉我的: 1)托管我的joomla网站的服务器有一个管理邮件发送请求的邮件“引擎”; 2) 假设收件人 info@xxxxxx.it 位于收集它调用 127.0.0.1 的请求的同一邮件服务器上;

      3)找不到名为info的用户;

      事实上,我无法控制客户的公司网络邮件或网络服务器。

      我可以屏蔽请求以不显示它来自本地主机吗?还有其他解决方案吗? 对不起我的英语不好......

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-09-24
        • 2020-03-08
        • 1970-01-01
        • 2023-03-18
        • 2011-04-21
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多