I'd like to capture all email events in Magento before they're sent and prevent magento from sending them. I know I can disable all emails under system > mail sending settings, but this is not enough. I want to send data from that email to another system. Something like this:

  • Magento wants to send email
  • Some method captures the email
  • Same method prevents magento from sending the email
  • Same method sends data through api to another system

How can I achieve this?

1 Answer 1


I dont know about the enterprise edition but I am pretty sure that there is no event in ce

You can achieve this functionality by rewriting this classes

Mage_Core_Model_Email_Template and Mage_Core_Model_Email

In both class you find send method you need to rewrite the send method. as below

public function send($email, $name = null, array $variables = array())
   Mage::dispatchEvent('email_template_send_before', array('email' => $this, 'email_to' => $email));
   $return = parent::send($email, $name, $variables);
   Mage::dispatchEvent('email_template_send_after', array('email' => $this, 'email_to' => $email));
   return $return;

after rewrite this way now you have two events email_template_send_before and email_template_send_after

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.