Forum Discussion

VJ87SAKLANI's avatar
VJ87SAKLANI
Copper Contributor
Dec 14, 2024

facing issue in reading the email from office365

We are creating the process to auto read the unread emails from inbox. Process is working fine with our and other domains mail server but when we are using the client email address (office365 email server) not working. We have tried with app genearted password as well with the generate the key for application but no success. We have tried the package of limilab and AE.Net.Mail.

 

    using (var imap = new ImapClient(_importEmailSettings.Host, _importEmailSettings.Email, _importEmailSettings.Password, AuthMethods.Login, 993, false,true))
{
 
        var msgs = imap.SearchMessages(SearchCondition.Unseen());

       
        imap.SetFlags(AE.Net.Mail.Flags.Seen, uid.Value);
}

If we set the ssl true then get this error message

If we set ssl false then get this error message

 

1 Reply

  • Below items you may fix first:

     

    • AuthMethods.Login is basic auth. Office 365 rejects this.
    • Setting ssl=true fails because the server expects TLS with OAuth tokens, not a raw password.

Resources