Setting Personal Outlook Account in Aerc Mail Client Using OAuth
In this article, we will discuss the process of setting up a personal Outlook account in the Aerc mail client using OAuth authentication. This method is more secure than using a plaintext password, as it allows the mail client to access the user's mailbox without having to store their password.
Prerequisites
Before we begin, ensure that you have the following:
- Aerc mail client installed
- A personal Outlook account
- OAuth app registration for your Outlook account
Setting up OAuth App Registration for Outlook
To set up OAuth app registration for your Outlook account, follow these steps:
- Go to the Azure Portal and sign in with your Microsoft account.
- Click on New registration.
- Enter a name for your app, and select Accounts in any organizational directory and personal Microsoft accounts as the supported account types.
- Enter a redirect URI in the format
aerc://oauth/callback. - Click Register to create the app.
- Copy the Application (client) ID and Directory (tenant) ID for later use.
Setting up Aerc Mail Client
To set up the Aerc mail client with your personal Outlook account using OAuth, follow these steps:
- Open the Aerc mail client and click on Add account.
- Select Imap/Smtp as the account type.
- Enter your name, email address, and IMAP/SMTP server settings as follows:
IMAP Server: outlook.office365.com
IMAP Port: 993
IMAP Encryption: SSL/TLS
SMTP Server: smtp.office365.com
SMTP Port: 587
SMTP Encryption: STARTTLS
- Click on Advanced settings and enter the following OAuth settings:
Auth URL: https://login.microsoftonline.com/{directory-id}/oauth2/v2.0/authorize
Token URL: https://login.microsoftonline.com/{directory-id}/oauth2/v2.0/token
Client ID: {application-id}
Scopes: offline_access User.Read Mail.Read
Redirect URI: aerc://oauth/callback
Replace {directory-id} and {application-id} with the values obtained during app registration.
- Click on Save to add the account.
- You will be redirected to the Microsoft login page to grant permission to the Aerc mail client.
- After granting permission, you will be redirected back to the Aerc mail client and your personal Outlook account will be set up.
- Setting up a personal Outlook account in Aerc mail client using OAuth authentication is more secure than using a plaintext password.
- To set up OAuth app registration for your Outlook account, go to the Azure Portal and create a new app with supported account types of Accounts in any organizational directory and personal Microsoft accounts.
- Enter a redirect URI in the format
aerc://oauth/callbackand copy the Application (client) ID and Directory (tenant) ID for later use. - To set up the Aerc mail client with your personal Outlook account using OAuth, enter your name, email address, and IMAP/SMTP server settings, and OAuth settings with the values obtained during app registration.
References
- Azure Portal: https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationsListBlade
- Aerc Documentation: https://aerc-mail.org/docs/
- Microsoft Graph API: https://docs.microsoft.com/en-us/graph/overview