Adding CSS to Emails?

jayarajantony
Giga Contributor

We are looking for adding CSS (Adding a arrow shapes to showcase the state) in the Email we designed. We had used mail scripts and script include which are called from Email Notification.(Email notification calls mail script, Mail script calls the function in script include which returns html content of the mail design) . In script include we get style tag and its content(populated from local style sheets) and returning it to notification but it is not reflecting properly.

 

Is there any way to add CSS to Email notifications? or Is there any way to add style tag or head tag to notification.

 

Note: We have also used email templates   where CSS worked but for few browsers(IE8,9 ,chrome). it comments the style tag and the CSS is not working as expected.

25 REPLIES 25

Hi Jayaraj,



                                  You can write below code in mail script it will work for in your case.


                                  Here i'm attaching image which i got result in demo.



Regards,


Harish.Mailscript css.png


Hi Jayaraj,



                    Here im giving the code pf mail_script.



<mail_script>




template.print('<TABLE><TR bgcolor=#C0C0C0><TH>Number</TH><TH>Priority</TH><TH><font size=6><img src=images/icons/attachment.gifx>Status</img></font></TH></TR>');


template.print('</TABLE>');




</mail_script>



Hi Harish,


Thanks for your reply.



Actually we have a restriction not to use images in the mail design. Thats why we had selected the CSS to create the shape.



Is there any way to draw a arrow like shape?


Let me confirm one thing ,


Do you need to create Arrow symbol in mail script by using CSS ?


Hi Harish,


Thanks for your reply.



yes, We are trying to create an Arrow shape by Mail scripts. Email notification will call mail script and mail script calls function in Script Include. The function returns the body content. Now we had added one more function to return the <style> tag content and it is drawing the shape in Chrome and IE 9. i.e Style tag isd getting set in only IE 9 and chrome. But not in IE 8 and higher versions.



Please let us know if you have any other way to draw the shape



Thanks.