1. Home
  2. Email Template Designer Pro
  3. Developer

Developer

This article is only for developers

If you are creating a custom extension and would like to use the email templates created using this extension, you can add the following code appropriately.

FOR CATALOG

$this->load->model('extension/module/email_builder'); //Load the model file once
$template_id = '1'; //Mention template ID

$template_data = $this->model_extension_module_email_builder->builtTemplate($template_id);
$to = 'yourstoreemail@store.com'; // Add sender email here         

$email_data = array(          
        'to'              => $to,             
        'from'            => $template_data['email_options']['sender_email'],
        'store_name'      => $template_data['email_options']['sender_name'],
        'email_replyto'   => $template_data['email_options']['email_replyto'],
        'subject'         => $template_data['email_options']['email_subject'],
        'content'         => $template_data['email_content'],
        'attachments'     => (isset($template_data['email_options']['email_attachments']))? $template_data['email_options']['email_attachments']: '',
        'bcc'             => $template_data['email_options']['email_bcc'],
        'template_id'     => $template_id,
        'store_id'        => $template_data['store_id'],
        'type'            => (isset($template_data['email_options']['email_type_id']))? $template_data['email_options']['email_type_id']: '0', //set email type id to categorize the email for your reference
        'cron'            => false //set to true if you want to enable cron mode
    );

$this->model_extension_module_email_builder->sendemail($email_data);

FOR ADMIN

$this->load->model('extension/hbapps/email_builder'); //Load the model file once
$template_id = '1'; //Mention template ID

$template_data = $this->model_extension_hbapps_email_builder->builtTemplate($template_id);
$to = 'yourstoreemail@store.com'; // Add sender email here         

$email_data = array(          
        'to'              => $to,             
        'from'            => $template_data['email_options']['sender_email'],
        'store_name'      => $template_data['email_options']['sender_name'],
        'email_replyto'   => $template_data['email_options']['email_replyto'],
        'subject'         => $template_data['email_options']['email_subject'],
        'content'         => $template_data['email_content'],
        'attachments'     => (isset($template_data['email_options']['email_attachments']))? $template_data['email_options']['email_attachments']: '',
        'bcc'             => $template_data['email_options']['email_bcc'],
        'template_id'     => $template_id,
        'store_id'        => $template_data['store_id'],
        'type'            => (isset($template_data['email_options']['email_type_id']))? $template_data['email_options']['email_type_id']: '0', //set email type id to categorize the email for your reference
        'cron'            => false //set to true if you want to enable cron mode
    );

$this->model_extension_hbapps_email_builder->sendemail($email_data);
Was this article helpful to you? Yes 2 No

How can we help?