0
votes

I am trying to send an html (MIME) email from xpages to my inbox which i open via lotus notes client (8.5.3). The email has greek text in the subject and body. Body text appears normally in greek but the subject text does not. In the past i have received emails with subject in greek without any problems. How can i change the encoding in my code?

Check these 2 links to see the email library i use: http://www.bleedyellow.com/blogs/m.leusink/entry/send_html_mails_from_an_xpage_with_only_5_lines_of_code?lang=en_us

(link to older version of this library removed: latest version with a fix for this question can be found here)

1
Could you please add more details on how are you sending the email? Do you send it by Domino means (e.g. creating Memo document in the mail.box) or do you use Java Mail API? - Egor Margineanu
OK Egor i updated my questions with links to the library. - mike_x_
You could try following: new String(java.nio.charset.Charset.forName("UTF-8").encode(subject).array()) - Egor Margineanu
Another option would be to modify the library itself, instead of: mimeHeader = mimeRoot.createHeader("Subject"); mimeHeader.setHeaderVal( this._subject); you will need: mimeHeader = mimeRoot.createHeader("Subject"); mimeHeader.addValText(this._subject, "UTF-8"); - Egor Margineanu
@EgorMargineanu : It worked with addValText! I tried with nio.charset before i posted this question but it didnt work. Thanks for helping me! - mike_x_

1 Answers

3
votes

You will need to modify the library to include following code for subject header:

mimeHeader = mimeRoot.createHeader("Subject"); 
mimeHeader.addValText(this._subject, "UTF-8"); 

PS: I suggest you report this to author, so it can be fixed.