login about faq

I have a question about CSS in HTML E-Mails. Is the a way to get the definition of a CSS Class within the HTML? E.g. if i download an email via IMAP, can I extract the CSS-Class defined within the Email over a Chilkat methode or property?

asked Apr 04 '17 at 08:52

chilkat's gravatar image

chilkat ♦♦

It's potentially possible in one of two ways, depending on where the CSS is located. There are two possibilities:

  1. The CSS may be located in a "related item" within the email. This is when the email is multipart/related, and images and potentially CSS files are contained in the related parts. The Email.NumRelatedItems property indicates how many related items exist, and there are various Email object methods for getting related items/data.
  2. The CSS may be embedded within the HTML. In that case, your program would need to get the HTML body, and then the job is to extract the CSS from the HTML. One way to do it is to first convert the HTML to XML. (The HTML may or may not already be valid XML. Converting ensures you have well-formed XML such that you can reliably work with it.) The next step would be to examine the XML and determine how to extract the CSS. The Chilkat.HtmlToXml class can be used to convert to XML.

answered Apr 04 '17 at 08:57

chilkat's gravatar image

chilkat ♦♦

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Apr 04 '17 at 08:52

Seen: 1,644 times

Last updated: Apr 04 '17 at 08:57

powered by OSQA