According to the Magento 1.9.1 release notes:

all Magento e-mails (including order confirmation and transactional) are now queued

However, I cannot see how any emails except the new order and order update emails are being queued.

In this answer you can see the only two places that appear to use the queue.

Am I missing something obvious that would have the queue instantiated for emails such as the contact form POST in Mage_Contacts_IndexController?

I cannot see anything, which makes me think the release notes are wrong, someone please show me the error of my ways?

I tested it on clean Magento 1.9.0.1 installation without setup cron job and it sent me a contact email. So it's not queue contact emails. And if you look at the code you will see the same:

Mage_Contacts_IndexController -> public function postAction() -> sendTransactional which calls:

Mage_Core_Model_Email_Template -> public function sendTransactional -> public function send -> $mail->send();.

On deeper level it calls Zend_Mail -> public function send -> $transport->send($this); -> Zend_Mail_Transport_Abstract -> public function send -> $this->_sendMail(); -> Zend_Mail_Transport_Sendmail -> public function _sendMail() which finally calls directly PHP mail() function:

    $result = mail(
        $this->recipients,
        $this->_mail->getSubject(),
        $this->body,
        $this->header);

In Magento 1.9.1.0 it's added

if ($this->hasQueue() && $this->getQueue() instanceof Mage_Core_Model_Email_Queue) {
...
$emailQueue->addMessageToQueue();

in Mage_Core_Model_Email_Template -> public function send which should be set in public function sendTransactional:

        if (is_numeric($templateId)) {
            $queue = $this->getQueue();
            $this->load($templateId);
            $this->setQueue($queue);
        }

but $templateId should be equal to contacts_email_email_template (by default) so it's not numeric. But if custom email template is chosen it will be numeric so maybe then the email will be queued but I didn't test it.

  • I think OP mentioned 1.9.1 release. – Joshua34 Jan 18 '15 at 14:04
  • I'm sorry but I don't have 1.9.1 installation (and I don't have time to install it) and I thought that there isn't much difference (but clearly I was wrong). I edited my answer but I didn't test it so some moderator can delete my answer if it's not useful. – michael Jan 18 '15 at 15:07
  • I think the is_numeric test is just to handle restoring the queue to the template object after loading a custom template. It still requires the Queue to have been already set, and I do not see anywhere that is happening except in the Order email sending functions. – Ashley Schroder Jan 18 '15 at 20:36

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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