Giter Site home page Giter Site logo

crumohr / email2pdf Goto Github PK

View Code? Open in Web Editor NEW

This project forked from andrewferrier/email2pdf

0.0 2.0 0.0 308 KB

Script to convert emails to PDF from the command-line, as well as detach recognized attachments. Helps to process incoming emails and assist automatically with a non-paper paperwork workflow. Designed to work in tandem with getmail to convert forwarded emails to PDF automatically.

License: MIT License

Makefile 1.73% Python 98.27%

email2pdf's Introduction

email2pdf

Travis CI Status

email2pdf is a Python script to convert emails to PDF from the command-line. It is not interactive (it doesn't run from a browser or have a GUI), but is intended to be run as a mail delivery agent - it won't retrieve emails for you, but it will take them from standard input as an MDA will and 'deliver' them to PDF files. It is well-placed to use together with getmail, perhaps run on a schedule using cron or similar. You can also just use it as a standalone utility to convert a raw email (normally an .eml file) to a PDF. Type email2pdf --help for more information on usage and options available.

For more information on hacking/developing email2pdf, please see HACKING.md. Note that use is subject to the license conditions.

Installing Dependencies

Before you can use email2pdf, you need to install some dependencies. The instructions here are split out by platform:

Debian/Ubuntu

  • wkhtmltopdf - Install the .deb from http://wkhtmltopdf.org/ rather than using apt-get to minimise the dependencies you need to install (in particular, to avoid needing a package manager).

  • getmail - getmail is optional, but it works well as a companion to email2pdf. Install using apt-get install getmail.

  • Others - there are some other Python library dependencies. Run make builddeb to create a .deb package, then install it with dpkg -i mydeb.deb. This will prompt you regarding any missing dependencies.

OS X

  • wkhtmltopdf - Install the package from http://wkhtmltopdf.org/downloads.html.

  • getmail - TODO: This hasn't been tested, so there are no instructions here yet! Note that getmail is optional.

  • Install Homebrew

  • xcode-select --install (for lxml, because of this)

  • brew install python3 (or otherwise make sure you have Python 3 and pip3 available).

  • brew install libmagic

  • pip3 install -r requirements.txt

Configuring getmail

getmail is not strictly a dependency, but when it is combined with email2pdf, it can be used to retrieve new emails from a remote IMAP server and automatically convert them to PDFs locally. The getmailrc.sample file in the repository can be used as a starting point for your own getmailrc to do this. Note that the sample will need editing, of course - see the getmail documentation for more information on that. Also, it is configured by default to delete remote emails from the server once they are converted - be careful with that. You might want to consider setting up your crontab something like this:

  @hourly getmail --verbose | logger

This will ensure that getmail is invoked hourly to fetch email, and log its output to syslog.

If your mailserver is unreliable, you might want to consider wrapping the getmail cron job with cromer.

Configuring procmail

I don't have any direct experience using procmail with email2pdf, so don't have any specific setup steps, although I understand it can be made to work. You should be aware that currently there is an outstanding issue with I/O encodings with procmail that you may need to work around - see issue #76 for more information.

email2pdf's People

Contributors

andrewferrier avatar crumohr avatar griff avatar srirams avatar

Watchers

 avatar  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.