There are two standard modules for mail processing in python: email and poplib.
The official manual of email:
https://docs.python.org/zh-cn/3/library/email.html
First of all, the password of most mailboxes is not the mailbox password, and the password cannot be entered.
A POP3 password is required.
For operation (maybe because it is not recommended, the operation is extremely awkward)
Take QQ as an example: set up
and then account-pop/smtp service.
Turn off and then turn on POP3, which will let you send emails.
Will get a third-party authorization code
Do you know what the third-party authorization code is used for? That is, when a third party uses it, you can't log in with the password you set, but log in with the third-party authorization code given by the official.
After obtaining the third-party authorization code, you can use the third-party platform to manage mail (for example, FOXmail manages 139 mail)