Solved

Sending email in Chinese

Posted on 2012-12-20
6
187 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
  • 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

803 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