How to send email from Office365 / outlook by Java

You need to set the following 4 properties:

    props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.port", 587);
props.put("mail.smtp.host", "smtp.office365.com");
//or
props.put("mail.smtp.host", "m.outlook.com");
props.put("mail.smtp.auth", "true");

Comments

Popular posts from this blog

Check MySQL query history from command line