Python Forum
A mail scraper for sorting emails into categories
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A mail scraper for sorting emails into categories
#1
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?
Think

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


Thanks a lot
Reply
#2
1) https://developers.google.com/gmail/api/
2, 3 and 4) That is a very abstract question, if the docs link above doesn't answer it then it would help us if you were more specific.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How i can use categories with folder? AnonymerAlias 2 554 Jun-06-2023, 03:44 PM
Last Post: Gribouillis
  Sending Emails on Autopilot Gyga_Hawk 3 1,627 Mar-15-2022, 08:20 AM
Last Post: Larz60+
  Trying out the parsing/reading of emails from my outlook cubangt 0 6,052 Jan-12-2022, 08:59 PM
Last Post: cubangt
  Web Scraper with BeautifulSoup4 sometimes no Output Nitsuj 2 1,903 Nov-26-2021, 05:04 PM
Last Post: snippsat
  How to make scraper send email notification just once themech25 0 1,362 Nov-08-2021, 01:51 PM
Last Post: themech25
  Mail issue Mihil 3 2,588 Dec-03-2020, 05:25 AM
Last Post: Mihil
  reading shared outlook emails zarize 0 2,422 Mar-03-2020, 01:47 PM
Last Post: zarize
  Python Library for Reading POP Emails? bmccollum 1 3,562 Jan-06-2020, 06:37 PM
Last Post: micseydel
  Read in trades from emails semantina 2 2,064 Nov-06-2019, 06:12 PM
Last Post: semantina
  smtplib mail without subject anna 2 2,431 Apr-24-2019, 05:44 AM
Last Post: anna

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020