Erreur JavaMail Unrecognized command
Bonjour,
J'essais d'envoyer un email utilisant JavaMail, j'ai créer une Classe qui envoi les emails et ça marche très bien sur un ordinateur quand j'ai mis mon code sur un autre ordinateur ça marche plus ça me donne une exception, je trouve nulle part une personne ayant le même problème j'ai tout essayé j'ai réinstallé la JVM pour avoir la même.
Voici le code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
public boolean send(String destinataire,String destinataire2,String message_objet,String message)
{
logger.info("Sending mail to : "+destinataire+" , "+destinataire2);
Session session = Session.getDefaultInstance(props, null);
session.setDebug(true);
Transport transport = session.getTransport();
Message mesg = new MimeMessage(session);
InternetAddress toAddress = new InternetAddress(destinataire);
mesg.addRecipient(Message.RecipientType.TO, toAddress);
mesg.addRecipient(Message.RecipientType.TO, toAddress2);
mesg.setFrom(new InternetAddress(account));
mesg.setSubject(message_objet);
mesg.setText(message);
transport.connect(getConfig("smtpserver"),Integer.parseInt(getConfig("port")), account, password);
transport.sendMessage(mesg,mesg.getRecipients(Message.RecipientType.TO));
} |
Voici l'exception :
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
|
DEBUG: setDebug: JavaMail version 1.4.3
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 25, isSSL false
220 mx.google.com ESMTP q30sm22748283qcq.12
DEBUG SMTP: connected to host "smtp.gmail.com", port: 25
EHLO novice-PC.mshome.net
250-mx.google.com at your service, [81.192.199.162]
250-SIZE 35651584
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH
250-ENHANCEDSTATUSCODES
250 STARTTLS
DEBUG SMTP: Found extension "SIZE", arg "35651584"
DEBUG SMTP: Found extension "8BITMIME", arg ""
DEBUG SMTP: Found extension "AUTH", arg "LOGIN PLAIN XOAUTH"
DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP: Found extension "STARTTLS", arg ""
STARTTLS
502 5.5.1 Unrecognized command. q30sm22748283qcq.12
ERROR [main] (SendEmail.java:70) MessagingException : [Ljava.lang.StackTraceElement;@167d940
javax.mail.MessagingException: 502 5.5.1 Unrecognized command. q30sm22748283qcq.12
at com.sun.mail.smtp.SMTPTransport.issueCommand(SMTPTransport.java:1795)
at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:1644)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:534)
at javax.mail.Service.connect(Service.java:291)
at com.sofrecom.SendMail.SendEmail.send(SendEmail.java:59)
at com.sofrecom.SendMail.SendEmail.main(SendEmail.java:122) |
SVP Si vous avez une idée, sur ce que ça pourrait être n'hésitez pas :calim2:.
Merci