Lorsque je compile un code simple contenant les 2 instructions d'importation suivantes:
import javax.mail.*
import javax.mail.internet.*
J'obtiens le message suivant:
package javax.mail does not exist
package javax.mail.internet does not exist
Pourquoi ai-je cette erreur?
Voici le code que j'ai:
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
class tester {
public static void main(String args[]) {
Properties props = new Properties();
props.put("mail.smtp.com" , "smtp.gmail.com");
Session session = Session.getDefaultInstance( props , null);
String to = "me@gmail.com";
String from = "from@gmail.com";
String subject = "Testing...";
Message msg = new MimeMessage(session);
try {
msg.setFrom(new InternetAddress(from));
msg.setRecipient(Message.RecipientType.TO , new InternetAddress(to));
msg.setSubject(subject);
msg.setText("Working fine..!");
} catch(Exception exc) {
}
}
}