dwdish 0 Newbie Poster

Hi, I successfully send email with the following code in English. However, if the message and the subject title are in other characters, everything becomes question marks and the subject title says something like ...ANSI...3F=3F=3F...
How do I set the character encoding to utf-8, for example? Thanks.

I have this in the jsp:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="en-us">
<title>Emailing</title>
<link href="/styles.css" rel="stylesheet" type="text/css"/>
</head>
try
{ 
Properties props = new Properties(); 
Session sendMailSession; 
Transport transport; 
sendMailSession = Session.getInstance(props, null); 
props.put("mail.smtp.host", SMTP_CLIENT); 
Message newMessage = new MimeMessage(sendMailSession); 
newMessage.setFrom(new InternetAddress(EMAIL_FROM)); 
newMessage.setRecipient(Message.RecipientType.TO, new InternetAddress(strEmail)); 
newMessage.setSubject(SUBJECT); 
newMessage.setSentDate(new Date()); 
strMsg = "Dear " + RS.getString("FIRST") + " " + RS.getString("LAST") + ",";
strMsg += "\n\n";
strMsg += [MESSAGE IN CHARACTERS OTHER THAN ASCII];
newMessage.setText(strMsg); 
transport = sendMailSession.getTransport("smtp");
transport.send(newMessage);
} 
catch(MessagingException m) 
{ 
...
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.