File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other JSE/JEE APIs and the fly likes Send Japanese Characters In Java Mail Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Send Japanese Characters In Java Mail" Watch "Send Japanese Characters In Java Mail" New topic
Author

Send Japanese Characters In Java Mail

Nitin Sinha
Greenhorn

Joined: May 08, 2008
Posts: 17
I have been using the following code in my program to send mail in English -

But, now I have a requirement to send Japanese characters in mail.
I tried to google alot but couldn't find a viable solution.
Can anyone assist me with the code (if possible)

When I try to harcode Japanese Characters ino Subject & Content Line, the mails outputs ??? in place of all the Japanese chractersets. Like this -

message.setSubject("全て半角英数字で");
message.setContent("定されていないシステム", "text/html");

I also tried using the code given at : http://www.example-code.com/java/java-japanese-email.asp

But this code throws me an exception stating :

java.lang.UnsatisfiedLinkError: new_CkMailMan
at com.chilkatsoft.chilkatJNI.new_CkMailMan(Native Method)
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19670
    
  18

Nitin Sinha wrote:When I try to harcode Japanese Characters ino Subject & Content Line, the mails outputs ??? in place of all the Japanese chractersets.

How are you verifying this? Using the console? Because then maybe it's a console problem, not a JavaMail problem.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Nitin Sinha
Greenhorn

Joined: May 08, 2008
Posts: 17
I have this Java Mail embedded in a servlet which is called upon submission of a JSP form which consolidates all the inputs from the user in a mail and mails them to me. Now, I want to allow user to enter Japanese characters in the inut boxes So those Japanese characters should get mailed to me too.

But this is other part of the story. Even if i try to hardcode anything in the mailer Body content, it returns a mail to me which has all ??? wherever I hardcode Japanese characters
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19670
    
  18

Ok, so it shows up wrongly in a mail client that usually can handle Japanese characters.

Can you set the charset in the emails? I found a website that used the following code:
Surely you could try something similar?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Send Japanese Characters In Java Mail