magento不发出任何邮件,怎么调试? [英] magento not sending out any mails, how to debug?
问题描述
Magento
不发送任何电子邮件,跨国,联系表单发出错误
Magento
is not sending out any emails, transnational, contact form gives error
cannot send your mail at this moment
我查了
- 邮件设置在magento中,所有电子邮件帐户都设置在设置
- php邮件工作正常一个test.php与php邮件发送
- 检查我的邮件服务器日志,但看不到任何错误
-
/var/log/system.log和exception.log显示只有错误不是错误的原因
- Mail setup in magento, all email accounts are set in settings
- php mail works fine a test.php with php mail sends out a message
- checked my mailserver logs but see nothing there no errors
/var/log/system.log and exception.log shows only an error not the cause of the error
异常'Zend_Mail_Transport_Exception'与
消息'无法发送邮件。 'in
/var/webshop/httpdocs/lib/Zend/Mail/Transport/Sendmail.php:137
推荐答案
当Magento没有发送忘记的密码电子邮件(但向用户报告时)遇到这个问题,然后查看 /var/log/exception.log
发现它生成的错误是:
I ran into this problem when Magento was not sending out forgot password emails (yet reporting it did to the user) then after looking in /var/log/exception.log
found the error it was generating was:
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行)是:
So opened up /app/code/core/Mage/Core/Model/Email/Template.php
and found the code that was throwing this error (on line 354) was:
if (!$this->isValidForSend()) {
Mage::logException(new Exception('This letter cannot be sent.')); // translation is intentionally omitted
return false;
}
所以看看 isValidForSend() code>
So had a look at isValidForSend()
:
public function isValidForSend()
{
return !Mage::getStoreConfigFlag('system/smtp/disable')
&& $this->getSenderName()
&& $this->getSenderEmail()
&& $this->getTemplateSubject();
}
在函数开头添加一些变量记录,其中之一必须返回 false
:
Added some logging of the variables at the start of the function as one of these must be returning 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
其中有:
Which creates the log file /var/log/email.log
which had:
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')
你可以修复管理员>系统>配置>高级>系统>邮件发送设置
并更改禁用电子邮件通信
到否
,所以电子邮件是 NOT 禁用。
So the problem was: !Mage::getStoreConfigFlag('system/smtp/disable')
which you can fix up in Admin > System > Configuration > Advanced > System > Mail Sending Settings
and change Disable Email Communications
to No
so the emails are NOT disabled.
现在可以使用:)
这篇关于magento不发出任何邮件,怎么调试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!