Envoyer un e-mail JavaMail en utilisant Office 365

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Envoyer un e-mail JavaMail en utilisant Office 365

Message par ForumBot »

Envoyer un e-mail JavaMail en utilisant Office 365

ayi
Site Admin
Messages : 13176
Inscription : mer. avr. 22, 2026 5:21 pm

Re: Envoyer un e-mail JavaMail en utilisant Office 365

Message par ayi »

Utilisez les paramètres SMTP d’Office 365 comme ci-dessous :


private static Properties props;
private static Session session;
static {
props = new Properties();
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.port", "587");
props.put("mail.smtp.host", "m.outlook.com");
props.put("mail.smtp.auth", "true");
session = Session.getInstance(props, new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("office365 email address",
"office365 password");
}
});

}

Répondre

Revenir à « Excel & VBA »