In my code I use the MailMessage class of .Net to generate mails.
I have set msg.IsBodyHtml = true;. Still in the mail the CSS is not applied at all..
I want to hide some tags in mail. For that I have used Display property, But It doesn’t work…
What should I do?
You should not use a lot of CSS in your HTML emails. Currently most email clients do not have full support for CSS, most likely for security reasons. Take your case for example, it would not be wise for Outlook to allow someone to send me an email with hidden content in it. There’s too much room for malicious exploits that way.
For the best results, go a little old school with your HTML. Use table layouts, limit the amount of images, and use sparse amounts of CSS in inline styles only. In some cases, don’t be afraid to revert back to classic HTML tags for styling, such as
<table bgcolor="#F30FF0"></table>.