Let me know what code you have so far to send the email but here's an example.
1. Load template
2. Add data (can be used as shortcodes e.g {$foo})
3. Attach html template to mail object. Calling hook method to merge mail properties and sets html template.
4. Called after email is sent. Cleans up attachments and other sent tasks
1. Load template
Code: Select all
$this->load->model('extension/mail/template');
$load_data = array(
'emailtemplate_key' => 'order.customer',
'language_id' => $order_info['language_id'],
'store_id' => $order_info['store_id']
);
$template = $this->model_extension_mail_template->load($load_data);
Code: Select all
$template->data['foo'] = 'test';
// Or pass full array
$template->addData($data);
Code: Select all
$mail = new Mail();
$mail->setTo($order_info['email']);
$mail->setFrom($this->config->get('config_email'));
$mail->setSender($order_info['store_name']);
$mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
$mail->setText(html_entity_decode($text, ENT_QUOTES, 'UTF-8'));
$mail = $template->hook($mail);
$mail->send();
Code: Select all
$template->sent();
Can you tell me how i can fix this with this code ?
//$this->template = 'mailtemplates/product_email.html';
$mail = new Mail();
$mail->protocol = $this->config->get('config_mail_protocol');
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
$mail->smtp_username = $this->config->get('config_mail_smtp_username');
$mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
$mail->smtp_port = $this->config->get('config_mail_smtp_port');
$mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
$mail->setFrom($fromID);
$mail->setTo($product_info['customer_email']);
$mail->setSender($store_name);
$mail->setSubject("product from " .$order_info['store_name']. " - Ref : ".$invoice_no);
$mail->setHtml($this->load->view('mailtemplates/product', $data));
$mail->send();
//$this->template = 'mailtemplates/product_email.html';
$mail = new Mail();
$mail->protocol = $this->config->get('config_mail_protocol');
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
$mail->smtp_username = $this->config->get('config_mail_smtp_username');
$mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
$mail->smtp_port = $this->config->get('config_mail_smtp_port');
$mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
$mail->setFrom($fromID);
$mail->setTo($product_info['customer_email']);
$mail->setSender($store_name);
$mail->setSubject("product from " .$order_info['store_name']. " - Ref : ".$invoice_no);
$mail->setHtml($this->load->view('mailtemplates/product', $data));
$mail->send();
See below example. Please open support ticket if you need support with this.
Code: Select all
$this->load->model('extension/mail/template');
// Load email template
$load_data = array(
'emailtemplate_key' => 'order.customer',
'language_id' => $order_info['language_id'],
'store_id' => $order_info['store_id']
);
$template = $this->model_extension_mail_template->load($load_data);
// Optional add data
$template->data['foo'] = 'test';
// Or pass full array
$template->addData($data);
$mail = new Mail();
$mail->protocol = $this->config->get('config_mail_protocol');
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
$mail->smtp_username = $this->config->get('config_mail_smtp_username');
$mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
$mail->smtp_port = $this->config->get('config_mail_smtp_port');
$mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');
$mail->setFrom($fromID);
$mail->setTo($product_info['customer_email']);
$mail->setSender($store_name);
$mail->setSubject("product from " .$order_info['store_name']. " - Ref : ".$invoice_no);
//$mail->setHtml($this->load->view('mailtemplates/product', $data));
// Merge template and mail settings.
$mail = $template->hook($mail);
// Optional wrap text inside email template
$html = $template->fetch(null, $this->load->view('mailtemplates/product', $data));
$mail->setHtml($html);
$mail->send();
$template->sent();
Advanced Professional Email Template
Customers Pre-Sale. Inc abandoned cart email
Order Follow-Up Email. Inc request review
Email Validation with ZeroBounce
Who is online
Users browsing this forum: No registered users and 53 guests