Skip to content

leapyear1969/PythonSMTPwithOauth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

PythonSMTPwithOauth

a demo of python sending emails with Oauth for China Office365.

  • 2023/09/13 update: add imap authentication code.

Note:

SMTP auth:

xoauth = base64("user=" + userName + "\x0auth=Bearer " + accessToken + "\x01")
.
.
.
smtp_conn.docmd('AUTH', 'XOAUTH2 ' + xoauth)

IMAP auth:

imap.authenticate('XOAUTH2', lambda x: 'user={}\x01auth=Bearer {}\x01\x01'.format(email, accesstoken))
  • the azure ad app should be set as below screeshot: image

About

a demo of python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages