Bonjour,
J'écrit un programme java qui permet de tester l'envoi d'un email avec java mail, il réussi à se connecter au serveur smtp et il debug qu'il a bien envoyé un email, mais je ne reçoit rien sur ma boite de réception, alors que si j'envoi l'email avec outlook avec les mêmes paramètres je reçoit . Je ne comprend donc pas je vous met ici le code :

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
 
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;
 
public class testMail {
 
  public static void main (String[] args) throws Exception {
 
    String smtpHost = "smtp.inforisk.ma";
    String from = "xx@inforisk.ma";
    String to = "yy@inforisk.ma";
    String username = "xx@inforisk.ma";
    String password = "pswd";
 
    Properties props = new Properties();
    props.put("mail.smtp.host", smtpHost);
    props.put("mail.smtp.auth", "true");
 
    Session session = Session.getDefaultInstance(props);
    session.setDebug(true);
 
    MimeMessage message = new MimeMessage(session);   
    message.setFrom(new InternetAddress(from));
    message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
    message.setSubject("Test mail");
    message.setText("Test mail");
 
    try
    {
	    Transport tr = session.getTransport("smtp");
	    tr.connect(smtpHost, username, password);
	    message.saveChanges();
 
	    tr.sendMessage(message,message.getAllRecipients());
	    tr.close();
    }
    catch(Throwable e)
    {
    	e.printStackTrace();
    }
 
  }
}
Tous se passe sans exception mais je ne reçoit rien et ci-dessous le debug du programme :

DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true

DEBUG: SMTPTransport trying to connect to host "smtp.inforisk.ma", port 25

DEBUG SMTP RCVD: 220 ESMTP

DEBUG: SMTPTransport connected to host "smtp.inforisk.ma", port: 25

DEBUG SMTP SENT: EHLO BIL
DEBUG SMTP RCVD: 250-tadra1.wanamaroc.com
250-PIPELINING
250-SIZE 10240000
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN

DEBUG SMTP Found extension "PIPELINING", arg ""
DEBUG SMTP Found extension "SIZE", arg "10240000"
DEBUG SMTP Found extension "ETRN", arg ""
DEBUG SMTP Found extension "STARTTLS", arg ""
DEBUG SMTP Found extension "AUTH", arg "PLAIN LOGIN"
DEBUG SMTP Found extension "AUTH=PLAIN", arg "LOGIN"
DEBUG SMTP Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP Found extension "8BITMIME", arg ""
DEBUG SMTP Found extension "DSN", arg ""
DEBUG SMTP: Attempt to authenticate
DEBUG SMTP SENT: AUTH LOGIN
DEBUG SMTP RCVD: 334 VXNlcm5hbWU6

DEBUG SMTP SENT: YmlsQGluZm9yaXNrLm1h
DEBUG SMTP RCVD: 334 UGFzc3dvcmQ6

DEBUG SMTP SENT: cGFzc3dvcmQ=
DEBUG SMTP RCVD: 235 2.7.0 Authentication successful

DEBUG SMTP: use8bit false
DEBUG SMTP SENT: MAIL FROM:<xx@inforisk.ma>
DEBUG SMTP RCVD: 250 2.1.0 Ok

DEBUG SMTP SENT: RCPT TO:<yy@inforisk.ma>
DEBUG SMTP RCVD: 250 2.1.5 Ok

Verified Addresses
yy@inforisk.ma
DEBUG SMTP SENT: DATA
DEBUG SMTP RCVD: 354 End data with <CR><LF>.<CR><LF>

DEBUG SMTP SENT:
.
DEBUG SMTP RCVD: 250 2.0.0 Ok: queued as 31ABB4FC52

DEBUG SMTP SENT: QUIT