My university provided me with an outlook email which 
authenticates through OAuth2 tokens to access their IMAP/SMTP 
servers. Can OpenSMTPD relay mail to their SMTP server by 
authenticating with the OAuth2 token? 

I am using mutt_oauth2.py[1] to obtain the OAuth2 refresh and 
access tokens. I download my mail from the IMAP server 
with fdm using xoauth2 as the authentication method. I 
currently use msmtp with xoauth2 as the authentication method to 
deliver mail to the SMTP server. I would like to use OpenSMTPD 
to authenticate with the OAuth2 token so that I can relay mail 
to the SMTP server.

The smtpd.conf manual documents the relay method with:
auth <table>
where a file specified by table(5) stores the credentials in the 
label   email-address:password
Since the password from come from an access token, the field 
would need to be updated. Additionally, the authentication 
method xoauth2 would need to be passed to the smtp server.

The possibility of relaying mail to SMTP servers using OAuth2 
authentication methods looks promising. I would be thankful for 
any help.


[1] https://gitlab.com/muttmua/mutt/-/blob/master/contrib/mutt_oauth2.py

Reply via email to