Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 204
  • Last Modified:

Sending email in Chinese

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
dkim18
Asked:
dkim18
  • 2
  • 2
  • 2
1 Solution
 
Amitkumar PanchalSr. ConsultantCommented:
0
 
dkim18Author Commented:
I get null pointer exception.

out.println(new String(request.getParameter("inputText").  
                         getBytes("ISO-8859-1"), "UTF-8")) ;
0
 
dkim18Author Commented:
well..it does send an email, but I see whole bunch of question marks in the email.
0
Industry Leaders: 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!

 
CEHJCommented:
Use JavaMail, not that (unsupported) class
0
 
Amitkumar PanchalSr. ConsultantCommented:
0
 
CEHJCommented:
?
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now