Transactional Emails – Fix Issue with Emails Sent to Client but Not Customers

checkoutemailpaymentsmtptransactional

When looking in the logs, I see
exception 'Exception' with message 'This letter cannot be sent.' in /var/www/app/code/core/Mage/Core/Model/Email/Template.php:398, which leads to:

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

Disable Email Communications is already set correctly. What else could it be? The user enters all of these details. We've been searching for hours.

Thanks in advance!

Edit: It turned out that the template subject was always returning null. After explicitly assigning the email templates in the back-end instead of using the defaults from the locale folder, it started working again. I still haven't been able to figure out just where it comes from, but it works.

Best Answer

Change the code for a moment to this:

public function isValidForSend()
{
    Mage::log('SenderName: ' . $this->getSenderName()
              . ' Sender Email: ' . $this->getSenderEmail() 
              . ' Template Subject: ' . $this->getTemplateSubject(),null,'email_issue.log');


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

Enable logging and after replicating the scenario check in var/log/email_issue.log.

Related Topic