Mi dite come fare per far accettare tutti i tipi di caratteri quando invio le mail utilizzando javamail ???
Con questo codice il body mi viene messo come allegato nella mail perchè non gli piacciono alcuni caratteri...
codice:
public boolean sendMail(String to, String subject, String body){
boolean returnValue = false;
try{
Properties props = System.getProperties();
props.put("mail.smtp.host", smtpServer);
Session session = Session.getDefaultInstance(props, null);
// -- Create a new message --
Message msg = new MimeMessage(session);
// -- Set the FROM and TO fields --
msg.setFrom(new InternetAddress(from));
msg.setRecipients(Message.RecipientType.TO,
InternetAddress.parse(to, false));
// -- Set the subject and body text --
msg.setSubject(subject);
msg.setText(body);
// -- Set some other header information --
msg.setHeader("X-Mailer", "LOTONtechEmail");
msg.setSentDate(new Date());
// -- Send the message --
Transport.send(msg);
//System.out.println("Message sent OK.");
returnValue = true;
}catch (Exception ex){
returnValue = false;
}
return returnValue;
}