By default in the Release mode, Xamarin applications link only most common encodings. Of course this is not enough to handle multi-national email messages.
If on startup your application receives MissingEncodingException error, you need to add MandroidI18n into your .csproj (e.g. App1.Android.csproj):
<MandroidI18n>All</MandroidI18n>
You might need to unload the project first to be able to edit it:
We will be conducting planned maintenance to ordering system on Wednesday, February 24, 2021
During the planned maintenance, the system will continue to take orders. However customers may see temporary delays in fulfillment and order confirmation emails.
Once the maintenance is finished, we expect all functionality to resume; orders will be processed, and order confirmation emails will be sent to customers.
Make sure you have access to the shared mailbox. Log in to Microsoft 365 admin portal at https://admin.microsoft.com/ as an administrator, go to Users/Active users tab and select shared mailbox:
On the Mail tab, in Mailbox permissions click Read and manage permissions:
Make sure your user is on the list:
Enable IMAP/POP3 for shared mailbox
On the same screen go to Manage email apps:
and select IMAP and POP3:
Now, there are 2 ways of accessing a shared mailbox in Office 365:
Using regular IMAP basic authentication and a using OAuth 2.0.
Try authenticating to users’ regular mailbox with his credentials (or App password) to check if basic authentication works and the user/password is correct:
Don’t use UseBestLogin for Office365 shared mailboxes and basic authentication.
The reason is Office 365 advertises LOGIN PLAIN as a preferred login method and UseBestLogin chooses to use it. However Office 365 does not recognize Username@DomainName\Shared@DomainName user pattern when using LOGIN PLAIN. For Office 365 to accept a LOGIN PLAIN to a shared mailbox, you need to provide all 3 parameters separately: shared mailbox, user and user password – use LoginPlain to do that.
Shared mailbox – OAuth 2.0
It is much simpler with OAuth. Use any of the available OAuth 2.0 flows:
On the “Active users” list find the account you are using:
Then go to “Mail” tab then click “Manage email apps”
There is an option called “Authenticated SMTP”. It is ticked by default, however to actually make it work you have to uncheck it and save the changes, then go back in and check it again it and save the changes.
You may need to leave it unchecked for some time and wait for some time when it is rechecked, before it starts working.
After this change Mail.dll client can authenticate successfully using OAuth 2.0:
Password grant flow requires Multi-Factor Authentication (MFA) to be disabled for this mailbox – make also sure there are no Active Directory policies that match this account and require MFA (you can of course have policies that match all other accounts).
Go to Microsoft365 admin center. Select Setup on the left menu and in the Sign-in and security section select Configure multifactor authentication (MFA):
Then you need to apply correct API permissions and grant the admin consent for your domain.
In the API permissions / Add a permission wizard, select Microsoft Graph and then Delegated permissions to find the following permission scopes listed: