gpt4 book ai didi

php - magento 不发送任何邮件,如何调试?

转载 作者:行者123 更新时间:2023-12-03 00:35:01 27 4
gpt4 key购买 nike

Magento 未发送任何电子邮件,跨国,联系表单出现错误

 cannot send your mail at this moment

我检查过

  • magento 中的邮件设置,所有电子邮件帐户均在设置中设置
  • php 邮件工作正常,test.php 使用 php 邮件发送消息
  • 检查了我的邮件服务器日志,但没有发现任何错误
  • /var/log/system.log 和Exception.log 仅显示错误而不显示错误原因

    异常“Zend_Mail_Transport_Exception”
    消息“无法发送邮件。 ' 在
    /var/webshop/httpdocs/lib/Zend/Mail/Transport/Sendmail.php:137

最佳答案

当 Magento 没有发送忘记密码的电子邮件(但向用户报告它)时,我遇到了这个问题,然后在查看 /var/log/exception.log 后发现了错误生成的是:

2012-05-30T04:27:54+00:00 ERR (3): 
exception 'Exception' with message 'This letter cannot be sent.' in /home/magento/www/app/code/core/Mage/Core/Model/Email/Template.php:354
Stack trace:
#0 /home/magento/www/app/code/core/Mage/Core/Model/Email/Template.php(463): Mage_Core_Model_Email_Template->send(Array, Array, Array)
#1 /home/magento/www/app/code/core/Mage/Core/Model/Email/Template/Mailer.php(79): Mage_Core_Model_Email_Template->sendTransactional('customer_passwo...', 'support', Array, Array, Array, '1')
#2 /home/magento/www/app/code/core/Mage/Customer/Model/Customer.php(646): Mage_Core_Model_Email_Template_Mailer->send()
#3 /home/magento/www/app/code/core/Mage/Customer/Model/Customer.php(663): Mage_Customer_Model_Customer->_sendEmailTemplate('customer/passwo...', 'customer/passwo...', Array, '1')
#4 /home/magento/www/app/code/core/Mage/Customer/controllers/AccountController.php(554): Mage_Customer_Model_Customer->sendPasswordResetConfirmationEmail()
#5 /home/magento/www/app/code/core/Mage/Core/Controller/Varien/Action.php(420): Mage_Customer_AccountController->forgotPasswordPostAction()
#6 /home/magento/www/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('forgotpasswordp...')
#7 /home/magento/www/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#8 /home/magento/www/app/code/core/Mage/Core/Model/App.php(349): Mage_Core_Controller_Varien_Front->dispatch()
#9 /home/magento/www/app/Mage.php(640): Mage_Core_Model_App->run(Array)
#10 /home/magento/www/index.php(84): Mage::run('default', 'store')
#11 {main}

因此打开/app/code/core/Mage/Core/Model/Email/Template.php并发现引发此错误的代码(第354行)是:

if (!$this->isValidForSend()) {
Mage::logException(new Exception('This letter cannot be sent.')); // translation is intentionally omitted
return false;
}

所以看一下isValidForSend():

public function isValidForSend()
{
return !Mage::getStoreConfigFlag('system/smtp/disable')
&& $this->getSenderName()
&& $this->getSenderEmail()
&& $this->getTemplateSubject();
}

在函数开头添加了一些变量记录,因为其中之一必须返回 false:

Mage::Log(var_export(!Mage::getStoreConfigFlag('system/smtp/disable'),true).';'.var_export($this->getSenderName(),true).';'.var_export($this->getSenderEmail(),true).';'.var_export($this->getTemplateSubject(),true),null,'email.log');

它创建了日志文件/var/log/email.log,其中包含:

2012-05-30T04:44:37+00:00 DEBUG (7): false;'CustomerSupport';'support@example.com';'Password Reset Confirmation for {{var customer.name}}'

所以问题是:!Mage::getStoreConfigFlag('system/smtp/disable'),您可以在管理>系统>配置>高级>系统>邮件发送中修复它设置并将禁用电子邮件通信更改为,以便电子邮件被禁用。

现在可以了:)

关于php - magento 不发送任何邮件,如何调试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9393220/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com