【问题标题】:Woocommerce: How to debug problem related to new order email?Woocommerce:如何调试与新订单电子邮件相关的问题?
【发布时间】:2020-08-10 09:07:22
【问题描述】:

我使用此解决方案通过自定义字段向其他收件人发送电子邮件

Add recipients from product custom fields to Woocommerce new order email notification


但是我没有收到任何电子邮件。 我打开了调试、调试日志和调试显示,但它没有显示任何错误。

我认为这可能是我用来发送订单电子邮件的邮件服务中的错误(我使用 Mail.ru SMTP)。 但是它可以在没有代码的情况下工作。

问题是如何发现问题?

UPD: 我在return $recipient; 之前添加到var_dump($recipient); die; 并在error_log 中收到错误:

string(45) "order@domain.name, email@domain.name, email2@domain.name"

UPD2: 我在插件设置中打开了电子邮件登录,并收到了以下技术细节:

Date: Mon, 27 Apr 2020 09:56:35 +0000
To: order@domain.name, email@domain.name, email2@domain.name
From: Hello Hello <hello@domain.name>
Reply-To: A A <customer@domain.name>
Subject: [Domain.name]: New order #1234
Message-ID: <c2654ca64fd38e5061f7357d04b1XXXX@domain.name>
X-Mailer: WPMailSMTP/Mailer/smtp 1.9.0
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

很遗憾,我没有收到任何电子邮件中的任何消息。

UPD3: 我安装了电子邮件日志插件来监控电子邮件状态,它在电子邮件中显示错误,应该发送到 order@domain.name、email@domain.name、email2@domain.name

【问题讨论】:

  • 与其不喜欢,如果你能帮忙会很有帮助!
  • 您是否回显或记录了 $recipient 的值,以确认它已按照您认为的方式填充?
  • 最直接的方法是将vardump($recipient); die; 添加为您的退货声明上方的新行。这将呈现带有类型信息的接收者变量,然后终止脚本。
  • 这是var_dump,而不是vardump
  • 你试过像email-log这样的插件吗?通过这种方式,您可以确定邮件是否是从 wordpress 发送的,因此问题出在其他地方(电子邮件垃圾邮件过滤器等)

标签: php wordpress email woocommerce advanced-custom-fields


【解决方案1】:

我尝试关闭脚本并在 WooCommerce 设置页面的新订单设置中手动添加 2 封电子邮件。 因此,当我有超过 1 个收件人时,我不会收到任何邮件。

我已经写信给 biz.mail.ru 的支持团队,他们请我提供 SMTP 日志。

因此,脚本运行良好,为了检查它,您可以使用 UPD1 中的代码。

我想我应该寻找如何记录 SMTP 并与邮件服务提供商一起解决这个问题的方法。

如果问题出现在我这边,我会更新(或要求更新)这个问题。 亲切的问候。

【讨论】:

    猜你喜欢
    • 2015-05-08
    • 1970-01-01
    • 2020-11-22
    • 2020-09-22
    • 2018-10-24
    • 1970-01-01
    • 2019-12-27
    • 1970-01-01
    • 2020-12-15
    相关资源
    最近更新 更多