Bonjour, SVP j ai un probleme conçernant le WebMailing en Java
je veux réaliser une application web d'envoi et de reception des mails avec ou sans pieces jointes
comme un test j'ai commencé par cette classe mais apparemment je face un probleme que je comprends pas
Priere de me sauver et merci d'avance.
Le Code de ma classe.
L'erreur generée
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96 import java.util.*; import javax.mail.*; import javax.mail.internet.*; import javax.activation.*; public class SendHTMLEmail { public static void main(String [] args) { // Recipient's email ID needs to be mentioned. String to = "ka.hajar@gmail.com"; // Sender's email ID needs to be mentioned String from = "web@gmail.com"; // Assuming you are sending email from localhost String host = "localhost"; // Get system properties Properties properties = System.getProperties(); // Setup mail server properties.setProperty("mail.smtp.host", host); properties.put("mail.debug", "true"); // Get the default Session object. Session session = Session.getDefaultInstance(properties); try{ // Create a default MimeMessage object. MimeMessage message = new MimeMessage(session); // Set From: header field of the header. message.setFrom(new InternetAddress(from)); // Set To: header field of the header. message.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); // Set Subject: header field message.setSubject("This is the Subject Line!"); // Send the actual HTML message, as big as you like message.setContent("<h1>This is actual message</h1>", "text/html" ); // Send message Transport.send(message); System.out.println("Sent message successfully...."); }catch (MessagingException mex) { mex.printStackTrace(); } } }
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/mail/util/LineInputStream
DEBUG: JavaMail version 1.4ea
DEBUG: java.io.FileNotFoundException: D:\Program Files\Genuitec\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\jre\lib\javamail.providers (Le fichier spécifié est introuvable)
DEBUG: URL jar:file:/D:/Documents%20and%20Settings/hajar/Bureau/JM/imap.jar!/META-INF/javamail.providers
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/mail/util/LineInputStream
at javax.mail.Session.loadProvidersFromStream(Session.java:928)
at javax.mail.Session.access$000(Session.java:174)
at javax.mail.Session$1.load(Session.java:870)
at javax.mail.Session.loadAllResources(Session.java:1130)
at javax.mail.Session.loadProviders(Session.java:886)
at javax.mail.Session.<init>(Session.java:210)
at javax.mail.Session.getDefaultInstance(Session.java:299)
at javax.mail.Session.getDefaultInstance(Session.java:339)
at SendHTMLEmail.main(SendHTMLEmail.java:28)
Partager