Skip to content
  • Stuff
  • Travel
  • Beverages
  • Support Antipaucity
  • Projects
  • About

antipaucity

fighting the lack of good ideas

automatically extract email attachments with common linux tools

Posted on 24 April 201421 April 2014 By antipaucity 3 Comments on automatically extract email attachments with common linux tools

I had need to automatically process emails to a specific address to pull attachments out, and this is how I did it:

$ yum install mpack

$ cat extract-attach.sh 
#!/bin/bash
rm -rf ~/attachtmp
mkdir ~/attachtmp
mv ~/Maildir/new/* ~/attachtmp
cd ~
munpack ~/attachtmp/*
rm -rf ~/attachtmp

$ crontab -l
*/5 * * * *	~/extract-attach.sh

Why, you may ask? Because I get a report a few times per day to the email address in question.


Note – this runs in my crontab every 5 minutes on a CentOS 6 x64 server; I’m sure the process is similar/identical on other distros, but I haven’t personally tried.

technical, tutorial Tags:attachment, centos, cron, email, how-to, linux, munpack, tutorial

Post navigation

Previous Post: kingmakers by karl ernest meyer and shareen blair brysac
Next Post: 35 great questions, part 4

More Related Articles

assessment and capacity analysis and planning for virtualization initiatives engineering
what is the “new” python? code
establishing a data haven cloud ideas
defaulting pxe boots with hpsa technical
effective error messages ideas
fallocate vs dd for swap file creation technical

Comments (3) on “automatically extract email attachments with common linux tools”

  1. Will Farmer says:
    6 July 2016 at 08:16

    Thanks for this. I’m attempting to use it in conjunction with an automated upload to FTP for reports. This makes it a whole lot easier.

  2. Warren says:
    7 July 2016 at 01:06

    Happy it could help you 🙂

  3. Daniel Bunte says:
    20 October 2017 at 03:53

    Thanks a lot, you saved my day! 🙂

Comments are closed.

April 2014
S M T W T F S
 12345
6789101112
13141516171819
20212223242526
27282930  
« Mar   May »
RSS Error: WP HTTP Error: cURL error 60: SSL: no alternative certificate subject name matches target hostname 'paragraph.cf'

Books

  • Debugging and Supporting Software Systems
  • Storage Series

External

  • Backblaze
  • Cirkul
  • Fundrise
  • Great Big Purple Sign
  • Password Generator
  • PayPal
  • Tech News Channel on Telegram
  • Vultr
  • Wish List

Other Blogs

  • Abiding in Hesed
  • Chris Agocs
  • Eric Hydrick
  • Jay Loden
  • Paragraph
  • skh:tec
  • Tech News Channel on Telegram
  • Veritas Equitas

Profiles

  • LinkedIn
  • Server Fault
  • Stack Overflow
  • Super User
  • Telegram
  • Twitter

Resume

  • LinkedIn
  • Resume (PDF)

Services

  • Datente
  • IP check
  • Password Generator
  • Tech News Channel on Telegram

Support

  • Backblaze
  • Built Bar
  • Cirkul
  • Donations
  • Fundrise
  • PayPal
  • Robinhood
  • Vultr
  • Wish List

35-questions 48laws adoption automation blog blogging books business career centos cloud community documentation email encryption facebook google history how-to hpsa ifttt linux money networking politics prediction proxy review scifi security social social-media splunk ssl startup storage sun-tzu tutorial twitter virtualization vmware wordpress work writing zombie

Copyright © 2025 antipaucity.

Powered by PressBook Green WordPress theme