I was generating some html based e-mails and due to some changes I made in the text, my mail stopped being sent. I found that it was not liking some of the characters that were being placed in my generated emails. I tried some of the standard replacemnt methods, but found that the XML file was the issue. The Greater than(>) and less than (<) and the Amersand(&) and the apostrophe(') and the quote(") all have special meaning to XML and can cause these issues. Once I replaced the following characters in my email variable, my e-mails began to flow again. Here is a table of the characters and their XML representations that can be used for replacement:
Name | Character | XML replacement |
Ampersand | & | & |
Apostrophe | ' | ' |
Greater Than | >r | > |
Less than | < | < |
Quote | " | " |
This is by no means the complete list of replacements. This is only that characters that were needed by the calls to Java Mail that my program was using.
Tags: html, Web Design, XML