{"id":2330,"date":"2014-04-24T11:53:38","date_gmt":"2014-04-24T15:53:38","guid":{"rendered":"http:\/\/antipaucity.com\/?p=2330"},"modified":"2014-04-24T11:53:38","modified_gmt":"2014-04-24T15:53:38","slug":"automatically-extract-email-attachments-with-common-linux-tools","status":"publish","type":"post","link":"https:\/\/merikebi.warrenmyers.com\/?p=2330","title":{"rendered":"automatically extract email attachments with common linux tools"},"content":{"rendered":"<p>I had <a href=\"http:\/\/superuser.com\/q\/187106\/978\">need<\/a> to automatically process emails to a specific address to pull attachments out, and this is how I did it:<\/p>\n<pre>\n$ yum install mpack\n\n$ cat extract-attach.sh \n#!\/bin\/bash\nrm -rf ~\/attachtmp\nmkdir ~\/attachtmp\nmv ~\/Maildir\/new\/* ~\/attachtmp\ncd ~\nmunpack ~\/attachtmp\/*\nrm -rf ~\/attachtmp\n\n$ crontab -l\n*\/5 * * * *\t~\/extract-attach.sh\n<\/pre>\n<p>Why, you may ask? Because I get a report a few times per day to the email address in question.<\/p>\n<hr \/>\n<p>Note &#8211; this runs in my crontab every 5 minutes on a CentOS 6 x64 server; I&#8217;m sure the process is similar\/identical on other distros, but I haven&#8217;t\u00a0personally\u00a0tried.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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, &hellip;<br \/><a href=\"https:\/\/merikebi.warrenmyers.com\/?p=2330\" class=\"more-link pen_button pen_element_default pen_icon_arrow_double\">Continue reading <span class=\"screen-reader-text\">automatically extract email attachments with common linux tools<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[41,45],"tags":[116,166,208,275,390,450,505,789],"keyring_services":[],"class_list":["post-2330","post","type-post","status-publish","format-standard","hentry","category-technical","category-tutorial","tag-attachment","tag-centos","tag-cron","tag-email","tag-how-to","tag-linux","tag-munpack","tag-tutorial"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/2330","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2330"}],"version-history":[{"count":0,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/2330\/revisions"}],"wp:attachment":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2330"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2330"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2330"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fkeyring_services&post=2330"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}