From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.86.87.8 with SMTP id k8cs247951fgb; Wed, 17 Mar 2010 12:28:00 -0700 (PDT) Received: by 10.224.59.28 with SMTP id j28mr409796qah.109.1268854079067; Wed, 17 Mar 2010 12:27:59 -0700 (PDT) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id 42si947544qyk.41.2010.03.17.12.27.58; Wed, 17 Mar 2010 12:27:59 -0700 (PDT) Received-SPF: pass (google.com: domain of sup-talk-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) client-ip=205.234.109.19; Authentication-Results: mx.google.com; spf=pass (google.com: domain of sup-talk-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) smtp.mail=sup-talk-bounces@rubyforge.org Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 5E8201858300; Wed, 17 Mar 2010 15:27:58 -0400 (EDT) Received: from proofpoint1.lanl.gov (proofpoint1.lanl.gov [204.121.3.25]) by rubyforge.org (Postfix) with ESMTP id 23E8E18582DF for ; Wed, 17 Mar 2010 15:25:16 -0400 (EDT) Received: from mailrelay1.lanl.gov (mailrelay1.lanl.gov [128.165.4.101]) by proofpoint1.lanl.gov (8.14.3/8.14.3) with ESMTP id o2HJP3Cj032739 for ; Wed, 17 Mar 2010 13:25:13 -0600 Received: from ccn-mail.lanl.gov (ccn-mail.lanl.gov [128.165.4.105]) by mailrelay1.lanl.gov (Postfix) with ESMTP id 0CD7D245EBC for ; Wed, 17 Mar 2010 13:25:03 -0600 (MDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by ccn-mail.lanl.gov (Postfix) with ESMTP id 0B4D041005B for ; Wed, 17 Mar 2010 13:25:03 -0600 (MDT) X-NIE-2-Virus-Scanner: amavisd-new at ccn-mail.lanl.gov Received: from guava.lanl.gov (guava.lanl.gov [128.165.229.10]) by ccn-mail.lanl.gov (Postfix) with ESMTP id DADE1410058 for ; Wed, 17 Mar 2010 13:25:02 -0600 (MDT) From: John Bent To: sup-talk In-reply-to: <1268341771-sup-2631@guava.lanl.gov> References: <1268341771-sup-2631@guava.lanl.gov> Date: Wed, 17 Mar 2010 13:25:02 -0600 Message-Id: <1268853590-sup-9103@guava.lanl.gov> User-Agent: Sup/0.10.2 Content-Transfer-Encoding: 8bit Content-Type: multipart/mixed; boundary="=-1268853902-640430-89227-823-1-=" MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=1.12.8161:2.4.5, 1.2.40, 4.0.166 definitions=2010-03-17_15:2010-02-06, 2010-03-17, 2010-03-17 signatures=0 Subject: Re: [sup-talk] printing emails (but not attachments) X-BeenThere: sup-talk@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: User & developer discussion of Sup List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: sup-talk-bounces@rubyforge.org Errors-To: sup-talk-bounces@rubyforge.org --=-1268853902-640430-89227-823-1-= Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Excerpts from John Bent's message of Thu Mar 11 14:11:21 -0700 2010: > I've been piping emails into muttprint which works well unless there's > a binary attachment. When there's a binary attachment, muttprint > prints it and it usually takes tens and tens of pages. Whoops. > > Anyone else figure out how to print emails but not attachments? > Well, I'm sure I've once again reinvented the wheel but I wrote my own script to print emails without printing binary attachments. It reads an email, pipes the headers to muttprint, then pipes text/plain and text/html through w3m into muttprint, for everything else it pipes "# Attachment: filename (type)." It requires w3m and muttprint to be in the user's path. I'm sorry that it's horribly in violation of sup philosophy but I wrote it in python. :( Sorry but my ruby is just barely good enough to do 'if' statements in my hooks. It's attached in case anyone else wants it. I'm scared I really did just reinvent the wheel, otherwise I'd add it to the wiki. To print an email from sup using this, hit '|' in thread-view-mode to open a pipe and then just type sup-print (assuming you've put this attachment in your path). I believe all the python imports it uses come standard. -- Thanks, John --=-1268853902-640430-89227-823-1-= Content-Disposition: attachment; filename="sup-print" Content-Type: application/octet-stream; name="sup-print"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Ag ICAgIHBpcGVfbXV0dCggb3V0ICsgIlxuIiwgbXV0dCApCiAgICBlbGlmIHBh cnQuZ2V0X2ZpbGVuYW1lKCkgaXMgbm90IE5vbmU6CiAgICAgICAgcGlwZV9t dXR0KCIjIEF0dGFjaG1lbnQ6ICVzICglcylcbiIgJSAocGFydC5nZXRfZmls ZW5hbWUoKSx0eXBlKSxtdXR0KQoKaWYgX19uYW1lX18gPT0gJ19fbWFpbl9f JzoKICAgIG1zZyAgPSBnZXRfbWVzc2FnZSggKQogICAgbXV0dCA9IG9wZW5f bXV0dHByaW50KCkKICAgIHdyaXRlX2hlYWRlciggbXNnLCBtdXR0ICkKICAg IGZvciBwYXJ0IGluIG1zZy53YWxrKCk6IHdyaXRlX3BhcnQoIHBhcnQsIG11 dHQgKQogICAgbXV0dC5zdGRpbi5jbG9zZSgpCg== --=-1268853902-640430-89227-823-1-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ sup-talk mailing list sup-talk@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-talk --=-1268853902-640430-89227-823-1-=--