Send order email from admin not working in Magento 1.8

James picture James · May 13, 2014 · Viewed 8.4k times · Source

After upgrading my site from 1.4 to 1.8 I am unable to send order email from the admin panel.

When a new order is placed the customer receives the order email, but when I try to re-send the order email from the admin panel The order email has been sent message displays but neither the customer nor the admin gets the email.

I switched on logging and tried sending the order email, but nothing logs. Has anyone experienced this issue or found any solutions?

Answer

ScarletRed picture ScarletRed · May 15, 2014

Just been looking into this myself. I've followed the code and functions back to this function "public function sendNewOrderEmail()" in:

app/code/core/Mage/Sales/Model/Order.php

starting at line 1270 is the following code:

$emailSentAttributeValue = $this->load($this->getId())->getData('email_sent');
    $this->setEmailSent((bool)$emailSentAttributeValue);
    if ($this->getEmailSent()) {
        return $this;
    }

This is checking the sales_flat_order db table to see if the email has already been sent to the customer and if so just to return, but this does not send the email and should throw an error. So I would say it is a bug somewhere. To fix it so you can resend order/invoice emails etc..

Copy

app/code/core/Mage/Sales/Model/Order.php

to

app/code/local/Mage/Sales/Model/Order.php

and comment out line 1273

if ($this->getEmailSent()) {
            //return $this;
        }

Works a charm for me. But literally only this second tested it.

Tested using ver. 1.8.1