LemonStand Documentation

core:onSendEmail event

The core:onSendEmail event is triggered before LemonStand sends an email message. You can use this event to send email messages with third-party software or services. The event handler should accept a single parameter - the object containing information about the message to be sent. The object has the following fields:

  • content - the message content in HTML format,
  • reply_to - an array containing the reply-to address: array('sales@example.com'=>'Sales Department')
  • attachments - an array containing a list of paths to the attachment files
  • recipients - an array containing a list of recipients: array('demo@example.com'=>'Demo User')
  • from - email "from" email address
  • from_name -email "from" name
  • sender - email sender email address
  • subject - message subject
  • data - custom parameters which could be passed by the email sending code

The event handler should return TRUE in order to prevent the default message sending way. Example event handler:

public function subscribeEvents()
{
  Backend::$events->addEvent('core:onSendEmail', $this, 'send_email');
}

public function send_email($email_info)
{
  /*
   * Send the message using the external service
   */
  
  ...
  
  /*
   * Return TRUE to stop LemonStand from sending the message
   */
  
  return true;
}

Next: onDeleteEmailTemplate event
Previous: shop:onUpdateShippingQuote event
Return to Handling LemonStand events