Remember an issue with HTML-formatted mail

Source: Internet
Author: User

Early to do an automatic e-mail program, has always been found that the notes after the upgrade instead of CSS styles are not.

At first, the format of data in the, the customer did not say anything, and later felt such an attitude is not good, small holes do not fill, big hole hardship.

So check the data, found that the browser shows that the normal CSS in the mail client may not be normal display, it seems I recruit.

e-mail program about seven, only one CSS style is normal, so take it and the other six contrast. Combined with online data, it is found to be caused by the following reasons:

1. The HTML code in the message does not support the short CSS format and requires a line of writing.

2. The HTML code in the message does not support the TR style, if the interval color is required, the emphasis color needs to be set to TD.

After the modification, the new style was born:

Sb.append ("<style type=\" text/css\ ">"); Sb.append ("Body {"); Sb.append ("Margin:5px auto;"); Sb.append ("Font-family:arial;"); Sb.append ("FONT-SIZE:14PX;"); Sb.append ("Color: #444;"); Sb.append ("}"); Sb.append ("Table{"); Sb.append ("margin:0px;"); Sb.append ("Text-align:left;"); Sb.append ("} "); Sb.append ("Table caption{"); Sb.append ("Text-align:center;"); Sb.append ("} "); Sb.append ("Table th{"); Sb.append ("Background-color: #989898;"); Sb.append ("Color: #ffffff;"); Sb.append ("Text-align:center;"); Sb.append ("Padding:7px 10px;"); Sb.append ("Border-bottom:solid 1px #d2d1cb;"); Sb.append ("}"); Sb.append ("Table TR td{"); Sb.append ("Background: #fbfcfc; "); Sb.append ("Border-bottom:solid 1px #e0e0e0;"); Sb.append ("Padding:8px 10px;"); Sb.append ("}"); Sb.append ("Table TR td.odd{"); Sb.append ("Background: #f8f8f8;"); Sb.append ("}"); Sb.append ("Table TR td.aqua{"); Sb.append ("Background: #ccffcc;"); Sb.append ("}"); Sb.append ("Table TR td.error{"); Sb.append ("Background: #fdbf9a;"); Sb.append ("}"); Sb.append ("</style>");

The display effect is much worse than the version of the subscription that was debugged in the Web page, but the one in notes has no style like plain text, which is consistent in notes and Web pages.

Remember an issue with HTML-formatted mail

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.