JavaMail Exchange Authentication

后端 未结 8 2055
长情又很酷
长情又很酷 2020-12-03 05:53

I\'m trying to use Exchange authentication from my app using JavaMail to do this. Could some one give me a guide to do this? After authentication I need to send mails that\'

相关标签:
8条回答
  • 2020-12-03 06:52

    Works for me:

    Properties props = System.getProperties();
    // Session configuration is done using properties. In this case, the IMAP port. All the rest are using defaults
    props.setProperty("mail.imap.port", "993");
    // creating the session to the mail server
    Session session = Session.getInstance(props, null);
    // Store is JavaMails name for the entity holding the mails
    Store store = session.getStore("imaps");
    // accessing the mail server using the domain user and password
    store.connect(host, user, password);
    // retrieving the inbox folder
    Folder inbox = store.getFolder("INBOX");
    

    This code is based on the sample code arrives with the download of java mail.

    0 讨论(0)
  • 2020-12-03 06:52

    The package suggested above is essentially at end of life.

    From https://github.com/OfficeDev/ews-java-api

    Starting July 19th 2018, Exchange Web Services (EWS) will no longer receive feature updates. While the service will continue to receive security updates and certain non-security updates, product design and features will remain unchanged. This change also applies to the EWS SDKs for Java and .NET. More information here: https://developer.microsoft.com/en-us/graph/blogs/upcoming-changes-to-exchange-web-services-ews-api-for-office-365/

    0 讨论(0)
提交回复
热议问题