Java mail API: send e-mail through enterprise outlook account

I want my program to be able to send e - mail from my corporate outlook account I've seen many examples of JMA, which doesn't seem to be what I want

>Where can I find a simple example of sending email through outlook? > Should I move the mail system to a separate service application? If so, why?

Solution

All you need is SMTP settings for your company account Use the java mail API to set them up in your program, and that's it for example

Properties props = System.getProperties();
props.put("mail.smtp.host","your server here");
Session session = Session.getDefaultInstance(props,null);

For example: here and here

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>