dcsimg
How to send chinese email using Javamail?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Lina_Lee
Posted On:   Tuesday, February 4, 2003 08:01 PM

How to send chinese email using Javamail? I have try to use the following code to send chinese email in utf-8, it works ok but then I need to turn on NJStar Communicator in order to view the text. I tried using GB2312 but the email return the text in ????. So can anyone help me out please?? Thanks <%@ page session="false" contentType="text/html; charset=GB2312" language="java" import="java.lang.*,java.io.*,java.sql,java.util.*, javax.mail.*, javax.mail.internet.*, javax.activation.*"%> <%Properties props = new Properties(); props.put("mail.smtp.host", "my_smtp_server"); Session s = Session.getInstance(props,null);    More>>

How to send chinese email using Javamail? I have try to use the following code to send chinese email in utf-8, it works ok but then I need to turn on NJStar Communicator in order to view the text. I tried using GB2312 but the email return the text in ????. So can anyone help me out please?? Thanks


<%@ page session="false" contentType="text/html; charset=GB2312" language="java" import="java.lang.*,java.io.*,java.sql,java.util.*, javax.mail.*, javax.mail.internet.*, javax.activation.*"%>



<%Properties props = new Properties();

props.put("mail.smtp.host", "my_smtp_server");

Session s = Session.getInstance(props,null);



MimeMessage message = new MimeMessage(s);

InternetAddress from = new InternetAddress("test@mydomainname.com", "name");

message.setFrom(from);

InternetAddress to = new InternetAddress("email@test.com");

message.addRecipient(Message.RecipientType.TO, to);


message.setSubject("test");


message.setHeader("Mime-Version", "1.0");

message.setHeader("Content-Transfer-Encoding", "quoted-printable");

message.setHeader("X-Mailer", "sendhtml");

message.setHeader("Content-Type", "text/html");



message.setContent(" ....... ");


Transport.send(message);%>

   <<Less
About | Sitemap | Contact