Build a quick email template code

Build a quick email template by using below codes.

Just change the suject, logo and site URL

$to= “info@shakalya.com”;
$subject = “Inquiry shakalya.com”;
$msg =”<html><head><title>”.$subject.”</title></head><body style=’padding:50px 0px;background-color:#00688f;’>”;
$msg .= “<div style=’padding:10px;max-width:500px;border-radius:5px 5px 0px 0px;background-color:#ddd;border:solid thin #ccc;margin:0px auto;overflow:auto;’><img src='”.HTTPS_SERVER.”image/catalog/logo.png’ style=’height:50px;width:auto;float:right;’ /></div>”;
$msg .=”<div style=’padding:20px 10px;max-width:500px;border:solid thin #ccc;margin:0px auto;background-color:#fff;’>”;
$msg .=”Yoiur message goes here”;
$msg .=”</div>”;
$msg .= “<div style=’padding:10px;max-width:500px;border-radius:0px 0px 5px 5px;background-color:#ddd;border:solid thin #ccc;margin:0px auto;’>www.shakalya.com</div>”;
$msg .=”</body></html>”;
//echo $msg;

$headers = “MIME-Version: 1.0” . “\r\n”;
$headers .= “Content-type:text/html;charset=UTF-8” . “\r\n”;

// More headers
$headers .= ‘From: <info@shakalya.com>’ . “\r\n”;

mail($to,$subject,$msg, $headers);

 

If you want to add this in open cart i have a preset example for changing all the emails with this template.

Goto the system/library/mail.php

At line 128 .Just look for the

$message .= $this->html . PHP_EOL;

and change it with below.

$message .=”<html><head><title>”.$this->subject.”</title></head><body style=’padding:50px 0px;background-color:#00688f’>”;
$message .= “<div style=’padding:10px;max-width:700px;border-radius:5px 5px 0px 0px;background-color:#ddd;border:solid thin #ccc;margin:0px auto;overflow:auto;font-size:30px;font-size:30px;’><img src='”.HTTPS_SERVER.”image/catalog/logo.png’ style=’height:50px;width:auto;float:right;’ />”.$this->subject.”</div>”;
$message .=”<div style=’padding:20px 10px;max-width:700px;border:solid thin #ccc;margin:0px auto;background-color:#fff;’>”;
$message .= $this->html . PHP_EOL;
$message .=”</div>”;
$message .= “<div style=’padding:10px;max-width:700px;border-radius:0px 0px 5px 5px;background-color:#ddd;border:solid thin #ccc;margin:0px auto;’>”.HTTPS_SERVER.”</div>”;
$message .=”</body></html>”;

You have added a quick header and footer the the email template. Best of luck.

 

 

Leave a Comment