e42.uk Circle Device

 

Quick Reference

Emailing

Emailing

Email in the modern day with a reasonable email client and command line tools like msmtp and mbsync on Office 365, gmail and Yahoo!

It seems that some references are out of date and some providers no longer require a client_secret (Microsoft) which is interesting.

Email Proxying Application

To use OAuth2 with email providers like Microsoft, GMail and probably Yahoo an email proxy server can be configured. This solution works well for me and I have deployed it at work since Microsoft is removing support for app passwords (don't as me why, seems bonkers).

email-oauth2-proxy

This requires Python and the required external libraries are minimal.

In emailproxy.config:

[something@ms365hosted.domain.com]
permission_url = https://login.microsoftonline.com/common/oauth2/v2.0/authorize
...other things...
redirect_uri = https://localhost
client_id = 9e5f94bc-e8a4-4e73-b8be-63364c29d753
client_secret = 
...other things...

The above seems to work well. client_id taken from Thunderbird so you will be asked if you want Thunderbird to have access to whatever.

When you have edited emailproxy.config you can run this:

$ python -m venv venv
$ . venv/bin/activate
$ python -m pip install -r requirements-core.txt
$ python emailproxy.py --no-gui --debug --external-auth

It will provide a URL when you make a request and you should paste the whole response (including https://localhost) after you have authorized the app.

Good luck!

References

Quick Links: Techie Stuff | General | Personal | Quick Reference