Multipart Encoding Problem
Posted on 2004-08-04
I had recently posted and to my chagrin, closed as solved a question on the exact same topic, but now realize that I didn't fully test the solution. I also didn't have as many clues to the problem as I have now, so here it is:
1) I'm using Javamail to send out a multipart email, half text/plain and half text/HTML.
2) The HTML I'm sending is mostly coming a SQL Server database, from a "text" datatype field, which is a binary field. It appears to be coming out in UTF-8 formatting.
3) The HTML contains special (upper ASCII) characters such as the TradeMark and Registered symbols. It is written to the database from a ColdFusion (yeah, I said it! ha ha) content management system called Ektron. I believe Ektron, though partially the bane of my existence is not the problem.
4) When I look at other multipart emails, I see that the HTML part is has the Content-Transfer-Encoding: set to 7bit, but mine are coming out as quoted-printable. I believe this is the root of the problem. I believe I found out where I can fix this, but I'm not sure. I think I can set this directly at the Part/Multipart (can't remember the name right now) object level. It says setHeader, which I think is for the Part header, not the message header, which is where I've tried to set it before.
5) I use sendmail as the mail server. I thought this was the problem for a while, but now I think that was an incorrect assumption.
- How should I retrieve the data from SQL Server, with getBytes and create a new String with "UTF-8" formatting?
- Is the Content-Transfer-Encoding another piece of the problem?
- If so, am I correct in solving it at the Part level?
I have been on this one for a while and very desperately need it solved.