Skip to content

Scrapes emails from given list of emails and efficiently stores attachments in user specific folder.

License

Notifications You must be signed in to change notification settings

ashimdahal/attachment-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Read and store Email attachments

As simple as the title goes, this small python script will go through your email, filter emails from the last time it checked them and downloads the attachments in the following pattern: attachments_for_<username at the email address>

How to use?

create file named usernamepwd.txt and add the email and credentials for your users. And run the following command

pip install -r requirements.txt
python main.py <hostname> 

<hostname> should be your hostname. Example: mail.thetwl.org, mail.ashimdahal.com, etc.

Format for usernamepwd.txt

[email protected], password123
[email protected], P4$$w0rD

// you can either include or remove spaces between the user-email and password as it's getting stripped nonetheless

Demo Example:

python main.py imap.gmail.com

How to run with gmail?

In order to run the script with gmail do the following steps:

  1. Activate 2FA in your google account.
  2. Under the newly activated 2FA, you'll have option to generate application spefcific password.
  3. Generate an application spefcific password and keep that password in the usernamepwd.txt file.

Todo

  • Add a better way to share password than plain .txt file.
  • Login to office 365 using OAuth2.
  • Increase efficienty by not only tracking last date for the attachments saved but also last date for any emails checked.

About

Scrapes emails from given list of emails and efficiently stores attachments in user specific folder.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages