salut tt monde

je veux utilise javamail pour envoyer des mails a partir de mon application mais le problème que j'ai trouvé et comme suit:
************************************************
************************************************

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
 
javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465;
  nested exception is:
        java.net.ConnectException: Connection timed out: connect
        at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1391)
        at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412)
        at javax.mail.Service.connect(Service.java:310)
        at javax.mail.Service.connect(Service.java:169)
        at javax.mail.Service.connect(Service.java:118)
        at javax.mail.Transport.send0(Transport.java:188)
        at javax.mail.Transport.send(Transport.java:118)
**********************************************************
***********************************************************

voila le Code java:

******************************************
******************************************
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
 
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
 
public class sms2
{
String d_email = "wahidherguem@gmail.com",
d_password = "xxxxxxxx",
d_host = "smtp.gmail.com",
d_port = "465",
m_to = "wahidherguem@gmail.com",
m_subject = "Testing",
m_text = "Hey, this is the testing email.";
 
public sms2()
{
Properties props = new Properties();
props.put("mail.smtp.user", d_email);
props.put("mail.smtp.host", d_host);
props.put("mail.smtp.port", d_port);
props.put("mail.smtp.starttls.enable","true");
props.put("mail.smtp.auth", "true");
//props.put("mail.smtp.debug", "true");
props.put("mail.smtp.socketFactory.port", d_port);
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.socketFactory.fallback", "false");
 
SecurityManager security = System.getSecurityManager();
 
try
{
Authenticator auth = new SMTPAuthenticator();
Session session = Session.getInstance(props, auth);
//session.setDebug(true);
 
MimeMessage msg = new MimeMessage(session);
msg.setText(m_text);
msg.setSubject(m_subject);
msg.setFrom(new InternetAddress(d_email));
msg.addRecipient(Message.RecipientType.TO, new InternetAddress(m_to));
Transport.send(msg);
}
catch (Exception mex)
{
mex.printStackTrace();
}
}
 
public static void main(String[] args)
{
sms2 blah = new sms2();
}
 
private class SMTPAuthenticator extends javax.mail.Authenticator
{
public PasswordAuthentication getPasswordAuthentication()
{
return new PasswordAuthentication(d_email, d_password);
}
}
}
*************************************************
*************************************************

le IDE et netbenas6.5.1

STP qq1 peut me aider

Mes aquestions:

1-ce problème est a cause de mail.jar ou activation.jar (classpath)????
2-Comment je peut etre sur que les 2 jar mail.jar et activation.jar sonnt bien ajoute au classpath.
3-Ou a cause des machines distante(Serveur de messageries)

merci de m'aider