SoFunction
Updated on 2024-11-10

python implementation of Netease mailbox mail reading and deletion of auxiliary scripts

Synopsis:

In the NetEase Email Master client under Windows, when reading emails, you can use the shortcut key Delete to delete emails, and then automatically jump to the next one, if you press the Delete key again, then jump to the next one. In order to read emails quickly and delete unnecessary emails at the same time, I have written the following script, which is for my own use and sharing at the same time.

Question:

1. As shown above, I have accumulated too many unread e-mails because there are too many e-mails per day to read them all, and the number of e-mails will reach the upper limit soon;

2. I want to see every e-mail;

3. The content of the e-mail is sometimes too ribald, and is of a know-it-all type that can be read and then deleted;

4. Most of them have to be deleted after reading and it is too troublesome to delete them one by one;

Bottom line, need to automatically delete emails that I don't find useful after reading them.

A solution:

See the following code

import win32api
import time
 
 
def fast_email_reading_and_delete(vk_code: int) -> None:
    """
    Virtual Key Code reference: /en-us/windows/win32/inputdev/virtual-key-codes
    """
    print("Running, please switch to the software you are using within 3 seconds!")
    (3) # use this 3 seconds to switch to the software you use, for example Netease email client
    count = 0
    while True:
        win32api.keybd_event(int(vk_code), 0, 0, 0)
         
        count += 1
        if count % 30 == 0: # refresh every 30 seconds to get more email from Netease email server
            win32api.keybd_event(int(0x71), 0, 0, 0)   # 0x71 is F2 refresh, int is 113
        (1) # mail reading time
         
        # press space key or right arrow would halt the delete process. 0x20 spacekey 0x27 right arrow key
        if (int(0x20)) or (int(0x27)): 
            while True:
                (0.5)
                if (int(0x20)) or (int(0x27)):
                    break
 
if __name__ == '__main__':
    fast_email_reading_and_delete(0x2E) # 0x2E is DEL key, equivalent int is 46

In the future, if I have the opportunity to develop my own email client, I will provide automatic presentation of email content (one email after another) and automatic deletion (or archiving) of emails as original features.

Theoretically, the above script works with any software that has a DEL shortcut function, be careful not to screw up your stuff, the auto-delete time is 1 second.

Well, the above code calls the Windows api, so it can only run under Windows, there should be a similar tool under Linux, welcome to leave a message to exchange!

Above is python realize netease mailbox mail read and delete auxiliary small script details, more about python netease mailbox script information please pay attention to my other related articles!