When I try to send an HTML email using the PHPMailer library, the received email shows incorrectly.
I have already tried with different mail clients (Gmail and Outlook), but they look very the same.
This is my current code
require_once 'includes/mail-denied.php'; // Here is specified the $message variable, containing the HTML and CSS (https://i.imgur.com/UG1B34V.png)
$keys = array('{{ server_name }}', '{{ player_name }}', '{{ reason_area }}', '{{ date }}');
$_POST['description'] = nl2br($_POST['description']);
$replace = array($servernam, $name, $_POST['description'], date("Y"));
$message = str_replace($keys, $replace, $message);
$mail_manager = new PHPMailer(true);
try {
$mail_manager->SMTPDebug = 2;
$mail_manager->setFrom('noreply#'.$_SERVER['HTTP_HOST'], $servernam);
$mail_manager->addAddress($mail);
$mail_manager->addReplyTo('noreply#'.$_SERVER['HTTP_HOST'], 'Do not reply');
$mail_manager->isHTML(true);
$mail_manager->Subject = "Staff Application System - ".$servernam;
$mail_manager->Body = $message;
$mail_manager->AltBody = 'Your application has been declined.';
$mail_manager->send();
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail_manager->ErrorInfo}";
I do receive the email, but part of the HTML looks just messed up.
Here's the HTML code:
<?php
$message = '
<div style="width: 500px;
height: 110px;
position: fixed;
background-color: #ff9999;
border-bottom: 1px solid #ff8080;
display: block;
border-top-left-radius: .5em;
border-top-right-radius: .5em;
color: #FFF;
text-align: center;
font-family: \'Product Sans\', Arial, sans-serif;">
<h2>Staff System Application</h2>
<h3>{{ server_name }}</h3>
</div>
<div style="width: 500px;
height: 600px;
background-color: #f2f2f2;
display: block;
padding-top: -10px;
z-index: 999;
border-radius: .5em;
font-family: \'Product Sans\', Arial, sans-serif;">
<div style="padding: 120px 15px 5px 15px;
color: #797979;
font-family: \'Product Sans\', Arial, sans-serif;">
<p>Dear {{ player_name }}...</p>
<p>After carefully considering your staff application the head staff have acquired a verdict.</p>
<p>We regret to inform you that your application has been:</p>
<p style="color: #C60000; font-size: 80px; text-align: center; margin-top: 10px;">DENIED</p>
<div style="margin-top: -55px; font-size: 15px;">
<p>You have been denied for the next reason(s):</p>
{{ reason_area }}
</div>
<br>
<br>
<p style="text-align: center; padding-bottom: -15px;">THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.</p>
</div>
</div>
<div style="margin-top: -10px;
width: 500px;
height: 90px;
position: fixed;
display: block;
background-color: #595959;
border-bottom-left-radius: .5em;
border-bottom-right-radius: .5em;
text-align: center;
font-family: \'Product Sans\', Arial, sans-serif;
color: #edeff2;">
<p style="font-size: 20px;">© {{ server_name }} - {{ date }}</p>
<p style="font-size: 9px;">© {{ date }} Carinae Studios. All rights reserved.</p>
</div>';
?>
This is how it should look like:
And this is how it looks when I receive the email:
I'm pretty new with HTML inside emails, I have no idea how this could be fixed.
Here are a few suggestions for what I've gathered from your information:
Like I said in the comments, use tables as much as possible.
Avoid classes and use inline styles. Add the font style to your td's as well as any html element inside of your td. Use the font or span tag instead of the p tag.
An example:
<td style="font-family:Arial; font-size:18px;">
<font style="font-family:Arial; font-size: 18px">Text here</font>
</td>
Don't use paddings and margins and floats, use heights and withds to create spacings. You can even use transparent images to create spacings:
<tr>
<td width="10" style="10px"></td> <!-- vertical spacing to create left/right margins -->
<td><img src="full-image.jpg" alt="your visible image here"></td>
<td width="10" style="10px"></td> <!-- vertical spacing to create left/right margins -->
</tr>
<!-- horizontal spacing to create top/bottom margins START -->
<tr height="50" style="height:50px;">
<td height="50" width="10" style="height: 50; width: 10px"></td>
<td height="50"><img height="50" style="height: 50px;" src="transparent.png" alt="this is a transparent image"></td>
<td height="50" width="10" style="height: 50; width: 10px"></td>
</tr>
<!-- horizontal spacing to create top/bottom margins END -->
<tr>
<td width="10" style="10px"></td> <!-- vertical spacing to create left/right margins -->
<td><img src="full-image.jpg" alt="your visible image here"></td>
<td width="10" style="10px"></td> <!-- vertical spacing to create left/right margins -->
</tr>
Other tips:
Avoid using css border-radius, use images instead
Use websafe fonts, use google to find which ones are websafe
Reference your images with CDN's
Litmus has free templates that you can use to base your code off of, they are guaranteed to work within any client/device.
I hope this helps. Let me know if you still have questions.
Be aware, Outlook uses Word for rendering emails. You can read more about supported and unsupported HTML elements, attributes, and cascading style sheets properties in the following articles:
Word 2007 HTML and CSS Rendering Capabilities in Outlook 2007 (Part 1 of 2)
Word 2007 HTML and CSS Rendering Capabilities in Outlook 2007 (Part 2 of 2)
Related
$email = "***EMAIL RECIEVED***";
include_once "PHPMailer/PHPMailer.php";
$mail = new PHPMailer();
$mail->setFrom('***EMAIL FROM***');
$mail->addAddress($email);
$mail->Subject = "MyWhiteCard Coupon Claimed!";
$mail->isHTML(true);
$mail->Body =
"<body style='background-color: #fbedde; width:800px; text-align: center; margin-left: auto; margin-right: auto;'>
<img src='cid:logo' width='40%' style='margin-left: auto; margin-right: auto; padding-top: 20px;'>
<h1 style='color: #00a6a6; letter-spacing: 2px; margin-bottom: 0px; font-family: 'brandon_black';'>COUPON CLAIMED</h1>
<div style='padding-top:30px; width: 400px;float:left;'>
<img src='cid:coupon' width='85%' style='padding-left: auto; padding-right: auto; margin-bottom: 65px; border-radius: 2% !important; box-shadow: 0 2px 8px 0 rgba(0,0,0,0.2);'>
</div>
<div style='padding-top: 15px; padding-bottom: 33px; width: 400px; float: left; text-align: left; color: #00a6a6'>
<h3 style='font-weight: bold;'>Claimed By:</h3>
<h2 style='letter-spacing: 1px; font-family: 'brandon_black';'>$usr_fname $usr_lname</h2>
<h3 style='font-weight: bold;'>$usr_contact</h3>
<h3 style='font-weight: bold;'>$usr_member</h3><br>
<h3>Please proceed to</h3>
<a href='https://www.mywhitecard.ph/cms' style='color: #00a6a6; text-decoration: underline;'>https://www.mywhitecard.ph/cms</a>
<h3>for scheduling of member.</h3>
</div>
</body>";
$mail->AddEmbeddedImage(dirname(__FILE__) . '***IMG LINK***','logo');
$mail->AddEmbeddedImage(dirname(__FILE__) . '***IMG LINK***','coupon');
$mail->send();
First of all I had to add all css in style="" because I am sending this via PHP email. My issue is I have a body tag with a background color, but my two other div tags inside does not color them. How come this is happening?
You have both of those elements floated, so they do not affect the height of their ancestors any more.
In a normal HTML page that would not lead to the effect you are seeing, because there is some built-in “magic” that lets the body element background grow to the full viewport height, if the html element does not have any background color of its own, but in the context where your mail gets displayed later on, that might be different.
So apply a clearfix to get body to contain those two elements.
I am using PHP to call data from a Microsoft SQL Database. That functionality is working, however when PHP updates the table's data it is overriding some of the formatting. One big specification I wanted was to have a max-height of 400px and once it crosses that the table becomes scroll-able.
Some context: I am running this on a local PHP server.
I have tried adding !important tags but that did not work.
<table id = 'tbl' class='table'>
<thead id = 'heading'>
<tr>
<td scope="col" >Applicant ▼</td>
<td scope="col">Grantee EIN</td>
<td scope="col">State</td>
<td scope="col">FAC Accepted Date</td>
<td scope="col">Expenditures</td>
<td scope="col">Prior Finding</td>
<td scope="col">Audit</td>
</tr>
</thead>
<div id = 'scrollbody'>
<tbody>
<?php
$result = array();
do {
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)){
echo '
<tr>
<td>'.$row["AUDITEENAME"].'</td>
<td>'.$row["EIN"].'</td>
<td>'.$row["STATE"].'</td>
<td>'.$row["FACACCEPTEDDATE"].'</td>
<td>'.$row["TOTFEDEXPEND"].'</td>
<td>'.$row["PYSCHEDULE"].'</td>
<td><input type="checkbox" oninput=""></td>
</tr>
';
}
} while (sqlsrv_next_result($stmt));
// sqlsrv_free_stmt($stmt);
// sqlsrv_close($conn); //Close the connnectiokn first
// echo json_encode($result); //You will get the encoded array variable
?>
</tbody>
</div>
</table>
#tbl {
margin: auto;
top: 0px;
height: 100%;
max-height: 400px;
position: relative;
font-family: 'Segoe UI';
box-shadow: 0px 0px 5px 2px rgb(240, 240, 240);
perspective: 1px;
border-radius: 0px 0px 20px 20px;
white-space: nowrap;
width: 100%;
z-index: 1;
}
What I want to see is a table of 400px height, but instead a table of much longer height is being displayed.
So, there are 2 options:
Wrap the table in with a wrapper and give the max-height to that element.
<div id="table-wrapper">
<table>
{Your stuff...}
</table>
</div>
Give the thead, tbody a display: block property. With which again your CSS styles will come into use.
First you need to know how a browser works.
The browser will not show anything until this steps are made:
Your browser request a file like html or php first.
Then it will check the styling (CSS/SCSS).
Checking for JavaScript.
checking for source like an image or other media.
Only then it will display the page.
So if you want to style after this process, you will need JavaScript.
JavaScript is invented to manipulate or modify the DOM (document object Model).
That means, you can point to an element and style it, remove it, add a new element etc.
For a better format I prefer jQuery.
jQuery is another way to code JavaScript. (jQuery = JavaScript, just in another form) jQuery calls the JS library.
you can't set header of a table, a table height is based on his content, if you need a table with a specific height you need to change the display type and add overflow rule:
#tbl {
margin: auto;
top: 0px;
height: 100px;
max-height: 400px;
position: relative;
font-family: 'Segoe UI';
box-shadow: 0px 0px 5px 2px rgb(240, 240, 240);
perspective: 1px;
border-radius: 0px 0px 20px 20px;
white-space: nowrap;
width: 100%;
z-index: 1;
display:block;
overflow:auto;
}
Here a live fiddle https://jsfiddle.net/g7fuLhyp/
I have created a code which works in the email client as follows:
<html>
<head>
<title>PLEASE REPLY USING THE BUTTONS</title>
</head>
<body>
<table cellspacing="5" cellpadding="5" border:5px;>
<tr>
<td align="center" width="200" height="40" bgcolor="#000091" style="-webkit- border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; color: #ffffff; display: block;" >
<span style="color: #FFFFFF">ATTENDING</span>
</td>
<td height="10"></td>
<td align="center" width="200" height="40" bgcolor="#000091" style="-webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; color: #ffffff; display: block;">
<span style="color: #FFFFFF">ATTENDING AND DINING</span>
</td>
<td height="10"></td>
<td align="center" width="200" height="40" bgcolor="#000091" style="-webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; color: #ffffff; display: block;">
<span style="color: #FFFFFF">APOLOGIES</span>
</td>
</tr>
</table>
</body>
</html>
Now amended to include html, header, body. It works in a web page and works in an email client.
But placing this into the body text in php-mailer ignores it completely.
How can I ensure that these buttons appear in the mailed text.
I do not understand the response with Yii:: as the page simply jams up.
Is there any easier way to get the html into the page?
Thanks for your assistance
CRG
use setHtmlBody in your code
public function sendEmail($email)
{
return Yii::$app->mailer->compose()
->setTo($email)
->setFrom([$this->email => $this->name])
->setSubject('text')
->setHtmlBody($this->body)
->send();
}
Email html differs greatly from normal html, for various reasons, security being one of them. Many email clients ignore the mailto link completely, implement it poorly, or show a warning to the user.
It is better to avoid it. You could use a form inside you email, or on your website, to allow users to send you a message.
Ref: https://www.campaignmonitor.com/blog/email-marketing/2013/06/tip-avoid-using-mailto-links-in-html-email/
I'm working with osCommerce for the first time. I inherited this code, and we'd like to tighten up the new_products page. This is the code for the display:
div class="contentText">
<div class="NewProductsList">
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td style="border-bottom:solid 1px #ccc;">
<div class="outer">
<div id="x">
<img src="images/swords-sandals.jpg" alt="Swords, Sandals and Sirens" title="Swords, Sandals and Sirens" width="120" height="180" />
<span class="name-font">
Swords, Sandals and Sirens
</span>
<span class="price-font">$19.00</span>
<br /><br />
Murder, conmen, elephants. Who knew ancient times could be such fun?
<br /><br />
Many of the stories feature Claudia Seferius, the
...read more
</div>
</div>
Then this is my stylesheet (css) code:
<style>
.price-font {
float: right;
color: #000000;
font-size: 18px;
}
.name-font {
font-size: 14px;
font-weight: bolder;
}
.outer {
padding: 10px;
}
#x {
display: inline-block;
}
#y {
width: 82%;
vertical-align: top;
display: inline-block;
}
.NewProductsList tr.alt td #x {
float: right;
}
.NewProductsList tr.alt td {
background-color: #ecf6fc;
}
Any help I could get for tightening up the text so that it's directly next to the image, rather than under it, would be greatly appreciated.
Thanks!
Try adding this to your CSS:
#x > a {
float: left;
}
JSFiddle: https://jsfiddle.net/suomyone/h2j013dx/
Basically, this targets the product link (and image, in this case) and floats it to the left. As a result, the product title and description moves up, right next to the image. You'll have to play around with the margins or paddings to achieve the desired spacing between the image and text.
Was this the effect you were looking to get?
Ps. Your HTML is missing some closing tags, specifically </td>, </tr>, </table>, and two </div> tags. I added these to the JSFiddle demo.
I am generating a pdf using DOMPDF but in that the image is not displaying instead it is throwing an error "Image not found".
Here is my code :
require_once "dompdf_config.inc.php";
require_once('html2_pdf_lib/html2pdf.class.php');
include_once('../config.php');
$file = "www/test/mytest.php";
$html=file_get_contents($file);
$dompdf = new DOMPDF();
//$dompdf->load_html($my_html);
$dompdf->load_html_file('https://www.lettertowomen.com/admin/dompdf/www/test/mytest.php?id=111');
$dompdf->render();
$dompdf->stream("sample.pdf");
mytest.php
<body>
<form action="" method="POST">
<table width="1000" height="1000" style="background-color: #b91781;font-family: 'DejaVuSerif'; color: #ffffff;font-size: 20px;">
<tbody><tr>
<td width="249" valign="middle" align="center">
<div style="height: 595; width: 249; text-align: left;padding-top:140px;">
<img src="<?php echo base_url;?>uploads/<?php echo $result['image'];?>" style="border-radius: 159px;
width: 159px; height:225px;margin:70px auto 0;">
</div>
</td>
<td width="583" valign="middle" align="center">
<div style="height: 188px; width: 448px; text-align: left;">
<span style="display: block;
float: left;">To <span style="font-size: 22px; font-weight: 700; line-height: 34px; position: relative; top: 17px;"><?php echo $result['recipient_name'];?></span>
</span><br><br>
<div style="clear: both; display: inline-block; min-height: 160px; padding: 0px 18px; margin: 28px auto 0px;color: #ffffff">From the day you were born,<br>
I fell in love with you my girl.<br>
And when you bloomed like a rose without a single thorn,<br>
You turned my entire life into a most precious pearl.<br>
Your love and care for me is a beautiful dawn,<br>
That marks the end of darkness left to unfurl.<br><br>
Feeling blessed to have you as my daughter. </div>
<br><br>
<span style="display: block;
float: right;">From<span style="font-size: 22px; font-weight: 700; line-height: 34px; position: relative; top: 18px;"><?php echo $result['sender_name'];?></span>
</span></div>
</td>
</tr>
</tbody></table>
</form>
</body>
</html>
everything is displaying but image is not displayed. I have check already asked question in stackoverflow : dompdf not displaying image generated by PHP file but it is not working in my case
Also I have set DOMPDF_ENABLE_REMOTE = true
Thanks in advance
You can use Base64 image data
$html = '<div>
<p>IMAGE</p>
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAABMCAIAAACnG28HAAAABmJLR0QA/wD/AP%2BgvaeTAAAACXBIWXMAAAsTAAALEwEAmpw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$dompdf = new DOMPDF ();
$dompdf->load_html ($html);
$dompdf->render ();
$dompdf->stream ("Test.pdf", array ("Attachment" => false));
Get the image from php in base64:
//getIMG.php?data=1&id=123
if ($data == 1) {
echo "data:image/".$adj->type.";base64,"
.str_replace ("\n", "", base64_encode ($adj->imageBinary));
}
For showing the image, you have to go to your dompdf source file like
..dompdf\src\Image\Cache.php
In the Cache.php file, you will search .... and make chrootValid true.. by default it will be false.
$chrootValid = true;
save it and try now...
Hope it will work