How to add CSS to HTML Email using CI email libary |
[eluser]CroNiX[/eluser]
If you are using <style> tags, some ISPs/email services strip them. Use inline styles and keep it simple (putting in <style> tags in the head of your document is NOT inline, doing them in Code: <a syle="color:green">the link</a> GMail is one of the email providers known to strip the <style> tags. http://stackoverflow.com/questions/72241...il-clients edit: had to misspell style within the code block or the forum strips it out
[eluser]Neoraj3.0[/eluser]
Actually I did try putting all my styles inline using this tool: http://templates.mailchimp.com/resources/inline-css/ But got the same result
[eluser]ivantcholakov[/eluser]
Maybe the mail sender service does not obey the setting ‘mailtype’ => ‘html’? Maybe it sends the message as plain text only? On a true mail client (Thinderbird, Live Mail, etc) check the source of the received message. Here is an example that I see correctly in Trunderbird (without the headers): Code: --b1_38996d61ccb9fd52e37b16c1fce774dc The message has plain-text version that I have created, html-version of the message (you should see something similar), and one attached image. Does your message source contain the header Content-Type: text/html; charset=xxxxx ?
[eluser]Neoraj3.0[/eluser]
Thanks ivan. Will have to get back to you at a later date with this css email problem. Apparently on the live site I am getting a new issue (which i posted in another forum post) about getting an error when the send email is clicked.: A PHP Error was encountered Severity: Warning Message: fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Connection timed out) Filename: libraries/Email.php Line Number: 1689 A PHP Error was encountered Severity: Warning Message: fwrite() expects parameter 1 to be resource, boolean given Filename: libraries/Email.php Line Number: 1846 A PHP Error was encountered Severity: Warning Message: fgets() expects parameter 1 to be resource, boolean given Filename: libraries/Email.php Line Number: 1869 On the localhost email sent the head tags have this: (Some strange '3D' in the code appeared): Code: <head> When I get the live email working again will then continue with this thread and send the head info for it.
[eluser]Neoraj3.0[/eluser]
This question I posted in the forum is regarding "How to add CSS to HTML Email using CI email libary." I finally got it to work by changing ‘protocol’ => ‘smtp’, to ‘protocol’ => ‘mail’ Obviously there are advantages to using smtp but if your priority is getting the css into the email by that means this post is SOLVED. Thanks for the help everyone. |
Welcome Guest, Not a member yet? Register Sign In |