Code Monkey home page Code Monkey logo

attachment-downloader's Introduction

Attachment Downloader

Build Status

Simple tool for downloading email attachments for all emails in a given folder using an IMAP client.

Install:

$ pip install attachment-downloader

Usage:

Usage: attachment-downloader [options]

Options:
  -h, --help            show this help message and exit
  --host=HOST           IMAP Host
  --username=USERNAME   IMAP Username
  --password=PASSWORD   IMAP Password
  --imap-folder=IMAP_FOLDER
                        IMAP Folder to extract attachments from
  --filename-template=FILENAME_TEMPLATE
                        Attachment filename (jinja2) template.
  --output=DOWNLOAD_FOLDER
                        Output directory for attachment download
  --delete              Delete downloaed E-Mails from Mailbox
  --delete-copy-folder=DELETE_COPY_FOLDER
                        IMAP folder to copy emails to before deleting them

Example:

$ attachment-downloader --host imap.example.com --username [email protected] --password pa55word \\
    --imap-folder invoices --output ~/Downloads

Requirements

This tool requires Python 3+

This is not compatible with Python 2.

Filename Template

By default attachments will be downloaded using their original filename to the folder specified by -output.

You can customise the download filename using a jinja2 template for the argument --filename-template.

The following variables are supported:

  • message_id
  • attachment_name
  • attachment_idx
  • subject
  • local_date

In the following example, downloads will be placed within the output folder grouped into a folder hierarchy of date, message ID, subject:

--filename-template="{{local_date}}/{{ message_id }}/{{ subject }}/{{ attachment_name }}"

attachment-downloader's People

Contributors

jamesridgway avatar rschueler avatar devfaz avatar jinnko avatar mtstevensw avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.