3

something strange is going on with my Magento install. Everything with the emails used to work fine, but now I have these messages in my exception.log:

2015-05-11T10:00:02+00:00 ERR (3):
exception 'Exception' with message 'This letter cannot be sent.' in /var/www/vhosts/lvps91-250-119-53.dedicated.hosteurope.de/httpdocs/magento/app/code/core/Mage/Core/Model/Email/Template.php:399
Stack trace:
#0 /var/www/vhosts/lvps91-250-119-53.dedicated.hosteurope.de/httpdocs/magento/app/code/community/Ebizmarts/Mandrill/Model/Email/Template.php(24): Mage_Core_Model_Email_Template->send('[email protected]', 'mysite', Array)
#1 /var/www/vhosts/lvps91-250-119-53.dedicated.hosteurope.de/httpdocs/magento/app/code/community/Hackathon/MageMonitoring/Model/WatchDog/UberDog.php(108): Ebizmarts_Mandrill_Model_Email_Template->send('[email protected]', 'mysite', Array)
#2 [internal function]: Hackathon_MageMonitoring_Model_WatchDog_UberDog->triggerActiveDogs(Object(Mage_Cron_Model_Schedule))
#3 /var/www/vhosts/lvps91-250-119-53.dedicated.hosteurope.de/httpdocs/magento/app/code/core/Mage/Cron/Model/Observer.php(325): call_user_func_array(Array, Array)
#4 /var/www/vhosts/lvps91-250-119-53.dedicated.hosteurope.de/httpdocs/magento/app/code/core/Mage/Cron/Model/Observer.php(72): Mage_Cron_Model_Observer->_processJob(Object(Mage_Cron_Model_Schedule), Object(Mage_Core_Model_Config_Element))
#5 /var/www/vhosts/lvps91-250-119-53.dedicated.hosteurope.de/httpdocs/magento/app/code/core/Mage/Core/Model/App.php(1338): Mage_Cron_Model_Observer->dispatch(Object(Varien_Event_Observer))
#6 /var/www/vhosts/lvps91-250-119-53.dedicated.hosteurope.de/httpdocs/magento/app/code/core/Mage/Core/Model/App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Cron_Model_Observer), 'dispatch', Object(Varien_Event_Observer))
#7 /var/www/vhosts/lvps91-250-119-53.dedicated.hosteurope.de/httpdocs/magento/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('default', Array)
#8 /var/www/vhosts/lvps91-250-119-53.dedicated.hosteurope.de/httpdocs/magento/cron.php(76): Mage::dispatchEvent('default')
#9 {main}

This is written to the log files every 5 minutes so I guess it must be the cronjob trying to send out mail and failing.

I tried tracking the problem and it was caused by this function in Template.php to return false:

$this->isValidForSend()

So following this advice I added this line to the function to figure out why it would return false. It just writes the results of isValidForSend to an email.log file.

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');

The results from email.log:

2015-05-11T08:35:02+00:00 DEBUG (7): true;'MACHIMA';'[email protected]';NULL
2015-05-11T08:40:02+00:00 DEBUG (7): true;'MACHIMA';'[email protected]';NULL
2015-05-11T08:45:02+00:00 DEBUG (7): true;'MACHIMA';'[email protected]';NULL
2015-05-11T08:50:02+00:00 DEBUG (7): true;'MACHIMA';'[email protected]';NULL

So everything seems to be ok, just the last NULL value which is returned by

$this->getTemplateSubject() 

causes the function to fail.

I checked the configuration about 10 times and don't find any emails that are being sent out and are missing a subject.

My thought now is that maybe there is an email stuck in a queque Magento keeps trying to send out every 5 minutes.

Is there a way to track down where this is coming from?

Thanks

1
  • 1
    Don't think its a problem with one email being stuck in queue as magento sends out emails in batches per cron run so if one emails fails in the batch the rest shouldn't be affected. Although it's certainly an unusual problem, if you have access to the database you can check the table core_email_queue to make sure. May 11, 2015 at 13:49

1 Answer 1

3

This is because one of your email template file is missing with subject. It would be good if you specify default subject to every email-template which you are using. You can specify subject in an email template like this :

File : app\locale\{en_US}\template\email\your-mail-template.phtml

<!--@subject Your Subject Goes Here! @-->

I hope this will resolve your issue.


[This answer is a part of #mageStackDay5. It is an event conducted by Magento Community members as part of increasing the question-answer ratio. For more information http://www.magestackday.com/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.