1

I've been working, for a bit now, on an addition (to success.phtml) to abort emails that are being sent to one particular domain, upon a successful sale. This is due to the aforementioned specific sales coming from an external referral, and the referrer wanting to handle the email contact with the end consumer exclusively. The system that I am trying to implement this on is a Magento 1.9.x CE instance, utilizing (as mentioned in the question title) Aschroder's SMTPPro for email.

Now that I've successfully tied into the aschroder_smtppro_template_before_send event, and managed to learn to traverse the order's data structure enough to determine whether or not the email is going to the specified domain, I'm at a bit of a loss for how to go about aborting the email, while continuing on to a successful sale.

I would be very grateful for any pointers to some good information on methods that I might utilize in order to accomplish this. Personal experience, any ideas that might be helpful are very much appreciated. I'm having a very difficult time digging up much useful documentation on this.

Thanks for your time and consideration.

-Damon

1

I had to do the same. It is not nice, but my solution looks like this:

public function controllerActionPredispatchAdminhtmlSalesOrderEditSave()
{
    foreach (Mage::app()->getStores(true) as $code => $store) {
        $store->setConfig('sales_email/order/enabled', false);
    }
}

I'm just supressing the order email by deactivating it. The problem is, there is no event or anything we can hook into to do it.

The alternative is to rewrite classes.

The problem with this solution of course is, that you need to check before anything happens (especially before any controller is called) whether you want to mail or not.

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.