Send HTML Email Including CSS Style Sheet Via PHP
Solution 1:
Google, Outlook, Yahoo all the major email service providers do not allow CSS external files. It may sound antiquated that they have opted for inline styles and tables to render a proper email message with any styling.
It may be tedious to code but companies like https://litmus.com/ and envato will help with some templates and formatting issues.
my 2¢'s: email providers can't trust all sources of information being sent and so this is a way of keeping the malicious code at bay.
Solution 2:
It would be best to just put a <style>
block with all the CSS inside it somewhere in the index.html
body. Some email clients/portals cut all the CSS embedded in the header with <link rel="stylesheet" type="text/css" href="..." >
. As a result not using inline CSS may cause your emails to appear 'broken' or simply look bad on accounts with @gmail.com
for example.
Solution 3:
Within your index.html file, include a <style>
tag as below.
<style>
.class{
style: attribute;
}
</style>";
That should work, if not then I may recommend hosting your stylesheet on a website and including a <link>
tag similar to the one below in the head of your index file
<link rel='stylesheet' type='text/css' href='http://www.yourstylesheet.com'>";
Either of those methods should help with your problem.
Solution 4:
Just embed the css-code into the <head>
of that html-email.
Post a Comment for "Send HTML Email Including CSS Style Sheet Via PHP"