Solved

Sending email in Chinese

Posted on 2012-12-20
6
183 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 20

Expert Comment

by:Amitkumar Panchal
Comment Utility
0
 

Author Comment

by:dkim18
Comment Utility
I get null pointer exception.

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

Author Comment

by:dkim18
Comment Utility
well..it does send an email, but I see whole bunch of question marks in the email.
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
Use JavaMail, not that (unsupported) class
0
 
LVL 20

Accepted Solution

by:
Amitkumar Panchal earned 500 total points
Comment Utility
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
?
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
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…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

762 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now