Ils*_*lse 12 php debugging zend-framework magento zend-mail
Magento 不发送任何电子邮件,跨国,联系表格给出错误
cannot send your mail at this moment
Run Code Online (Sandbox Code Playgroud)
我检查了
/var/log/system.log和exception.log仅显示错误,而不是错误原因
exception 'Zend_Mail_Transport_Exception' with
message 'Unable to send mail. ' in
/var/webshop/httpdocs/lib/Zend/Mail/Transport/Sendmail.php:137
Kus*_*Kus 26
当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}
Run Code Online (Sandbox Code Playgroud)
所以打开/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;
}
Run Code Online (Sandbox Code Playgroud)
所以看看isValidForSend():
public function isValidForSend()
{
return !Mage::getStoreConfigFlag('system/smtp/disable')
&& $this->getSenderName()
&& $this->getSenderEmail()
&& $this->getTemplateSubject();
}
Run Code Online (Sandbox Code Playgroud)
在函数开头添加了一些变量记录,因为其中一个必须返回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');
Run Code Online (Sandbox Code Playgroud)
这会创建具有以下内容的日志文件/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}}'
Run Code Online (Sandbox Code Playgroud)
所以问题是:!Mage::getStoreConfigFlag('system/smtp/disable')您可以修改Admin > System > Configuration > Advanced > System > Mail Sending Settings并更改Disable Email Communications为,No因此不会禁用电子邮件.
现在它工作:)
Any php program can do a half-decent job of sending out some email with phpmail.
鉴于错误消息,您的 Magento 构建尝试执行的操作有所不同 - 通过 Zend 库使用 Sendmail。
您将需要构建并测试您的 sendmail 安装。或者使用其他邮件服务(例如 gmail)并让 Magento 使用它。
要测试是否是您、您的计算机或 Magento,请在其中安装一些其他程序,例如 Roundcube Mail。如果 Roundcube Mail 可以发送邮件,那么您就会知道 Sendmail 正在工作,如果不能,那么您就会知道问题出在 Sendmail 中。
修复 Sendmail 是特定于发行版的。
| 归档时间: |
|
| 查看次数: |
50782 次 |
| 最近记录: |