0

I was having an issue with capturing PayPal IPN messages, but I have fixed that and the Complete message is getting picked up by my store and changes the status of the order to Processing.

At this point I would expect the New Order email to be sent to us so that we can ship the order and to the customer as confirmation of the order. But these emails never get attempted to get sent. I don't know if the order status should be sent to something else to trigger the New Order email, but I can't even manually change the order status, the only option in the drop down is Processing.

I can go in to the order and click the Send Email button and this does add a row to the core_email_queue table, which doesn't send. I have set up SMTP Pro by ASchroder for emails so I would expect to go through it's queue (smtppro_email_log), password resets, customer register emails do go through the correct queue and get sent correctly. I don't know why the New Order email would get pushed through the other queue.

But this is a side issue, the New Order email should go out as soon as the payment confirmation comes back from PayPal, but it does get added to any queue. Should the order status get changed to Processing? Should this trigger the New Order email? Should I be able to manually change the status? Should the SMTP Pro module override all email queues and all email go through it?

1

You can send email by using observer event checkout_onepage_controller_success_action

class Ketan_Paypal_Model_Observer {
    public function sendOrderEmail($observer) {
        $order = new Mage_Sales_Model_Order();
        $incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
        $order->loadByIncrementId($incrementId);
        if($order->getPayment()->getMethodInstance()->getCode()=="paypal_express"){
            //Do your logic here,add more paypal methods for restriction
            try {
                $order->sendNewOrderEmail(); //if getIsCustomerNotified() false
            } catch (Exception $e) {
                Mage::logException($e);
            }
        }
    }
}
0

First of all, make sure in SMTP Pro under the "Queue Configuration" section that Queue Usage is set to Never.

Secondly, I'd recommend modifying app/code/core/mage/sales/model/order.php::queueNewOrderEmail (should be line 1358)

Change;

$mailer->setQueue($emailQueue)->send();

To;

$mailer->send();

Finally, I'd recommend downloading AoE_Scheduler so you can ensure cron is configured properly and emails are being sent out (although doing the above overrides this anyway)

https://github.com/AOEpeople/Aoe_Scheduler

  • The "Queue Usage" is already set to Never. I changed the code but no email is queued or sent for this order. – anothershrubery Aug 1 at 1:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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