0 votes

We would like to authenticate with a single email address but read it from multiple Inboxes. For instance in Office 365 we have a email address user1@company.com, that has access to Inboxes test1@company.com and test2@company.com.

How do we read emails using IMAP connector from multiple Inboxes(test1 and test2) using the same authentication account(user1)?

Thanks

by (200 points)

1 Answer

0 votes

This is a server specific feature.

For Exchange/Office365 you may try shared mailboxes:

client.Login(
    "Username@DomainName\\Shared@DomainName", 
    "UserPassword");

You can find more details on shared mailboxes for Exchange here:
https://www.limilabs.com/blog/access-shared-delegate-mailbox-exchange-server
for Office365 here:
https://www.limilabs.com/blog/shared-mailbox-office365

You can also try 3rd parameter of LoginPLAIN to log in as a different user:

using (Imap imap = new Imap)
{
    imap.ConnectSSL("outlook.office365.com");

    imap.LoginPLAIN(
        "Shared@DomainName", 
        "Username@DomainName", "UserPassword");

    //...

    imap.Close();
}
by (297k points)
edited by
...