tommi
tommi

Reputation: 6973

Convert emails to HTML or PDF programmatically

I'm trying to convert emails from my mailbox, into either HTML or PDF programatically.

My main motivation is to able to create summary of emails on a web page, and able to expand a particular email and view the entire content of the email.

I figured PDF might be an option since I do not have to worry about linking the contents in the email (eg. image) to the storage location of the image.

I'm starting with the ruby Mail gem and I also came across mhonarc. I'm not sure if mhonarc is a too much for what I'm trying to do, so I decided to ask here to see if there alternatives out there.

Upvotes: 2

Views: 306

Answers (2)

three
three

Reputation: 8478

I would approach email conversion via the IMAP library (there might be newer ones out by now) and then serve everything from a simple Sinatra app in the browser. You can use a template language to generate simple html output and logic. Of course you can also use prawn for pdf generation. Many different ways to get there... Not sure why you don't just load emails and show partial content. Life can be so simple.

Upvotes: 0

Alex Teut
Alex Teut

Reputation: 844

Gem pdfkit is used for generating PDFs. Please read readme, gem requires wkhtmltopdf library in your system.

Upvotes: 1

Related Questions