{"id":36,"date":"2011-11-14T16:57:53","date_gmt":"2011-11-14T16:57:53","guid":{"rendered":"http:\/\/www.guymerritt.net\/?p=36"},"modified":"2013-09-07T15:01:27","modified_gmt":"2013-09-07T15:01:27","slug":"using-mutt-and-cron-to-email-wattachment","status":"publish","type":"post","link":"http:\/\/www.webputzer.com\/?p=36","title":{"rendered":"Using mutt and cron to email w\/attachment"},"content":{"rendered":"<p><span style=\"font face=tahoma; font size=18px; font-weight: normal; line-height: 120%;\">Well&#8230;this was kind of a pain to get working, for an idiot like me. I wanted to get a tarred version of a particular log file via email &#8211; as an attachment &#8211; and I had no idea where to start. In other words, I wanted to have an email sent to me, with an attachment, using an automated (cron driven) script. The following little script, which uses mutt, did the trick. I found the info on the net, somewhere. The script, below, deletes an old .tar file and creates a new one, then performs the mail function (the important part). The &#8220;message.txt&#8221; file is the body of the email. A big thank you to someone, somewhere &#8211; I can&#8217;t recall where I finally dug this up.<br \/>\n<\/span><br \/>\n<span style=\"background-color: #fafae8; line-height: 106%;\">#!\/bin\/sh<br \/>\nrm -rf logs.tar<br \/>\ncd \/home\/vpopmail\/qtrap<br \/>\ntar -cvf logs.tar logs<br \/>\ncp ***tar \/root<br \/>\nmutt -s &#8220;Qtrap Logs&#8221; -a logs.tar me@myemail.com,me_somwhere_else@aol.com \\<br \/>\n&lt; \/root\/message.txt<\/span><\/p>\n<p>And my mail looks like this:<br \/>\n<img decoding=\"async\" src=\"http:\/\/www.webputzer.com\/images\/cron.png\" alt=\"\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Well&#8230;this was kind of a pain to get working, for an idiot like me. I wanted to get a tarred version of a particular log file via email &#8211; as an attachment &#8211; and I had no idea where to start. In other words, I wanted to have an email sent to me, with an [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"h5ap_radio_sources":[],"footnotes":""},"categories":[21],"tags":[],"class_list":["post-36","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"http:\/\/www.webputzer.com\/index.php?rest_route=\/wp\/v2\/posts\/36","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.webputzer.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.webputzer.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.webputzer.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.webputzer.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=36"}],"version-history":[{"count":0,"href":"http:\/\/www.webputzer.com\/index.php?rest_route=\/wp\/v2\/posts\/36\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.webputzer.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=36"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.webputzer.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=36"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.webputzer.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=36"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}