Unable to send HTML mail using opencart -
i trying send html mail using opencart using following code
$mail = new mail(); $namess = $this->request->post['name']; $emailss = $this->request->post['email']; $phoness = $this->request->post['phone']; $phoness2 = $this->request->post['phone2']; $enquiryss = $this->request->post['enquiry']; $conve = $this->request->post['contactviae']; $convp = $this->request->post['contactviap']; if($conve == '1') { $convee = "yes"; } else { $convee = "no"; } if($convp == '1') { $convpp = "yes"; } else { $convpp = "no"; } $body = "hello admin <br/><br/> have recieved request product. details product follow : <br/><br/> <table border='1'> <tr><td>name</td><td>$namess</td></tr> <tr><td>email</td><td>$emailss</td></tr> <tr><td>phone no</td><td>$phoness</td></tr> <tr><td>secondary phone</td><td>$phoness2</td></tr> <tr><td>enquiry</td><td>$enquiryss</td></tr> <tr><td>contact via email</td><td>$convee</td></tr> <tr><td>contact via phone</td><td>$convpp</td></tr> </table><br/><br/> & regards "; $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->setto($this->config->get('config_email')); $mail->setfrom($this->request->post['email']); $mail->setsender(html_entity_decode($this->request->post['name'], ent_quotes, 'utf-8')); $mail->setsubject("request product"); $mail->sethtml($body); //$mail->settext(html_entity_decode($body, ent_quotes, 'utf-8')); $mail->send();
when trying use code sending mail html tags
how can send html mail above code?
$body = "hello admin <br/><br/> have recieved request product. details product follow :" . "<br/><br/>" . "<table border='1'>" . "<tr><td>name</td><td>$namess</td></tr>" . "<tr><td>email</td><td>$emailss</td></tr>" . "<tr><td>phone no</td><td>$phoness</td></tr>" . "<tr><td>secondary phone</td><td>$phoness2</td></tr>" . "<tr><td>enquiry</td><td>$enquiryss</td></tr>" . "<tr><td>contact via email</td><td>$convee</td></tr>" . "<tr><td>contact via phone</td><td>$convpp</td></tr>" . "</table><br/><br/>" . "thanks & regards";
use above code define html code value.
Comments
Post a Comment