SmtpPlus Forms for Magento Store Developers

SmtpPlus offers events that allow Store Developers to interact with the Email Sending Process:

Preparing Form Data

This event is called before a form is rendered, when preparing the form data. Using this event allows to add form data objects, the following data objects are added by default by SmtpPlus Forms:

  • customer representing current Customer Object as instance of Mage_Customer_Model_Customer
  • product representing a current Catalog Product Object as instance of Mage_Catalog_Model_Product
  • category representing a current Catalog Category as instance of Mage_Catalog_Model_Category


Event
  • smtpplus_forms_prepare_form


Description

Is triggered during form data preparation and before the form template is being processed and rendered.

Models passed to Observer

controller - The Controller Object of instance Pisc_SmtpplusForms_FormController

data - Current Form Data Object of instance Pisc_SmtpplusForms_Model_Event


Form Email Send (before)

This event is called before a form email is being sent. Using this event allows to interact before the form email (or confirmation email) is sent by SmtpPlus Forms.

Events
  • smtpplus_forms_email_send_before - for the Transactional Email of the Form
  • smtpplus_forms_confirmation_send_before - for the Transactional Email of a Confirmation message


Description

Is triggered before the transactional email of the form is sent.

Models passed to Observer

controller - The Controller Object of instance Pisc_SmtpplusForms_SubmitController

email - Current Email Object of instance Pisc_Smtpplusforms_Model_Email_Transactional

form - Current Form Data Object of instance Varien_Object

options - Current Form Options Object of instance Pisc_Smtpplusforms_Model_Form_Options\

Form Email Send (after)

This event is called after a form email is being sent. Using this event allows to interact after the form email (or confirmation email) is sent by SmtpPlus Forms.

Events
  • smtpplus_forms_email_send_after - for the Transactional Email of the Form
  • smtpplus_forms_confirmation_send_after - for the Transactional Email of a Confirmation message


Description

Is triggered after the transactional email of the form is sent.

Models passed to Observer

controller - The Controller Object of instance Pisc_SmtpplusForms_SubmitController

email - Current Email Object of instance Pisc_Smtpplusforms_Model_Email_Transactional

form - Current Form Data Object of instance Varien_Object

options - Current Form Options Object of instance Pisc_Smtpplusforms_Model_Form_Options

success - Boolean flag representing if form email has sent successfully (true) or failed to send (false).


To add your own Observer to the Events, you may use the following code examples as guideline:

Your Extensions [config.xml]

<global>
   <events>
      <smtpplus_forms_email_send_before>
         <observers>
            <yourobserver_event_email_before>
               <type>singleton</type>
               <class>Your_Extension_Model_Observer</class>
               <method>eventEmailProcessBefore</method>
            </yourobserver_event_email_before>
	 </observers>
      </smtpplus_forms_email_send_before>
   </events>
</global>


Your Extensions [Observer.php]

class Your_Extension_Model_Observer
{
 
  /*
   * Event before processing download
   */
  public function eventEmailProcessBefore($observer)
  {
  	$email = $observer->getEvent()->getEmail();
  	$form = $observer->getEvent()->getForm();
    	$options = $observer->getEvent()->getOptions();
 
  	// Do your own stuff with it here...
 
  }
 
}