Solved

Sending email in Chinese

Posted on 2012-12-20
6
191 Views
Last Modified: 2013-01-03
Hi,

I am trying to send email in Chinese, but the below code only sends body part garbled message.

try{               
                            sun.net.smtp.SmtpClient smtp = new sun.net.smtp.SmtpClient("smtp.xxxx.org");
                            smtp.from((String)ResourceUtils.getResourceValue("xxx.replyEmail"));
                            smtp.to(to);
                            PrintStream msg = smtp.startMessage();
                          
                            msg.println("To: " + to);
                            msg.println("Subject: "+subject);
                            msg.println();//start of the body :
                            msg.println(body);
                            smtp.closeServer(); //sent
                }catch(Exception e){
                	log.error(e);                   
                }

Open in new window


I debugged that body variable contains correct Chinese characters.
Any ideas?

thanks,
0
Comment
Question by:dkim18
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 21

Expert Comment

by:Amitkumar Panchal
ID: 38712117
0
 

Author Comment

by:dkim18
ID: 38712150
I get null pointer exception.

out.println(new String(request.getParameter("inputText").  
                         getBytes("ISO-8859-1"), "UTF-8")) ;
0
 

Author Comment

by:dkim18
ID: 38712154
well..it does send an email, but I see whole bunch of question marks in the email.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 86

Expert Comment

by:CEHJ
ID: 38712317
Use JavaMail, not that (unsupported) class
0
 
LVL 21

Accepted Solution

by:
Amitkumar Panchal earned 500 total points
ID: 38712573
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 38741804
?
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Way to decrease size of apk file 9 104
type mismatch (Object[] to double[] 4 41
Java: How do I open the default windows program for a given file type 3 53
Setup GlassFish 4 34
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question