Re: [PATCH v5 3/3] send-email: add option to generate passswords like OAuth2 tokens
- From
Julian Swagemakers <julian@swagemakers.org>
- Date
- Apr 24, 2025, 12:28 UTC
- Message-ID
- <D9EVAF38Q1KJ.24J34ET29VPTI@swagemakers.org>
- In-Reply-To
- <PN0PR01MB958856EC9FB1E4F73A738746B8852@PN0PR01MB9588.INDPRD01.PROD.OUTLOOK.COM>
On Thu Apr 24, 2025 at 9:53 AM CEST, Aditya Garg wrote:
Show 15 quoted lines
> Some email providers like outlook allow only OAuth2 tokens to be used > for authentication. This commit adds an option to generate OAuth2 tokens > using scripts like M365-IMAP[1]. This option is similar to passwordeval > in msmtp. > > Example usage: > > [sendemail] > smtpEncryption = tls > smtpServer = smtp.office365.com > smtpUser = someone@outlook.com > smtpServerPort = 587 > smtpauth = XOAUTH2 > smtpPassEval = cd /workspaces/codespaces-blank/M365-IMAP && python3 ./refresh_token.py >
Having the option `smtpPassEval` is a little more intuitive, but can't this also be achieved using a custom credential helper[0]?
Something like:
[credential "smtp://smtp.office365.com:587"]
username = someone@outlook.com
helper = "!f() { test \"$1\" = get && echo \"password=$(cd /workspaces/codespaces-blank/M365-IMAP && python3 ./refresh_token.py)\"; }; f"Regards Julian
[0] https://git-scm.com/docs/gitcredentials.html#_custom_helpers