Bonjour,
je viens de tester ce code qui ne fonctionne pas ? je crois qu'il manque des chose mais je ne sais pas quoi ?
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
 
package ca.etsmtl.gti525.garderie;
 
import java.util.Properties;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
 
/**
 *
 * @author B.REDOUANE
 */
public class GoogelSendMail {
 
    public static void main(String[] args) throws Exception {
        Properties props = new Properties();
        Session session = Session.getDefaultInstance(props, null);
 
        String msgBody = "...";
 
        try {
            Message msg = new MimeMessage(session);
            msg.setFrom(new InternetAddress("admin@gmail.com", "Example.com Admin"));
            msg.addRecipient(Message.RecipientType.TO,
                             new InternetAddress("admin@gmail.com", "Mr. User"));
            msg.setSubject("Your Example.com account has been activated");
            msg.setText(msgBody);
            Transport.send(msg);
 
        } catch (AddressException e) {
            System.err.println("Exception AddressException");
        } catch (MessagingException e) {
            System.err.println("Exception MessagingException");
        }               
    }
}
Voici le Tutorial que j'ai suivie https://developers.google.com/appeng...javamail?hl=fr (merci de me corrigé)