LukeSmithxyz / mutt-wizard

A system for automatically configuring mutt and isync with a simple interface and safe passwords
GNU General Public License v3.0
2.39k stars 382 forks source link

OAUTH2 support #954

Open rampaq opened 1 year ago

rampaq commented 1 year ago

Hi, as my university microsoft mail transfered to OAUTH2 without option to fallback, I modified my client config.

I enclose a pull request to support OAUTH2 mail solutions which should work with Microsoft and Google. An example on how to create the token file is in manpage and requires ClientID and ClientSecret app registration.

My university does not support custom app registration so I used Mozilla Thunderbird's credentials ones here. Code to generate the token with microsoft:

$ /usr/share/neomutt/oauth2/mutt_oauth2.py -v -t \
    --authorize --client-id "9e5f94bc-e8a4-4e73-b8be-63364c29d753" --client-secret "" \
    --email "<your email>" --provider microsoft \
    --encryption-pipe "gpg --encrypt --recipient <your_gpg_key>" \
    token_path
rampaq commented 1 year ago

It also should not be too hard to incorporate the mutt_oauth2.py script directly into mw

ayushjaipuriyar commented 1 year ago

Is this still not possible ? Cause without oauth there seems to be no point in using neomutt

pahlse commented 1 year ago

As to your question if mutt-wizard does this for you: NO!

But you can always do it yourself. If you have access to your client secret on Azure it shouldn't be a problem. Just follow the mutt_oauth2.py or similar configuration instructions.

If you don't have access to the client secret (which is the case with many corporate or university microsoft accounts) you will have to set up a davmail server on a vps or similar. This is fairly straight forward, just needs a bit more effort. See thread https://github.com/LukeSmithxyz/mutt-wizard/issues/601 for more details. In the last comment I describe my setup. Works flawlessly for me.

ayushjaipuriyar commented 1 year ago

As to your question if mutt-wizard does this for you: NO!

But you can always do it yourself. If you have access to your client secret on Azure it shouldn't be a problem. Just follow the mutt_oauth2.py or similar configuration instructions.

If you don't have access to the client secret (which is the case with many corporate or university microsoft accounts) you will have to set up a davmail server on a vps or similar. This is fairly straight forward, just needs a bit more effort. See thread #601 for more details. In the last comment I describe my setup. Works flawlessly for me.

Okay got it, will try to replicate your setup

aabbccddeeffggj commented 4 months ago

Recently, I got blocked from sending emails from my main email account (I can receive the emails just fine at least):

msmtp: authentication failed (method LOGIN)
msmtp: server message: 535 5.7.139 Authentication unsuccessful, account locked.
Contact your administrator. [CP5P284CA0025.BRAP284.PROD.OUTLOOK.COM
2024-04-17T16:43:08.320Z 08DC5E4AE6FF6F00]
msmtp: could not send mail (account xxx@hotmail.com from /home/xxx/.msmtprc)

I updated the application password and sent an email to test, it worked, but then the next day my account turns out to be blocked again (I did it twice).

I have another email address and I can send emails from that without a problem (both are hotmail).

I wonder if it's Microsoft slowly implementing the OAuth2 and I'm one of the lucky ones whose account got surprised by it. Do you think that's the case?