Arnab Ghosh

Greenhorn
+ Follow
since May 31, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Arnab Ghosh

Dear Friends,

I have a very specific problem related to javax.mail api, and I have no clue as of now whether it is a problem with my code, or whether a problem with some client side infrastructure. It would be very helpful if someone could post some advise here.

I'm using javax.mail api to construct a multipart message. This application is being used to send mails in German language and hence German umlauts and special characters constitutes a part of the emails (for eg Ä,ä,Ü,ü,Ö,ö,ß etc). Now when the mails are sent out, these characters are visible in almost all email clients for eg Hotmail, Gmail, IBM's Lotus Notes etc. But our client uses Microsoft Outlook 2003, and it seems the umlauts vanishes from the mail body. They are replaced by blank spaces !!

We have tried installing MS Outlook 2003 to our local systems, and configure it to Gmail, and were not able to reproduce the problem. Hence I understand this is not a typical problem with Outlook 03, however have no clue what the problem could be. It could be a problem with the code, or with our client's infrastructure but I'm looking for specific answers here.

I paste here the relevant portions of the source code.
The following part of the code snippet initializes the multipart message:
MimeMultipart lRoot = new MimeMultipart ( "mixed" );
MimeMultipart lContent = new MimeMultipart( "alternative" );
MimeBodyPart lTextPart = new MimeBodyPart();
MimeBodyPart lHtmlPart = new MimeBodyPart();

The following part sets the body text
lTextPart.setText( <This part is blank>, "utf-8" );
lTextPart.setHeader( "MIME-Version" , "1.0" );
lTextPart.setHeader( "Content-Type" , lTextPart.getContentType() );

lHtmlPart.setContent( <Actual HTML content part>, "text/html");
lHtmlPart.setHeader( "MIME-Version" , "1.0" );
lHtmlPart.setHeader( "Content-Type" , "text/html" );
lHtmlPart.setHeader( "charset" , "utf-8" );

The parts within <> are strings conatining mail body which has those special umlaut characters. The lTextPart is normally blank and hence I won't bother about its contents.

I have also tried the following line for lHtmlPart, but it does not solve the problem
lHtmlPart.setContent( <Actual HTML content part>, "text/html; charset=utf-8");

Do let me know if I need to furnish some more details here. And if somebody could suggest what might be wrong at our client's infra end, that might also be very helpful.
Any help would be deeply appreciated.

Regards,
Arnab.
12 years ago
Hi Ranchers,

Thanks for all the valuable tips and advices. I was able to clear this exam with very minimum preparation time.

Regards,
Arnab.
15 years ago