Aug-28-2019, 06:50 PM
Hi,
I would like to refresh my python knowledge by writing a simple python program which could sort gmail emails by keywords in heading and/or by sender and place them into one of 2-3 categories created by me in gmail (called "labels" in gmail).
I took several Python 2.7 courses for beginners on Coursera, including "Python for networking", but may need to refresh the information.
I can envision the basic sorting algorythm from scratch like:
---if there is "keyword1" in the email heading
------move this email into category labelled "A"
---if there is "keyword2" in the email heading
------move this email into category labelled "B"
---else
------exit
But I am unsure:
1) how to get python to login into my email
2) how to represent the email category labels in python
3) how to represent email headlines/senders in python
4) how to represent the action of moving an email into a labelled category preset in the email in Python
It seems so easy in gmail GUI, but I have thousands of emails to sort.
Can someone provide some general or whatever guidelines/info sources on this issue?
I am running Python 2.7.15+ and Python 3.6.8 on Ubuntu 18.04.
Thanks a lot
I would like to refresh my python knowledge by writing a simple python program which could sort gmail emails by keywords in heading and/or by sender and place them into one of 2-3 categories created by me in gmail (called "labels" in gmail).
I took several Python 2.7 courses for beginners on Coursera, including "Python for networking", but may need to refresh the information.
I can envision the basic sorting algorythm from scratch like:
---if there is "keyword1" in the email heading
------move this email into category labelled "A"
---if there is "keyword2" in the email heading
------move this email into category labelled "B"
---else
------exit
But I am unsure:
1) how to get python to login into my email
2) how to represent the email category labels in python
3) how to represent email headlines/senders in python
4) how to represent the action of moving an email into a labelled category preset in the email in Python
It seems so easy in gmail GUI, but I have thousands of emails to sort.
Can someone provide some general or whatever guidelines/info sources on this issue?

I am running Python 2.7.15+ and Python 3.6.8 on Ubuntu 18.04.
Thanks a lot