Non-ASCII content in body

Hi
When I send non-ASCII content in the body of a mail, the content does not appear correctly in the mail body.
<BR>
THe ccode is as below
msg.setHeader("Content-Transfer-Encoding", "quoted-printable" );
<BR>
String a = MimeUtility.encodeText("�later","UTF-8","B");
<BR>
msg.setContent(a, "text/html");
<BR><BR>
Mail is received as =?UTF-8?B?4oCZbGF0ZXI=?=
Can anybody help
Regards
Syed Niaz

Hi!
Your code looks a bit messy.
If you are sending non-ascii data, you should use a DataHandler and a DataSource to add your data to the mail's body instead of using MimeUtility.encode()
Hope this helps.

Similar Messages

  • Problem with non-ASCII file name in content disposition header

    Hi All,
    I am facing some problems with the non-ASCII file name incase of content-disposition header. I read from the RFC 2183 that if the file name contains non-ASCII characters then the same should be encoded before sending to browser. I did the same but realized 2 problems:
    1. The name of the file is truncated in case the file name is slightly long for e.g. �����������j�b�g��������������������������.txt
    2. Also when the same file is opened in notepad, the title is showing encoded name %E6%9C%80%E4%B8%8A%E4%BD%8D.....
    Overall, I feel that the browser is not understanding or responding to the encoded header values.
    Is there any solution to this problem? I am using Microsoft IE 6.0.
    The code snippet is given below:
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
              String fileName = "�����������j�b�g��������������������������.txt";          
              fileName = URLEncoder.encode(fileName, "UTF-8");
              resp.setCharacterEncoding("UTF-8");
              resp.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
              resp.setContentType("application/download-binary");
              String s = "This is inside txt file";
              resp.getOutputStream().write(s.getBytes("UTF-8"));
              return;
         }Any help or pointer would be highly appreciated.
    Thanks and Regards,
    Ashish

    The MIME standards for non-ASCII filenames are not widely implemented.
    Many mailers use an ad hoc method for encoding filenames. JavaMail
    supports both methods, but you need to set properties, such as the
    mail.mime.encodefilename property. See the JavaMail javadocs for
    the javax.mail.internet package.

  • Issue with Download and Loss of Non-ASCII Characters

    I have a need to allow my user to download the contents of an HTML Region as a file. This region contains some Greek letters, i.e. non-ASCII, used with some common finance formulas.
    I am able to copy the contents off this region using JavaScript without any issue.
    Moreover, I can copy the contents from JavaScript into a Page Item and then render the region with PL/SQL. Again, this works without an issue.
    However, when I try to download the region, the Greek letters are lost in the downloaded document. Instead they are replaced with this weird series of characters: (Δ
    I've created a sample app to demonstrate this problem at apex.oracle.com:
    URL: http://apex.oracle.com/pls/apex/f?p=34765:1
    UID: GUEST_DEV
    PWD: greeksgone
    Click the button labeled "Copy HTML Via JS" and you will see the statically populated region copied into the second region.
    Click the button labeled "Copy HTML Via APEX" and you will see the statically populated region copied into the third region. This is achieved by copying the HTML into a Page Item and then submitting the page. When the page returns, the value of this Page Item is then used to populate the third region. As you can see, the Greek letters are there as normal.
    However, if you click the "Download HTML" button you will see the the Greek letters are not present in the resulting file.
    -Joe

    Joe Upshaw wrote:
    I am just totally stuck here.
    This is what the document looks like without the required meta tag:
    <HTML>
    <BODY>
    <STYLE>
    <DIV>
    div.riskScenarioMatrixDiv
    overflow:auto;
    ....This version does not display the greek letters.
    If I could simply add this one meta tag in, everything would work beautifully:
    <HTML>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <BODY>
    <STYLE>
    <DIV>
    div.riskScenarioMatrixDiv
    overflow:auto;
    ....However, I have tried every combination I can think of in the code block but, any time that I add that meta tag, I get a *404 Page Not Found* error.
    The only thing standing between what we have and what we need is getting that meta tag in the output but, I just can't seem to find a way to do this. Actually, we'd really like to have, within the head tags; the meta tag, the style and the title but, not being able to get that meta tag in is the difference between acceptable and broken. It works with the others in the body.
    DECLARE
    ls_RiskMatrixTitle  VARCHAR2(32767);
    ls_RiskMatrixHTML   VARCHAR2(32767);
    ls_DefaultFileName  VARCHAR2(512);
    BEGIN
    ls_RiskMatrixHTML   := :P1_HTML;
    ls_DefaultFileName  := 'TestMe.html';         
    ls_RiskMatrixTitle  := 'Test of Download';        
    OWA_UTIL.MIME_HEADER( 'text/html',  False, 'UTF8' );
    HTP.P( 'Content-Disposition: attachment; filename=' || ls_DefaultFileName );
    --HTP.META( 'Content-Type',  null, 'text/html; charset=utf-8' );          
    --HTP.TITLE( ls_RiskMatrixTitle ); 
    OWA_UTIL.HTTP_HEADER_CLOSE;
    HTP.HTMLOPEN;   
    HTP.BODYOPEN;
    HTP.STYLE('<DIV>' || :P1_MATRIX_STYLE || '</DIV>');
    HTP.P(ls_RiskMatrixTitle);
    HTP.P(ls_RiskMatrixHTML);
    APEX_APPLICATION.G_UNRECOVERABLE_ERROR := True;
    END;
    You appear to be confusing HTTP and HTML.
    The HTTP header != HTML <tt>head</tt> element.
    HTP.META( 'Content-Type',  null, 'text/html; charset=utf-8' );          
    HTP.TITLE( ls_RiskMatrixTitle );  This generates HTML content. It does not go in the HTTP header. You should be generating an HTML <tt>head</tt> element containing this (and the <tt>style</tt> element) between <tt>HTP.HTMLOPEN</tt> and <tt> HTP.BODYOPEN</tt>.
    Also note that these web toolkit methods generate really obsolete HTML, therefore I never use them (and nor does APEX these days).
    Don't have time to get more into this now...

  • Non ascii characters are padding without reason

    Hi all,
    here is my issue :
    I have description field in my jsp page, when user enters some non ASCII characters as shown below :
    This is user had entered the input string is :
    "Hello ������� Hello" (without quotes)
    When he edits for the first time without change anything in the the string and save, then it became :
    "Hello Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã? Hello" (without quotes)
    Then again one more time, it became :
    "Hello Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â? Hello" (without quotes)
    Like wise it is getting increased its size. I'm saving the data to Oracle 10g database from jsp.
    Please suggest what to do to rectify the problem.
    Thanks & regards,
    Achchayya

    But I didnt changed anything from server.xml except two changes
    1) from : <?xml version='1.0' encoding='iso-8851-1'?>
        to : <?xml version='1.0' encoding='UTF-8'?>
    2)
    from : <Connector port="8888" protocol="HTTP/1.1"
                   connectionTimeout="20000"
                   redirectPort="8443" />
    to : <Connector port="8888" protocol="HTTP/1.1"
                   connectionTimeout="20000"
                   redirectPort="8443"
                   URIEncoding="UTF-8"/>here is my JSP :
    <%@ page pageEncoding="UTF-8" %>
    <html>
    <head>
    <title>The servlet example </title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    </head>
    <body>
    <h1>A simple web application</h1>
    <form method="POST" action="HelloWorld">
    <label for="name">Enter your name </label>
    <input type="text" id="name" name="name"/><br><br>
    <input type="submit" value="Submit Form"/>
    <input type="reset" value="Reset Form"/>
    </form>
    </body>
    </html>Servlet Code :
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class HelloWorld extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    * Get the value of form parameter
         System.out.println("response char set "+response.getCharacterEncoding());
         System.out.println("request char set "+request.getCharacterEncoding());
    response.setCharacterEncoding("UTF-8");
    String name = request.getParameter("name");
    String welcomeMessage = "Welcome "+name;
    System.out.println("Name : "+name);
    * Set the content type(MIME Type) of the response.
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    * Write the HTML to the response
    out.println("<html>");
    out.println("<head>");
    out.println("<title> A very simple servlet example</title>");
    out.println("</head>");
    out.println("<body>");
    out.println("<h1>"+welcomeMessage+"</h1>");
    out.println("</body>");
    out.println("</html>");
    out.close();
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
         response.setCharacterEncoding("UTF-8");
         doPost(request, response);
    } web.xml :
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.4"
    xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <servlet>
    <servlet-name>HelloWorld</servlet-name>
    <servlet-class>HelloWorld</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>HelloWorld</servlet-name>
    <url-pattern>/HelloWorld</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
    <welcome-file>
    HelloWorld.html
    </welcome-file>
    </welcome-file-list>
    <context-param>
         <param-name>PARAMETER_ENCODING</param-name>
         <param-value>UTF-8</param-value>
    </context-param>
    </web-app>please have a look at my files and suggest me BalusC.
    Thanks for your patience.
    regards,
    Achchayya
    Edited by: achayya on Oct 16, 2009 7:26 AM

  • A Download servlet: non-ASCII characters not working

    This is my servlet used for file download:
    public void doPost(HttpServletRequest request, HttpServletResponse response) {
      String filepath = request.getParameter("filepath");
      String filename = request.getParameter("filename");
      response.setContentType("application/zip");
      response.setHeader("Content-Disposition", "attachment;filename=\""+filename+"\";");
      ServletOutputStream sos = null;
      BufferedInputStream bis = null;
      try {
        sos = response.getOutputStream();
        bis = new BufferedInputStream(new FileInputStream(source));
        byte buffer[] = new byte[2048];
        int c;
        while((c = bis.read(buffer)) != -1)
          sos.write(buffer, 0, c);
      } catch(Exception e) {
      } finally {
        bis.close();
        sos.close();
    }It does not work when the filename contains non-ASCII characters (e.g., extended ASCII, CJK ...)
    What do I fix this? Thanks!

    One possiblitiy that occurs to me is you have too many encoding things going on and you are sorta "over-encoding" things, as it were....
    All I can think to do is give you this sample JSP page that I created when I was trying to figure all this web encoding stuff with forms back in the day. So perhaps you can use this as a basis for your own page.
    // _lang.jsp
    <%@ page language="java" contentType="text/html; charset=UTF-8" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
         <title></title>
         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    </head>
    <body bgcolor="#ffffff" background="" text="#000000" link="#ff0000" vlink="#800000" alink="#ff00ff">
    <%
    request.setCharacterEncoding("UTF-8");
    String str = "\u7528\u6237\u540d";
    String name = request.getParameter("name");
    %>
    req enc: <%= request.getCharacterEncoding() %><br />
    rsp enc: <%= response.getCharacterEncoding() %><br />
    str: <%= str %><br />
    name: <%= name %><br />
    <br />
    <a href="_lang.jsp?name=<%= java.net.URLEncoder.encode(str, "UTF-8") %>">as link</a>
    <br />
    <br />
    <form method="GET" action="_lang.jsp" encoding="UTF-8">
    Name: <input type="text" name="name" value="" >
    <input type="submit" name="submit" value="GET Submit" />
    </form>
    <form method="POST" action="_lang.jsp" encoding="UTF-8">
    Name: <input type="text" name="name" value="" >
    <input type="submit" name="submit" value="POST Submit" />
    </form>
    </body>
    </html>

  • Can't get the attachment filename out of a Part (with non ascii characters)

    Hello, all and happy new year :)
    My issue is with non ascii filename in attachments... Yes i've read the FAQ : http://www.oracle.com/technetwork/java/faq-135477.html#encodefilename
    I can't get the filename out of the BodyPart for those kind of attachments
    here's my unit test :
         * contains various parts from various mailer encoded in different ways...
         private enum EncodedFileNamePart{
              OUTLOOK("Content-Type: text/plain;\n name=\"=?iso-8859-1?Q?c'estd=E9j=E0no=EBl=E7ac'estcool.txt?=\" \nContent-Transfer-Encoding: 7bit\nContent-Disposition: attachment;\n filename=\"=?iso-8859-1?Q?c'estd=E9j=E0no=EBl=E7ac'estcool.txt?=\" \n\nnoel 2010\n","c'estdéjànoëlçac'estcool.txt"),
              GMAIL("Content-Type: text/plain; charset=US-ASCII; name=\"=?ISO-8859-1?B?ZOlq4G5v62znYWNlc3Rjb29sLnR4dA==?=\"\nContent-Disposition: attachment; filename=\"=?ISO-8859-1?B?ZOlq4G5v62znYWNlc3Rjb29sLnR4dA==?=\"\nContent-Transfer-Encoding: base64\nX-Attachment-Id: f_giityr5r0\n\namluZ2xlIGJlbGxzIQo=\n","déjànoëlçacestcool.txt"),
              THUNDERBIRD("Content-Type: text/plain;\n name=\"=?ISO-8859-1?Q?d=E9j=E0no=EBl=E7acestcool=2Etxt?=\"\nContent-Transfer-Encoding: 7bit\nContent-Disposition: attachment;\n filename*0*=ISO-8859-1''%64%E9%6A%E0%6E%6F%EB%6C%E7%61%63%65%73%74%63%6F;\n filename*1*=%6F%6C%2E%74%78%74\n\njingle bells!\n","déjànoëlçacestcool.txt"),
              EVOLUTION("Content-Disposition: attachment; filename*=ISO-8859-1''d%E9j%E0no%EBl.txt\nContent-Type: text/plain; name*=ISO-8859-1''d%E9j%E0no%EBl.txt; charset=\"UTF-8\" \nContent-Transfer-Encoding: 7bit\n\njingle bells\n","déjànoël.txt"),
              String content=null;
              String target=null;
              private EncodedFileNamePart(String content,String target){
                   this.content=content;
                   this.target=target;
              public Part get(){
                   try{
                   ByteArrayInputStream bis = new ByteArrayInputStream(this.content.getBytes());
                   Part part = new MimeBodyPart(bis);
                   bis.close();
                   return part;
                   catch(Throwable e){
                        return null;
              public String getTarget(){
                   return this.target;
         @Test
         public void testJavamailDecode() throws MessagingException, UnsupportedEncodingException{
              System.setProperty("mail.mime.encodefilename", "true");
              System.setProperty("mail.mime.decodefilename", "true");
              for(EncodedFileNamePart part : EncodedFileNamePart.values())
                   assertEquals(part.name(),MimeUtility.decodeText(part.get().getFileName()),part.getTarget());     
    I take a NullPointerExcepion in the decodeText because getFileName() return null for the EVOLUTION case, and work well with OUTLOOK, THUNDERBIRD and GMAIL.
    Evolution's content type is "Content-Disposition: attachment; filename*=ISO-8859-1''d%E9j%E0no%EBl.txt" wich doesn't look like the other (looks like the RFC 2616 or RFC5987 to do it.)
    How can i handle this situation except by writting my own decoder?
    Thanks for your answers!
    Edited by: user13619058 on 4 janv. 2011 07:44

    Set the System property "mail.mime.decodeparameters" to "true" to enable the RFC 2231 support.
    See the javadocs for the javax.mail.internet package for the list of properties.
    Yes, the FAQ entry should contain those details as well.

  • UploadedFile and filenames with non-ascii chars

    Hi
    I'm using an UploadedFile object in my web app, and all works fine. However, when I try to upload a file, with a filename containing non-ascii chars (e.g. Spanish), I see that the getBytes method returns an empty byte array, the filename is not stored correctly (the non-ascii chars are lost, replaced by another representation), and that the content-type is application/octet-stream instead of image/png as supposed to be.
    If I rename that same file to have only ascii chars - everything is back to normal.
    How can I upload files with non-ascii chars in their name?

    Hi, back! Spent a few hours experimenting and found
    that everything is working great (including the creation
    of international non-ASCII foldernames) when I used
    utf-8 encoding in the sieve filters rules for the
    the match strings and the folder names... at least
    so far so good... for your ref and sorry for bothering.

  • How to send an attached file containing with non-ascii code ?

    Hi,
    I want to send a attaced text file containing with non-ascii code(Traditional Chinese). Is there any way to solve the encoding problem?
    Currently, it transfer into non-meaningful code in receiving side.
    Thanks for the help in advance.

    Here is the code:
    Session _gSession = null;
    MimeMessage message = null;
    Properties props = new Properties();
    props.put("mail.smtp.host", smtpHost);
    _gSession = javax.mail.Session.getInstance(props, null);
    message = new MimeMessage(_gSession);
    message.setFrom(new InternetAddress(emailSender , emailSender));
    InternetAddress ia[] = new InternetAddress[1];
    ia[0] = new InternetAddress(emailReceiver, emailReceiver);
    message.setRecipients(Message.RecipientType.TO, ia);
    message.setSubject("Test Encoding Attached File");
    message.saveChanges();
    BodyPart messageBodyPart = new MimeBodyPart();
    DataSource fds = new FileDataSource("Big5_Code.txt");
    messageBodyPart.setDataHandler(new DataHandler(fds));
    messageBodyPart.addHeader("Content-ID","meme");
    MimeMultipart multipart = new MimeMultipart("related");
    multipart.addBodyPart(messageBodyPart);
    message.setContent(multipart);
    transport.connect();
    transport.send(message);

  • How to remove non-ASCII charcters from an XML generated using Simple Transf

    Hi,
    I am currently facing a problem where I invoke a ST like
    CALL TRANSFORMATION ZTEST
      source root = str
      result xml rawstr.
    to prepare an XML using the contents of the ABAP variable str.
    In my case sometime the variable str can contain non-ASCII characters. What I find is that ST do not remove these characters and the final XML that get generated thus contains non-parsable xml charcaters.
    Is there an efficient way to remove/replace such non-ascii characters within the ST such that my final XML is consumable by any xml parser. I do not want to do a second level of processing by running through the output xml and removing the charcaters individually, because in our system the number of xml messages generated is very high and any such lookup-replace algorithm terms out to be too coslty.
    Regards,
    Vikas Lamba

    Hi
    may be you know this syntax :)
    <?xdofx:substr(SHIP_TO_LOCATION_NAME,11,44)?>
    Rahul

  • Non - ASCII characters in textinput box

    Hi,
    I have a flex application where I have a TextInput box. If you paste the following (non-ascii characters) into it:
    "" ‘’¡¢£¤¥¦§¨©ª«¬ ®¯°±²³´µ¶·¸¹º®¯°±²³µ´¶µ·¹¸º»¼½¾¿ÀÁÈÉÊËÌÍÏÎÐÒÔØÖöõôóòññó"
    all you are left with is:
    I am guess its some configuration that I am missing and it would be something trivial for someone who knows the issue
    Any help is well appreciated.
    Thanks
    Hemant

    You may need to embed the font:
    http://livedocs.adobe.com/flex/3/html/help.html?content=fonts_04.html
    If this post answers your question or helps, please mark it as such.

  • Non-ASCII Characters in AppleWorks

    New to the forums and hope I'm not duplicating a prior post ... eons back, I used ClarisWorks on an old Mac SE/30, then moved over to AppleWorks which I got to use on my PC because I wanted to go back and work on something I had from years ago. The document in question contained non-ASCII characters. Anyway, I imported it into AppleWorks and what was once a Cyrillic font, was converted to ASCII (now a bunch of gibberish). I fully recognize I need to find the original font I used for the Cyrillic, but before I go that route, it looks like AppleWorks doesn't support non-ASCII characters ... ergo, I'm wasting my time. Am I wrong?
    Thanks.
    Windows 2.8 GHz   Windows XP Pro  

    You may need to embed the font:
    http://livedocs.adobe.com/flex/3/html/help.html?content=fonts_04.html
    If this post answers your question or helps, please mark it as such.

  • Non ascii characters in playlist's filenames

    I have strange problem creating playlists. When playlist consist of files with ascii filenames there are no problems - I can select and play them. When filenames with (for instance) Cyrillic characters are mixed with ascii filenames only I don't see Cyrillic filenames when I select the playlist. And, finally, when playlist consists of only non ascii filenames I get "invalid tracklist" when I try to select it.
    It is very strange because phone mediaplayer correctly display Cyrillic mp3 Unicode tags, it sees files in folders with Cyrillic filenames etc.
    I use 6131 with firmware 6.10 and PC Suite 6.86

    You may need to embed the font:
    http://livedocs.adobe.com/flex/3/html/help.html?content=fonts_04.html
    If this post answers your question or helps, please mark it as such.

  • Java / Linux - why ??? instead of non-ascii symbols

    Hi All,
    I've run into the problem during creating a new file from Java program on Linux gentoo.
    All non-ascii characters in the file name are converted into ??? symbols.
    I've tried to run the program with -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8, and set LC_ALL='UTF-8' - but the problem still exists.
    At the same time I can create the files with non-ascii characters in the file manager.
    Could you advise how can I fix this issue?
    Regards,
    Boris

    Is it related to File name or File content ?
    If it is file name related then Linux might have restriction on File name character !!.
    About File Content : Make one File reader program using Java and check are you able to read it back. if yes then It will be fault of your FileManager which is not correctly interpret content of your file.

  • Mail IMAP after 10.5.2 can't read ANY mails in boxes with non-ascii names

    I have Mail with IMAP that connects to a regular MAC OS X Tiger server running IMAP.
    After upgrading to 10.5.2 on the client, Mail can no longer read ANY mails at all in any mailbox whose path contains a non-ascii character!
    Hence: If a box is called 'Övrigt', it only lists the mails in the mail box, but it will not show any of the contents of any of the mails! Hence, I cannot access any of these mails! Catastrophic!
    I have to downgrade to 10.5.1, unless someone knows of a workaround.

    Same problem here (or at least in part). Some .mac folders did no longer show any messages, while they were there and could be seen online and with Thunderbird. After your remark I changed the name of a folder which contained a "´" and now it works. It is really strange because there is another folder with a "¨" in it which does not work (I will test if the name change works with this folder as well in a minute) whilst there is another one with such name which works fine. The update really messed up Mail and in Dutch we just use such characters so Mail without supporting them will be rather useless for me...

  • Encoding non-ASCII in mail subject

    I'm getting =?ANSI_X3.4-1968?Q? in the subject line of my email with non-ASCII character.
    I tried using encodeText from the MimeUtiliy like this but it won't work:
       Message msg = new MimeMessage(session);
                // -- Set the subject and body text --
                msg.setSubject(MimeUtility.encodeText(subject) );How should I go about?
    Thank you
    Niklas

    Thank you very much. I'll make the suggested changes and report back. It's the deafult locale of a virtual dedicated server at secureserver.net which shouldn't be strange. Meanwhile here is the entire method:
      public static void send(String smtpServer, String to, String from
                , String subject, String body, String personal) {
            try {
                log.info("using smtp server:"+smtpServer);
                Properties props = System.getProperties();
                props.put("mail.smtp.host", smtpServer);
                Session session = Session.getDefaultInstance(props, null);
                // -- Create a new message --
                Message msg = new MimeMessage(session);
                // -- Set the FROM and TO fields --
                msg.setFrom(new InternetAddress(from, personal));
                msg.setRecipients(Message.RecipientType.TO,
                        InternetAddress.parse(to, false));      
                // -- Set the subject and body text --
                msg.setSubject(MimeUtility.encodeText(subject) );
                //msg.setSubject(subject, �UTF-8&#8243;);
                //msg.setText(body);
                msg.setContent(body, "text/html");
                // -- Set some other header information --
                msg.setHeader("X-Mailer", "MarketMail");
                msg.setSentDate(new Date());
                // -- Send the message --
                Transport.send(msg);
                //log.info("Message sent OK.");
            } catch (Exception ex) {
                ex.printStackTrace();
       

Maybe you are looking for