Linux - process email with PDF into HTML with inline image

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
markmark

Linux - process email with PDF into HTML with inline image

Post by markmark »

Trying to get confirmation that the following processing/function concept would be possible...

On a Linux server, emails are received from a Fax gateway/software which converts faxes to PDF attachments. The incoming email is then re-directed/forwarded to an external address for collection.

I want IM to process the PDF attachment (on the server received email), so that it converts the 1st page of the PDF and creates a lo-res jpg (say 420 x 594) to be inserted inline into the forwarded HTML email (to the external address) with the original PDF attached.

The end result is an email with the PDF (fax) attached, but also an immediately viewable 1st page image of the fax within the message saying "You received a fax...", etc. This allows much easier browsing through emails to find required item, without having to open each PDF.

Has anyone seen this function in action? Does IM work with emails directly (or have to save attachment first, etc)? Any tips, pointers, suggestions?

Thanks.

* I searched through forums, didn't see anything similar, and am noob to IM (and linux).
Looking for concept confirmation, and any tips where to start.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Linux - process email with PDF into HTML with inline image

Post by anthony »

IM does not work directly with email. But you can use various mime handling tools to extract the attachment for Im to then process.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
markmark

Re: Linux - process email with PDF into HTML with inline image

Post by markmark »

Thanks for the no-direct-email-processing info... I am thinking the following steps need to be done -

1. Check for received email, if it's a Fax email (with attached PDF document), save PDF with standard "filename" into folder.
2. Use IM to convert 1st page of PDF document to Jpg image, saving with standard "filename" into folder.
3. Forward existing email to external address, as HTML format (using template file), which includes the standard filename image as an inline image.

Anyone work on Linux who knows what 'scripting' language would be suitable for the above processes? And I am not exactly asking for the solution (although if you have one, I'll grab it! :-)... but, just trying to work out what items are needed to get it done on Linux... ie. IM, plus some email processing util (or standard command?), etc.

Issues might be with how to name the filenames, and keep separate if handling multiple incoming emails at same time (id from email?).

I know I'm asking lots (slightly off-topic), but really lost with trying to solve this.

Mark :lol:
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Linux - process email with PDF into HTML with inline image

Post by anthony »

procmail will process incoming mail and can look for your attachment. It can then call any external script to filter the mail and process it in any way. The original procmail can then forward the mail anywere, or save it before or after processing into folders (mbox, or mh mail folders).

I use procmail myself to run mail thru spamassisian, a personal spam filter (looking for things like chinese spam), and a check for a extrenaly supplied filter. placing such mail into folders for FAST check/delete. It also removes 'known mail list and frends' mail from such processing, and for a lareg set of spcial mail lists saved the mail into multiple folders.

procmail is difficult but worth while, for filtering incomming mail. start slow and build it up.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply