Iraitika
Messages postés13Date d'inscriptionsamedi 15 décembre 2007StatutMembreDernière intervention24 juillet 2009
-
10 mai 2009 à 13:46
BYacine17
Messages postés1Date d'inscriptionjeudi 20 mars 2008StatutMembreDernière intervention 9 janvier 2010
-
9 janv. 2010 à 19:05
Bonjour,
Je voudrais envoyer des e mails via mon application j2ee mais je plante sur une exception que je ne comprend pas. Voici mon code :
Properties props = new Properties();
props.put("mail.smtp.host", "smtp.live.com");
Session session = Session.getDefaultInstance(props,null);
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress("test@test.fr"));
InternetAddress toAddress=new InternetAddress("test2@test2.fr");
msg.addRecipient(Message.RecipientType.TO, toAddress);
msg.setSubject("test message");
String html="<html><head><title>javaMail</title></head> SomeHtmlContent. </html>";
Multipart mp =new MimeMultipart();
BodyPart textPart = new MimeBodyPart();
textPart.setText("this is the message body");
BodyPart htmlPart = new MimeBodyPart();
htmlPart.setContent(html,"text/html");
mp.addBodyPart(textPart);
mp.addBodyPart(htmlPart);
msg.setContent(mp);
Transport.send(msg);
Le message d'erreur que j'obtient est :
<title>Apache Tomcat/6.0.14 - Rapport d'erreur</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style>javax.servlet.ServletException: com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first