[Javamail] Exception incompréhensible
Bonjour
Voici mon problème. J'obtiens une exception que je n'arrive pas à interpréter et encore moins à contourner. Voici ma méthode:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
private void mailWebmaster() {
try {
String to = "monmail@machine.truc";
String subject = "Error !";
java.util.Properties props = System.getProperties();
//could use Session.getTransport() and Transport.connect()
//assume we're using SMTP
props.put("mail.smtp.host", "smtp.xxx.yyy");
// Get a Session object
Session session = Session.getInstance(props, null);
// construct the message
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(to));
msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to, false));
msg.setRecipients(Message.RecipientType.BCC, InternetAddress.parse(new String(), false));
msg.setSubject(subject);
StringBuffer sb = new StringBuffer();
sb.append("Exception in class "+this.nameClass+"\n\n");
sb.append(this.error_message);
msg.setText(sb.toString());
msg.setHeader("X-Mailer", "msgsend");
msg.setSentDate(new java.util.Date());
Transport.send(msg);
} catch (AddressException ae) {
ae.printStackTrace(System.err);
}
catch(javax.mail.MessagingException me){
me.printStackTrace(System.err);
}
} |
Et voici la fameuse exception:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
javax.mail.MessagingException: IOException while sending message;
nested exception is:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/plain; charset=us-ascii
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:625)
at javax.mail.Transport.send0(Transport.java:169)
at javax.mail.Transport.send(Transport.java:98)
at com.maboite.starter.ErrorDisplayer.mailWebmaster(ErrorDisplayer.java:57)
at com.maboite.starter.ErrorDisplayer.<init>(ErrorDisplayer.java:20)
at com.maboite.starter.mainEntry.checkFile(mainEntry.java:41)
at com.maboite.starter.mainEntry.main(mainEntry.java:161)
Caused by: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/plain; charset=us-ascii
at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:870)
at javax.activation.DataHandler.writeTo(DataHandler.java:301)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1350)
at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1683)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:585)
... 6 more |
Merci à celui ou celle qui m'aidera.
@++