Reputation: 1
I have used an email template as a single page html with style (css) embedded to it and I can display all of the styles including font and images properly on the html page. However, the font and image styles cannot be applied to the Outlook messages when I use this template for sending e-mail in my C# application (test version of Windows Service). What I have tried to do so far:
Added the font file (ttf) to the same directory of my email template as in the example (it is the same directory as html file).
Embedded image (base64) to the html file as shown below:
Tried to use font with url as shown below:
https://fonts.googleapis.com/css?family=Source+Sans+Pro' rel='stylesheet' type='text/css'>
But none of them make any sense and the image sannot be displayed on the e-mail sent by this template. In addition to this, font type is not the same as on the html file (SourceSansPro).
Any idea to embed the font to the html file and display font and image properly on the outlook message created by this template??? Please note that I use *.txt file as template, but the code in it exactly html and can be displayed properly...
Upvotes: 0
Views: 1175
Reputation: 121
As for the fonts, there is one single and a very simple solution that works. Just wrap the content inside the deprecated font element!
<font face="Verdana">
<!-- content -->
</font>
Upvotes: 0
Reputation: 336
Try to insert this code for custom fonts and images in the email template:
<style type="text/css">
@media screen {
@font-face {
font-family: 'Lato';
font-style: normal;
font-weight: 400;
src: local('Lato Regular'), local('Lato-Regular'), url(https://fonts.gstatic.com/s/lato/v11/qIIYRU-oROkIk8vfvxw6QvesZW2xOQ-xsNqO47m55DA.woff) format('woff');
}
...
body {
font-family: "Lato", "Lucida Grande", "Lucida Sans Unicode", Tahoma, Sans-Serif;
}
</style>
<html>
<head>
</head>
<body>
<img src="data:image/jpg;base64,/*base64-data-string here*/" />
</body>
</html>
Upvotes: 1