Re: character limit

2001-01-28 Thread ed

On Sun, Jan 28, 2001 at 01:13:14PM -0500, Timberwolf wrote:
 Daniel:
 
 Where is the standard for line wrapping limits set? Is that in an 
 RFC? If so, can you point me to the RFC that lays out the proper 
 form for outbound message character wrapping.
 
 Thanks,
 
 - -Timberwolf

Please see RFC 1855 for "netiquette" guidelines, which include this:

Limit line length to fewer than 65 characters and end a line
with a carriage return.

There are also technical reasons mentioned in various RFCs.  RFC 821 --
according to an URL mentioned below -- in section 4.5.3 outlines a
maximum size for text lines: 1000 characters including CRLF.  According
to that RFC and several others related to MIME, some MTAs will wrap
lines of certain content types, if the lines excedes 76 characters (this
is considered bad practice, but something which must be guarded
against).

Here's an url which explains the reasons this is considered good
practice:

http://www.lemis.com/email/email-format.html

cheers --

Ed



Re: vim a great editor (Was: Re: character limit)

2001-01-29 Thread ed

On Mon, Jan 29, 2001 at 10:33:36AM +0100, Jan Johansson wrote:
[snip]
 As I understand it vim can detect the type of text you are
 writing (like it does for syntax highlight) and choose options
 after that.

Yes, you could -- file type detection works either by filename extension
or, if that fails, by examining the first line or the first few lines in
the text.  I use that feature for source code editing ...

To use it for email ... you could edit $VIMRUNTIME/scripts.vim so it'd
detect that you were editing a mail message based on the initial line,
if you've got mutt configured correctly (the first line in the message
which I'm editing right now is the From: line which my message will
contain -- you could detect that or the equiv).

But that seems like more indirection than is useful...

cheers --

Ed



Re: Inbox repair tool

2001-02-27 Thread ed

On Tue, Feb 27, 2001 at 08:15:11AM +0530, Suresh Ramasubramanian wrote:
 Osamu Aoki proclaimed on mutt-users that: 
 
  Also, exim+procmail supports MAILDIR too.
  
  Delivery to folders of whatever kind (MH, maildir, mbox etc) is a
  job for the local delivery agent.  Right - procmail does maildir
  (at least the newer ones), and qmail's maildrop (I think) does that
  as well.

qmail can use either mbox or maildir -- but from what I've read, maildir
was introduced by qmail.  (and qmail's docs include a small rant about
mbox and why we should all switch to maildir. ;-)  maildrop is
unrelated; it seems to be somewhat like procmail -- it does filtering,
and can store messages in either mbox files or in maildir directories.

I have a question which is somewhat related to the original message.  If
I want to operate on a large block of messages (say, 200-1000) -- how
can I do so?  Without holding down the 't' key, that is ... ;-)  I'm
hoping there's a tag operation which operates on a range of message
numbers; but I haven't found such a thing in the docs yet.

thanks --

Ed



pipe filter

2009-08-04 Thread ed
Hi All,

Today I was wondering if it would be possible to send an entire message
through a filter before taking the result of that filter as the input to
form a new message.

  '| /home/$USER/bin/filter | vim -'

Something like that so that when the user has finished editing the
message can then be sent in a normal way from mutt.

A colleague suggested using mutt -H, but from the pipe command I think
mutt looses the users stdin/stdout, if that makes any sense.

Any ideas?

Best regards

Ed


signature.asc
Description: Digital signature


Re: pipe filter

2009-08-05 Thread ed
On Tue, Aug 04, 2009 at 10:58:32PM -0500, Kyle Wheeler wrote:
 On Tuesday, August  4 at 07:14 PM, quoth ed:
  Today I was wondering if it would be possible to send an entire 
  message through a filter before taking the result of that filter as 
  the input to form a new message.
 
   '| /home/$USER/bin/filter | vim -'
 
 Sure, it can be done. Not exactly like that, though. The thing is that 
 mutt creates the temporary file for new messages; it doesn't simply 
 pass the message as standard in for the editor. So your filter has to 
 respect the fact that mutt already created the file. Try this: set 
 $editor to be a script... let's say ~/myfilter.sh. Now create the 
 script:
 
  #!/bin/sh
  filename=$1
  /home/$USER/bin/filter $filename $filename.tmp
  mv $filename.tmp $filename
  exec vim $filename
 
 Of course, I may have misunderstood what you're asking.

Hi Kyle,

This doesn't do quite what I'm after as I want to take the original
email as input to the script, not what mutt has created as the reply.
Mainly this is so that I can inspect the headers of the original before
generating the headers of the reply. I know it's a lot of senselses work
but I want to set the From: header to match the fist Delivered-To header
of the original...

Thanks

Best regards


Re: pipe filter

2009-08-05 Thread ed
On Wed, Aug 05, 2009 at 07:40:27AM -0500, Kyle Wheeler wrote:
 On Wednesday, August  5 at 08:06 AM, quoth ed:
  Mainly this is so that I can inspect the headers of the original 
  before generating the headers of the reply. I know it's a lot of 
  senselses work but I want to set the From: header to match the fist 
  Delivered-To header of the original...
 
 Ahhh, well, you may be able to work around that too.
 
 I would do it something like this: create a reply macro, so that 
 when you hit r (or whatever you use to reply to messages), it pipes 
 the message to a script, sources a file (generated by that script), 
 and then replies to the message. Like this:
 
  macro pager,index r 
 'pipe-message~/.myfilter.shenterenter-commandsource 
 ~/.myfilter.outenterreply'
 
 Then your filter script can look something like this:
 
  #!/bin/sh
  lastdt=`awk '/^$/{print lastdt;exit}/^Delivered-To: /{lastdt=$2}'`
  echo my_hdr 'From: $lastdt'  ~/.myfilter.out
 
 Thus, when you reply, your filter script creates a file full of all 
 the commands and/or settings you want to make mutt do. The macro then 
 sources that file, which runs all those commands, and THEN issues the 
 reply.

Brilliant idea Kyle, thanks very much I'll give that a go and let you
know how I get on.

Thanks again



signature.asc
Description: Digital signature


Re: why is there no auto $ (save changes to mailbox)?

2009-08-11 Thread ed
On Mon, Aug 10, 2009 at 09:23:59AM -0400, Marc Vaillant wrote:
 Hi all,
 
 I've been a happy mutt user for over a decade.  Of course there are a
 few minor features here and there that I wish mutt had.  The one that's
 really getting to me lately is that as far as I know, there is no
 automatic way to execute $.  i.e. save changes to mailbox.  This is
 particularly a problem for IMAP because losing your internet connection
 (e.g. sleeping your laptop) usually means losing mailbox changes.  If
 there is a mechanism for accomplishing this now please let me know.
 Otherwise, it seems natural for it to be an action during mail check?
 Shouldn't there be at least an auto save/recover mechanism? 

Hi,

Personally, I'd use screen :)

Best regards


signature.asc
Description: Digital signature


display name

2009-10-22 Thread ed
Hi All,

Is there a way to change the display of the From header in a message in
the pager view?

I'd like to for example show 'Mr Ed' rather than 'ed'. I'm not on about:

set realname='ed'
set from=e...@s5h.net
set use_from=yes
set use_envelope_from=yes

What I'm after is changing how other people's From fields appear to me
during index and pager views. (Sorry I'm never good at explaining
things).

Thanks

Ed


signature.asc
Description: Digital signature


manual-2.html

2009-10-29 Thread ed
Don't know if this has been reported before in the online manual:

http://www.mutt.org/doc/manual/manual-2.html:

$ diff manual-2.html*
488c488
 ^F  forget-passphrase   whipe PGP passphrase from memory
---
 ^F  forget-passphrase   wipe PGP passphrase from memory





signature.asc
Description: Digital signature


Re: manual-2.html

2009-10-30 Thread ed
On Thu, Oct 29, 2009 at 11:11:40AM -0700, Robert Holtzman wrote:
 On Thu, 29 Oct 2009, ed wrote:

 Don't know if this has been reported before in the online manual:

 http://www.mutt.org/doc/manual/manual-2.html:

 $ diff manual-2.html*
 488c488
  ^F  forget-passphrase   whipe PGP passphrase from memory
 ---
 ^F  forget-passphrase   wipe PGP passphrase from memory

 Manual-2.html doesn't show up in http://www.mutt.org/doc/manual.  
 http://www.mutt.org/doc/manual is a directory but when clicked on it  
 doesn't open to display files. Instead it opens the old manual.

How come you're using Alpine?

The 'whipe' word is in the latest copy online, but it doesn't appear in
the devel copy. I'm just suggesting that it gets touched in the version
that's indexed by google.



signature.asc
Description: Digital signature


Re: Deleting messages trash-can-style

2010-08-22 Thread ed
On Sun, Aug 22, 2010 at 06:51:31PM +0200, Michael Ludwig wrote:
 I almost deleted a message I intended to keep from an mbox. The message
 was accidentally marked as D, and when switching to another mbox, it was
 just a brief hesitation (wasn't entirely sure what would be deleted now)
 that kept me from losing it.
 
 Can I configure Mutt to save deleted messages to another folder or mbox
 (as GUI mail clients do) instead of simply deleting it?

I thought that was the default behaviour? If not, you might want to look
at doing this:

  macro   index   d   save-message=.Trash\n
  macro   pager   d   save-message=.Trash\n

That should work, but you'll want to change .Trash to something else,
I'm using Maildir style (which I found more efficient with header
caching).

-- 
Best regards,
Ed http://www.s5h.net/



signature.asc
Description: Digital signature


Christmas theme

2010-12-17 Thread ed
Hi All,

In keeping with Christmas screen savers I thought I'd customise mutt in
colours that go with the season.

TERM=xterm-256color is required

  http://www.s5h.net/code/mutt/themes/ir_christmas.theme

Hope you find it goes with cheerful jumpers and socks.

-- 
Best regards,
Ed http://www.s5h.net/



signature.asc
Description: Digital signature


Re: Mutt 256 color themes

2011-05-20 Thread ed
On Tue, Jan 05, 2010 at 05:37:59PM +0900, Horacio Sanson wrote:
 Currently I am using the ivy league color theme from Aaron Toponce (see link
 below) with a couple of modifications to make it work in my transparent KDE
 Konsole.
 
 http://pthree.org/2008/10/22/ivy-league-theme-for-mutt/
 
 I was looking for similar 256 color themes for mutt but there does not appear 
 to
 be any on the whole Internet.
 
 Are there any other themes around? Or is anyone willing to share their colors?

I did some before Christmas as I fancied something a bit different
whilst xsnow was running in the background.

You can find my themes here:

  http://www.s5h.net/wiki/Mutt

Let me know what you think or if there are any particular colours you'd
like and I'll see what I can do.

-- 
Best regards,
Ed http://www.s5h.net/



signature.asc
Description: Digital signature


Re: coloured threads

2012-11-11 Thread ed
On Sun, Nov 11, 2012 at 05:13:36PM +0100, Eric Smith wrote:
 I am coming across more and more (non techy) html email with colouring of
 threads. We, do fine with our reply prefixes (`' and friends).
 
 Anyone found a nice way to deliver html mail from mutt?
 
 Never though I would ever ask such a question.

Tap it out in your mail editor and set the content type to text/html
(ctrl-t) perhaps? Might work, never wanted to do that myself and I don't
have a mailer capable of reading HTML handy to find out.

-- 
Best regards,
Ed http://www.s5h.net/



Re: coloured threads

2012-11-11 Thread ed
On Sun, Nov 11, 2012 at 10:08:17PM +, ed wrote:
 Tap it out in your mail editor and set the content type to text/html
 (ctrl-t) perhaps? Might work, never wanted to do that myself and I don't
 have a mailer capable of reading HTML handy to find out.

Oh yeah, although it /may/ work, please don't do this since it breaks
plain text.

-- 
Best regards,
Ed http://www.s5h.net/



hook to set Content-Type after editing

2012-12-05 Thread ed
Hi all,

I have a weird setup where any UTF message causes me to create a
Content-Type of text/plain; 8bit, unknown. Is it possible to make a
hook which sets the Content-Type to text/plain; 8bit, us-ascii after
editing? I figure this should be simpler than correcting the underlying
problem in this particular environment.

Thanks

-- 
Best regards,
Ed http://www.s5h.net/



Saved Messages Header

2013-01-30 Thread Ed
How do I strip the headers when I save a message ?

Ed


Re: Saved Messages Header

2013-01-31 Thread Ed
On Jan 31, James Griffin wrote:

 Ok, what you need to do is when in the pager view, press 'v' to
 view attachments and it will list the mime parts of the mail. So
 if you just want to save the text part of the mail, you use the
 arrow keys to select the text/plain part, for example, and the press
 's' to save and at the bottom it will ask you where to save the
 file; i.e. ~/patricksresponse. Then when you use another terminal
 and use cat or less on the file it will show you just the mail
 itself, no headers. This code was inherited from mail(1) I believe
 as it has the same ability to save messages without headers, for
 example diff files or code files and scripts that you want to save,
 obviously you wouldn't need the headers with those types of mail.

Thank you, just what I was looking for. Works well.

Ed


Muttprint

2013-02-05 Thread Ed

I keep getting this error::

sh: 1: lpr: not found

but I don't know where it is coming from. In my muttprintrc I have the 
printer set to hp-psc-1310 which is the system printer and is using 
CUPS. Its a USB printer, so where is the lpr coming from ?


Ed


Re: Muttprint

2013-02-05 Thread Ed

On 02/05/2013 10:08 PM, Brandon Sandrowicz wrote:

On Tue, Feb 05, 2013 at 09:34:54PM -0500, Ed wrote:

I keep getting this error::

sh: 1: lpr: not found

but I don't know where it is coming from. In my muttprintrc I have
the printer set to hp-psc-1310 which is the system printer and is
using CUPS. Its a USB printer, so where is the lpr coming from ?

Ed


lpr is a line printer command, IIRC. It's blowing up because the command
does not exist (not installed), or is not in your $PATH. Why it's
attempting to use lpr instead of CUPS is probably down to a
configuration issue.



Well I set print_command=cups in my muttprintrc., so now it tells me 
it can't find cups.


Ed


Re: Muttprint SOLVED

2013-02-06 Thread Ed
On Feb 05, Ed wrote:
 I keep getting this error::
 
 sh: 1: lpr: not found
 
 but I don't know where it is coming from. In my muttprintrc I have
 the printer set to hp-psc-1310 which is the system printer and is
 using CUPS. Its a USB printer, so where is the lpr coming from ?
 
 Ed

Thanks to everyone for the help, printing is now working perfectly. Here is 
what I did to get it going. Installed cups-bsd. Set PRINTER to my printer, in 
this case its a hp-psc-1310. Set print command to lpr -P$PRINTER.

I already had everything set in .muttrc so I knew that was not the problem.

I haven't used mutt in years but happen to come across my old .muttrc so I 
thought I would give it a try. I don't remember having this much trouble with 
the printing.

Thanks again everyone for the help.

Ed


Page View

2013-02-10 Thread Ed
Is there any way while viewing a mail that contains html, attachment or is a 
pgp signed, that this information be shown at the bottom of the mail ?

I did not see anything in the manual that was of any value, unless I just 
overlooked it.

Thanks

Ed


Re: Page View

2013-02-10 Thread Ed
On Feb 10, Derek Martin wrote:
 On Sun, Feb 10, 2013 at 04:42:00PM +, Maurice McCarthy wrote:
  Sorry, don't think i read your post properly - tired!
 
 In your defense, the grammar was pretty horrible.  I still don't
 think I actually know what he was asking...
 
 Yes kids, grammar and spelling do actually matter... if you want
 people to be able to understand you.
 
 
 -- 
 Derek D. Martinhttp://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
 -=-=-=-=-
 This message is posted from an invalid address.  Replying to it will result in
 undeliverable mail due to spam prevention.  Sorry for the inconvenience.
 

First of all thanks for the compliment. At my age being thought of as a kid was 
a nice gesture.

From the manual section 2.2 ::

Below the headers, you see the email body which usually contains the message. 
If the email contains any attachments, you will see more information about them 
below the email body, or, if the attachments are text files, you can view them 
directly in the pager.

This what I'm referring to, and that is not what I'm seeing here. In the above 
message, below the header is a line that tells me it is pgp mail. Then after 
the pgp info is another line that says the following is signed. At the end of 
the message it tells me its the end of the signed message.

So, how do I get mutt to do what it says in the manual ?

This is my pager format in my muttrc.

%4C %Z %[!%b %e at %I:%M %p]  %.20n  %s%* -- (%P)

Thnaks

Ed











Re: sidebar patch

2013-02-10 Thread Ed
On Feb 10, Scott Stevenson wrote:
 On Sun, Feb 10, 2013 at 07:52:57PM +0530, dexter wrote:
  I'm new to mutt, just installed one and getting 
  to know it, how do i get sidebar in mutt, google
  search tells me that i have to apply a patch,
  i'm running on ubuntu, where can i get this patch?

From a terminal::

sudo apt-get install mutt-patched

Its in your repository. You probably also want to install mutt-print if you 
plan on printing out any mail.

Ed



Re: Page View

2013-02-10 Thread Ed
On Feb 10, s. keeling wrote:

 Might I suggest just commenting out your pager_format statement?  I've
 .muttrc's that go back to 2003.  In each one of them pager_format is
 not set.  I appear to see what the manual section you quote says.

Same result. I find nothing in the manual about pager format. What I was using 
I borrowed from another muttrc.



Alternate Addresses

2013-02-11 Thread Ed
Mutt is telling me that alternates is an unknown variable. I used::

set alternates=myem...@example.com

Of course I put the actual address in tha above. Where did I go wrong ?

Ed


Re: Alternate Addresses

2013-02-11 Thread Ed
On Feb 11, Ed wrote:
 Mutt is telling me that alternates is an unknown variable. I used::
 
 set alternates=myem...@example.com
 
 Of course I put the actual address in tha above. Where did I go wrong ?
 
 Ed

Thanks for the replies, I now see the error of my ways. Google sent me down the 
wrong path.

Ed


Mailcap

2013-02-12 Thread Ed
I have this in my mailcap to view images

image/*; /usr/bin/gpicview '%s'; test=test -n $DISPLAY

but when I open a message with an image attached mutt tells me there is no 
entry in mailcap, but if I go on to using v then the image is displayed.

I tried to see what I could find but did not have much luck.

Ed




Re: Mailcap

2013-02-12 Thread Ed
On Feb 12, Ed wrote:
 I have this in my mailcap to view images
 
 image/*; /usr/bin/gpicview '%s'; test=test -n $DISPLAY
 
 but when I open a message with an image attached mutt tells me there is no 
 entry in mailcap, but if I go on to using v then the image is displayed.
 
 I tried to see what I could find but did not have much luck.
 
 Ed


Answered my own question. Commented out set implicit_autoview in my muttrc.

Sorry for the bandwidth.

Ed


Re: xterm colored Mutt

2001-07-18 Thread Ed Robitaille

In order to turn on color in xterm enter the
following line in ~/.Xdefaults

*customization: -color

This will turn on color in all apps that use color in an xterm window.

Ed
-- 
_
 Linux, the choice  | One difference between a man and a machine 
 of a GNU generation   -o)  | is that a machine is quiet when well oiled.
/\  | 
   _\_v | 
| 
-



Re: xterm colored Mutt

2001-07-18 Thread Ed Robitaille

Ed Robitaille wrote
 In order to turn on color in xterm enter the
 following line in ~/.Xdefaults
 
 *customization: -color
 
 This will turn on color in all apps that use color in an xterm window.

Oops ! You'll have to re-start  'X' or or enter the command
that re-init's 'X' to see this go into effect.

Ed
-- 
_
 Linux, the choice  | Wiker's Law:  Government expands to absorb 
 of a GNU generation   -o)  | revenue and then some. 
/\  | 
   _\_v | 
| 
-



PGP and Mutt

2001-08-03 Thread Ed Robitaille

I would like to integrate mutt and pgp but
there doesn't seem to be much documentation
conserning this. Where can I obtain a tutorial ??

-- 
_
 Linux, the choice  | Flugg's Law:  When you need to knock on
 of a GNU generation   -o)  | wood is when you realize that the world is 
/\  | composed of vinyl, naugahyde and aluminum. 
   _\_v | 
| 
-



Re: searching in search results

2008-11-19 Thread Ed Blackman

On Wed, Nov 19, 2008 at 08:36:43PM -0600, lee wrote:

is it possible to somehow search within search results? For example,
if I want to find a message of which I know the From: header and a
word or some words of the body, how do I find it when going by either
the From: line or the body only would give too many results?


Search or limit, then ~f joe ~b 'meeting tonight' would search or 
limit to messages that have joe in the From: line and meeting 
tonight in the body.


By default, search terms are logically ANDed together so that only 
messages meeting all criteria are returned.  You can use ~f joe | ~b 
'meeting tonight' to return messages that meet ANY critera (logical 
OR), and ! for negation.


man muttrc and search for logical operators for examples.

Ed


signature.txt
Description: Digital signature


Re: Happy New Year!

2009-01-03 Thread Ed Blackman

On Sat, Jan 03, 2009 at 12:07:40AM -0500, Chris Jones wrote:
Firing up an xterm (or creating a new gnu/screen window) .. firing up 
another instance of mutt ..  drilling down to the particular message I 
need ..  having gnu/screen do a screen split .. bringing up the other 
instance of mutt in said split window ..  and what..?  repeat the 
process if I happen to need to refer to a second message?


That's laborious if you do it manually, but computers are good at grunt 
work, and mutt is good at giving you hooks to automate things.


This doesn't do split screens, because I don't like them, but here's my 
solution.


macro index Escs sync-mailbox!screen -X screen mutt -f =sent\n
macro index F 'sync-mailboxenter-commandset my_folder=`mutt-prompt Change to folder \\`; push 
!screen -X screen mutt -f $my_folder\enter\enter'

I've got a couple more of the first variety to speed access to mailboxes 
I open all the time, and the second variety is so that I don't have to 
have a key for each box.  It uses the mutt-prompt shell script, which 
has been posted recently, but I'll be happy to send it to you.


I don't do this often, but you could use the ^ special variable (which 
holds the current folder name) if you commonly accessed the same folder.  
Untested attempt:

   macro index Escc sync-mailbox!screen -X screen mutt -f ^\n

Explanation:
sync-mailbox syncs unsaved changes to the current mailbox (will 
delete messages marked for deletion, make sure that's what you want, 
leave it out if not).


!screen -X creates a shell, and sends the following command to the 
currently running screen session.


screen mutt opens a new screen window and runs mutt instead of a 
shell.


-f =mailbox opens mutt with a given mailbox instead of the inbox.

Ed


signature.txt
Description: Digital signature


Include message attributes in print_command?

2009-01-10 Thread Ed Blackman

I use Mutt on Linux, and use enscript to print to my cups-pdf printer:
  set print_command=enscript --highlight=mail -P ToPDF

This produces a PDF named Enscript_Output.pdf in ~/PDF when I print.

However, Enscript_Output isn't very descriptive, and if I print one 
message, then print another, the file gets overwritten.  I'd like to be 
able to put the subject line and date in the filename.


cups-pdf uses the document title to create the filename, so if I do:
  set print_command=enscript --highlight=mail -P ToPDF --title Foo
I get Foo.pdf instead.

So all I need to do is to get Mutt to pass the message subject and date 
to enscript, but can't find any way to do this.


Is there a way to do that short of patching mutt?

If not, could someone who has worked on mutt's source give an opinion on 
how hard it would be to support the index format expandos in 
print_command?  Then I could add --title '%s %D' to my print_command.


Ed


signature.txt
Description: Digital signature


Re: Include message attributes in print_command?

2009-01-11 Thread Ed Blackman

On Sat, Jan 10, 2009 at 11:48:04PM -0800, George Davidovich wrote:

On Sat, Jan 10, 2009 at 03:27:56PM -0500, Ed Blackman wrote:
So all I need to do is to get Mutt to pass the message subject and date 
to enscript, but can't find any way to do this.


Is there a way to do that short of patching mutt?


You may want to consider using the Message-ID (and possibly a
re-formatted date) instead of the Subject given that most all Subject
lines are problematic (length, use of spaces and extraneous characters,
etc.).


cups-pdf handles this, replacing problematic characters with underscores.
If the title of the document is attributes in print_command?, the PDF 
will be named attributes_in_print_command_.pdf.



  If the concern is simply generating unique file names, then
mktemp(1) might be the better approach.


I know that the (Subject, Date) tuple isn't guaranteed to be unique the 
way that Message-ID should be, much less the output of mktemp.  But I 
want a title that has fewer collisions (the default always collides), 
but is also human-readable.


Most of the time I just want to save the file some place else with 
another name, or batch them for printing in a certain order.  With a 
fixed title giving a fixed filename, I had to use a select message, 
print message, switch to another shell to move/print, switch back loop.  
Having a better title will allow me to select, select, select, print, 
switch, move, move, move.



That said, the following will work.  Modify accordingly for use with
enscript. 


Thanks for the concept!  Here's what I ended up with:

macro index,pager p 'enter-commandset pipe_decodeenterpipe-messagemuttPrint 
--highlight=mail -P ToPDFenter'

#!/bin/sh
#
# muttPrint
#
# macro index,pager p \
# 'enter-commandset pipe_decodeenterpipe-messagemuttPrint [enscript 
args]enter'

# Save message contents
MSG=$(cat -)

# get Subject, striping all occurrances of 'Re: ?' and any initial spaces
SUBJ=$(echo $MSG | formail -cx Subject | sed -e 's/Re: \?//g' -e 
's/^\s\+//')

# get Date, and parse into a more regular, but still human-readable format
DATE=$(date -d $(echo $MSG | formail -cx Date) +%Y-%m-%d-%H:%M:%S)

# send message to print with appropriate title and all passed enscript args
echo $MSG | enscript --title $SUBJ $DATE $@

Ed



signature.txt
Description: Digital signature


Re: Open a partially encrypted mail

2009-01-20 Thread Ed Blackman

On Tue, Jan 20, 2009 at 02:02:15PM +, Jörg Sommer wrote:

I've got a bounce of a message that was encrypted but not with my key.
When opening the message mutt asks for the PGP passphrase but it fails,
because it wasn't encrypted with my key. So mutt refuses to show me the
rest of the message.

I've the same problem with view-attachments. Mutt asks for the
passphrase, but if this fails I get nothing. It's not possible to select
the encrypted part and pipe it to an external command or only look at the
attachment structure of the mail.


:unset pipe_decode, then pipe the message or attachment to an external 
pager like more or less.


There might be a more elegant way, but that will let you see the 
content.


Ed


signature.txt
Description: Digital signature


Attach: pseudoheader and files with spaces

2009-01-23 Thread Ed Blackman
I've been really enjoying the Vim macro that was posted a little while 
ago that prompts you to attach files if it detects words like attached 
in the mail, and appends mutt's Attach: pseudoheader to the header block 
with the name of the file.


I'm running into problems with files with spaces in their names.  The 
macro escapes the spaces, so if I attach a file named 'space test.txt', 
it appends Attach: space\ test.txt.  Mutt then replies .


I though that it didn't like the escapes, so I manually removed them, so 
that it's Attach: space test.txt.  Mutt then replies .


Attach from the send-menu works just fine.

Can someone tell me how to attach files with spaces using the Attach: 
pseudoheader?  If there is a way to do it, I can just adjust the macro 
to do use it.


I'm using Mutt 1.5.17+20080114 (2008-01-14) from Ubuntu 8.04.  Full 
mutt -v output attached.


Ed
Mutt 1.5.17+20080114 (2008-01-14)
Copyright (C) 1996-2007 Michael R. Elkins and others.
Mutt comes with ABSOLUTELY NO WARRANTY; for details type `mutt -vv'.
Mutt is free software, and you are welcome to redistribute it
under certain conditions; type `mutt -vv' for details.

System: Linux 2.6.24-22-generic (i686)
ncurses: ncurses 5.6.20071124 (compiled with 5.6)
libidn: 1.1 (compiled with 1.1)
hcache backend: GDBM version 1.8.3. 10/15/2002 (built Jun 15 2006 21:19:27)
Compile options:
-DOMAIN
+DEBUG
-HOMESPOOL  +USE_SETGID  +USE_DOTLOCK  +DL_STANDALONE  
+USE_FCNTL  -USE_FLOCK   
+USE_POP  +USE_IMAP  +USE_SMTP  -USE_GSS  -USE_SSL_OPENSSL  +USE_SSL_GNUTLS  
+USE_SASL  +HAVE_GETADDRINFO  
+HAVE_REGCOMP  -USE_GNU_REGEX  
+HAVE_COLOR  +HAVE_START_COLOR  +HAVE_TYPEAHEAD  +HAVE_BKGDSET  
+HAVE_CURS_SET  +HAVE_META  +HAVE_RESIZETERM  
+CRYPT_BACKEND_CLASSIC_PGP  +CRYPT_BACKEND_CLASSIC_SMIME  -CRYPT_BACKEND_GPGME  
-EXACT_ADDRESS  -SUN_ATTACHMENT  
+ENABLE_NLS  -LOCALES_HACK  +COMPRESSED  +HAVE_WC_FUNCS  +HAVE_LANGINFO_CODESET 
 +HAVE_LANGINFO_YESEXPR  
+HAVE_ICONV  -ICONV_NONTRANS  +HAVE_LIBIDN  +HAVE_GETSID  +USE_HCACHE  
-ISPELL
SENDMAIL=/usr/sbin/sendmail
MAILPATH=/var/mail
PKGDATADIR=/usr/share/mutt
SYSCONFDIR=/etc
EXECSHELL=/bin/sh
MIXMASTER=mixmaster
To contact the developers, please mail to mutt-...@mutt.org.
To report a bug, please visit http://bugs.mutt.org/.

patch-1.5.13.cd.ifdef.2
patch-1.5.13.cd.purge_message.3.4
patch-1.5.13.nt+ab.xtitles.4
patch-1.5.4.vk.pgp_verbose_mime
patch-1.5.6.dw.maildir-mtime.1
patch-1.5.8.hr.sensible_browser_position.3


signature.txt
Description: Digital signature


Re: Attach: pseudoheader and files with spaces

2009-01-23 Thread Ed Blackman

Whoops, forgot to go back and add the error messages!

On Fri, Jan 23, 2009 at 11:05:14PM -0500, Ed Blackman wrote:
I've been really enjoying the Vim macro that was posted a little while  
ago that prompts you to attach files if it detects words like attached  
in the mail, and appends mutt's Attach: pseudoheader to the header block  
with the name of the file.


I'm running into problems with files with spaces in their names.  The  
macro escapes the spaces, so if I attach a file named 'space test.txt',  
it appends Attach: space\ test.txt.  Mutt then replies .


space\: unable to attach file

I though that it didn't like the escapes, so I manually removed them, so  
that it's Attach: space test.txt.  Mutt then replies .


space: unable to attach file

Ed



signature.txt
Description: Digital signature


Re: Status flags in attachment menu

2009-01-25 Thread Ed Blackman

On Sun, Jan 25, 2009 at 12:51:46PM -0500, Vance Shipley wrote:

What is the meaning of the flag in the attachment menu?
I see 'I' and 'A' but I con't find any description of these
flags in the documentation.


'I'nline and 'A'ttachment.  See RFC 2183 sections 2.1 and 2.2 for 
further details: http://www.ietf.org/rfc/rfc2183.txt


Ed


signature.txt
Description: Digital signature


Re: set up multiple account

2009-02-12 Thread Ed Blackman

On Thu, Feb 12, 2009 at 07:04:06PM +0800, bill lam wrote:

(I apologise that I once saw a thread on this subject but could not
locate it,)

I got several gmail accounts that have to be set up inside muttrc like:

folder-hook imaps://cfoo...@imap.gmail.com '\
set from=cfoo...@gmail.com ; \
set folder=imaps://cfoo...@imap.gmail.com ; \
set spoolfile=+INBOX ; \
set timeout=300 ; \
set mail_check=300 '


Drop the attached file in your $PATH as muttGmail or whatever, then 
change the big blocks like above to:


`muttGmail cfoobar`
`muttGmail ifoobar`

Mutt will run muttGmail with the given argument.  muttGmail will take 
the argument and spit out the complete folder-hook.  Mutt will then 
interpret the output as configuration commands, and you're all set up.


Ed
#/bin/sh

email=$1

cat EOF
folder-hook imaps://${ema...@imap.gmail.com '\
set from=${ema...@gmail.com ; \
set folder=imaps://${ema...@imap.gmail.com ; \
set spoolfile=+INBOX ; \
set timeout=300 ; \
set mail_check=300 '
EOF


signature.txt
Description: Digital signature


Re: set up multiple account

2009-02-13 Thread Ed Blackman

On Sat, Feb 14, 2009 at 12:17:43AM +0800, bill lam wrote:

On Thu, 12 Feb 2009, Ed Blackman wrote:

`muttGmail cfoobar`
`muttGmail ifoobar`

Mutt will run muttGmail with the given argument.  muttGmail will take  
the argument and spit out the complete folder-hook.  Mutt will then  
interpret the output as configuration commands, and you're all set up.


I tried but failed, Apparently mutt does not execute that output as
commands.  It seems need a :source command and provide a temp file
name.  Or did I missed something?


Using backticks in .muttrc definitely works for me in Mutt 
1.5.17+20080114 (Ubuntu 8.04 packaged version).  I don't have Gmail 
accounts, so I just tested that backticks work for Mutt configuration, 
and that the script I gave you outputs reasonable looking config 
commands.


Do this, inside mutt type:

:`echo 'set my_test=foo'`

and then

:set ?my_test

You need the leading colon in both cases to get into configuration mode.
You should see 'my_test=foo'.  If not, run mutt -v on the command 
line and post the output.


If you do, the problem is in the script: it's either not running (PATH 
problem?) or is not producing the right output.  If it's not running, 
you should be seeing an error that says something like sh: muttGmail: 
not found.


Ed


signature.txt
Description: Digital signature


Re: set up multiple account

2009-02-14 Thread Ed Blackman

On Sat, Feb 14, 2009 at 02:50:05PM +0800, bill lam wrote:

set ?my_test1 does give the expected answer but not for my_test2 and
my_test3 (unknown variable).  My conjecture is the that back-tick
trick only work for the first line for output and it will ignore the
rest of lines.


Huh.  I experience the same behavior, and a little searching confirms 
that backticks only evaluate the first line.  What an odd restriction.


I found the general solution at http://wiki.mutt.org/?ConfigTricks in 
the Generating a dynamic muttrc file section.


Use the same muttGmail script, but include it in .muttrc with
source 'muttGmail foo|'

Note that the quote chars are single quotes, not backticks, and the 
command has to end with a pipe char.


Ed


signature.txt
Description: Digital signature


Re: How to change dynamically the From hdr?

2009-02-16 Thread Ed Blackman

On Mon, Feb 16, 2009 at 10:00:53PM +0100, Ennio-Sr wrote:

* Rocco Rutte pd...@gmx.net [160209, 16:44]:

Yes, this works like a charm. What _exactly_ happens in your case? A
guess: you put ^ and U in there instead of a Control-U character?


I just put an '^' and a 'U' as can be seen printed in my lines above.
I do not know how to put a 'Control-U charachter' in .muttrc being
edited with 'vim'. (Tried with 'C-U, which appears to be 'vim'
syntax, to no avail). Anyway ...  


If you really wanted to do this, as opposed to the much cleaner syntax 
below, to insert a literal Control-U with vim in insert mode you'd press 
Control-V, then Control-U.  vim will probably display the character in a 
different color, to emphasize that it's a single Control-U character, 
not a sequence of caret, uppercase U.



If you try to edit the from line, mutt fills it with the content already
there. Control-U or kill-line editor function clears that line. Thus,
the above is equivalent to:

   macro compose z edit-fromkill-lineIdentity_tab Select from



I changed the macro line to read as you suggest (with 'kill-line') but
still get the same result, i.e. nothing at all happens when I press 'z'
while being in the 'compose menu' (i.e. the page pre-filled with my
chosen headers that appears on the console when - within mutt - I press
'm').


It works for me.  Relevant sections of my .muttrc:

alias Identity_default Ed Blackman e...@edgewood.to
alias Identity_school  Ed Blackman a...@school.edu
alias Identity_hobby   Ed Blackman a...@hobby.org

set from=Identity_default
send-hook . my_hdr From: Identity_default
send-hook ~t .*school.edu   my_hdr From: Identity_school

macro compose z edit-fromkill-lineIdentity_tab Select from

With this configuration, when I reply or compose a new message, mutt 
prompts me for the address and subject, then runs my editor.  When I 
save and exit my editor, I come back to the mutt compose menu.  (The 
send hooks are optional, and set a different default on messages to 
people at my school.)  I can then press z and choose between the three 
identities that I established.



Could it be related to my using vim as the default editor to compose the
message?


Mutt is in control at the compose menu, so your editor doesn't matter.  
FYI, I also use vim.


Ed


signature.txt
Description: Digital signature


Re: How to change dynamically the From hdr?

2009-02-16 Thread Ed Blackman

On Tue, Feb 17, 2009 at 01:16:14AM +0100, Ennio-Sr wrote:

I commented all my .muttrc lines referring to 'unhook' and 'send-hook'
and adapted the lines you suggested to my addresses. Still nothing
happens when I press 'z'!


Are you sure you're in the compose menu when you press 'z'?  You should 
see -- Mutt: Compose in the lower left.



Moreover, when I compose a new message, my 'From' hdr reads:
From: Identity_default


Yeah, I did that deliberately to remind myself of the option.  You might 
want to change the set from= line and the send-hook lines to have 
actual addresses if you don't want that in your editor.


The compose menu is what you get *after* you've saved your message and 
exited the editor.


Ed


signature.txt
Description: Digital signature


Re: Where did these headers come from?

2009-03-01 Thread Ed Blackman

On Sun, Mar 01, 2009 at 09:41:50AM -0800, Rem P Roberti wrote:

I installed muttprint a while back, and I'm quite satisfied with its
performance.  However, I discovered that once I print an email Mutt then
starts to include every (and I do mean every) header when an email is
viewed.  A page of headers.  It's as though the 'ignore' statement in
.muttrc is no longer active.  The only way I can fix the problem is by
closing and reopening Mutt.  Anyone know what's going on here?


Maybe your macro for muttprint unsets 'weed'?  If you type ':set ?weed' 
before printing in a new Mutt session, what does Mutt respond with?  
After printing?


If mutt responds with weed is set before and weed is unset after, 
that's the problem, and I can think of two solutions.


Manual: use display-toggle-weed after printing to toggle it back.  
It's bound to 'h' by default.


Automatic: change your muttprint macro to save and restore the value of 
weed.  Add enter-commandset my_weed=$weedenterenter-commandunset 
weedenter to the beginning of the macro and enter-commandset 
weed=$my_weedenter at the end.  I'm guessing at the content of the 
macro, but that should work.


Ed


signature.txt
Description: Digital signature


Re: Where did these headers come from?

2009-03-02 Thread Ed Blackman

On Sun, Mar 01, 2009 at 11:16:11AM -0800, Rem P Roberti wrote:

Whoa. It turns out that there is a macro in my .muttrc.  Here it is:

macro index p display-toggle-weed print-message
display-toggle-weed exit


OK, that would be (untested, and broken in two lines for readability):

macro index p enter-commandset my_weed=$weedenterenter-commandunset weed
 enterprint-messageenter-commandset weed=$my_weedenter

I'm not sure why your macro isn't working, though.  Assuming you've got 
weed set when the macro starts, it should be unset by the first 
display-toggle-weed, the message prints, and it should be reset by the 
second display-toggle-weed.


My suggestion, though will save and restore the setting, whatever it 
happens to be, whereas yours depends on it being set when you enter the 
macro.


Ed


signature.txt
Description: Digital signature


Re: envelope-to and scoring

2009-03-04 Thread Ed Blackman

On Wed, Mar 04, 2009 at 02:35:16PM +0100, ssiza...@gmail.com wrote:

I'm currently trying to set up a scoring policy for mail sent to
u...@example.com.

The problem is, I only get mass-mailings to this adress, with
u...@example.com usually residing in the BCC. But the header contains
envelope-to: u...@example.com, I just don't get how to access this
information.

I tried ~L ~t ~C and whatnot.


~h '^Envelope-to: u...@example.com'

Adjustments may be necessary if your mailer adds something other than a 
bare email address to the Envelope-to line.


Ed


signature.txt
Description: Digital signature


Re: what is the benefit of imap? Another meta-question.

2009-03-19 Thread Ed Blackman

On Thu, Mar 19, 2009 at 07:06:12AM +0100, Joost Kremers wrote:

On Wed, Mar 18, 2009 at 11:51:56PM -0600, Paul E Condon wrote:

Not in some narrow sense,
but what is involved in 'being an imap user'?


first, your mail server has to support it. then you simply set up your mail
client to use imap. (or preferably imaps.) that's about it.


Well, that and the ceremony with the goat.  Wait!  That's secre... I 
mean, there's no ceremony!


grin

Ed


signature.txt
Description: Digital signature


Re: mailboxes priorities question

2009-04-15 Thread Ed Blackman

On Wed, Apr 15, 2009 at 10:21:22PM -0500, Zhengquan Zhang wrote:

On Wed, Apr 15, 2009 at 10:18:09PM -0500, Zhengquan Zhang wrote:

mailboxes `find ~/.muttmail/ -type d -name cur -printf '%h '`


Basically is there any ignore mailboxes syntax that I could use to
exclude some directories from the above find command.

There are only a few mailboxes that I am not interested at, basically
they are cron mails and quasi spams, etc


I'd replace the `find ...` with a script that did the find, but then 
piped it through grep -v to exclude the ones you don't care about.


Ed


signature.txt
Description: Digital signature


Re: can not go to the message I want to undelete

2009-04-21 Thread Ed Blackman

On Wed, Apr 22, 2009 at 03:39:55AM +0200, Michael Tatge wrote:

* On Tue, Apr 21, 2009 07:55PM -0500 Zhengquan Zhang 
(zhang.zhengq...@gmail.com) muttered:

I accidentally used 'd' on a message and can not go back to it.


Well there are so many ways:
1. type the message number
2. use previous-entry next-entry (bound to K/J) instead of
  previous-undeleted next-undeleted (arrow keys)
3. use undelte-pattern (U)
4. exit mutt instead of quit


5. use toggle-write (bound to % by default) to make the mailbox 
unwritable, then change to another mailbox and back.


Ed


signature.txt
Description: Digital signature


Re: Is this a mutt issue or a links issue (HTML display)

2009-05-12 Thread Ed Blackman

On Tue, May 12, 2009 at 01:56:41PM +0100, Chris G wrote:

I am using links to display HTML messages in mutt on two different
systems and I'm confused as to why I'm seeing differently formatted
output. 

[...]

Both systems have the same entry for links in the mailcap file, both
systems have near identical muttrc files.


What about ~/.links/links.conf or ~/.elinks/elinks.conf?


Is this some sort of oddity in the way that mutt is handing the HTML
to links or is links working differently for some reason?


You may want to save the HTML message part to a file, then run links 
-dump against it on both systems.  That takes mutt out of the equation, 
so you can determine whether or not mutt is part of the problem.


You can save just the HTML message part by selecting the email in the 
index, using view-attachments (by default bound to v), selecting the 
HTML part, and using save-entry (by default bound to s) to save it to 
a file.


Ed


signature.txt
Description: Digital signature


Re: Alias now can't find my Muttrc?

2009-05-27 Thread Ed Blackman

On Wed, May 27, 2009 at 05:38:53PM -0500, Russell Urquhart wrote:

the sponse i get is:

alias_file=~Desktop/mutt-1.5.19/etc/Muttrc


That means the file mutt-1.5.19/etc/Muttrc in the home directory of the 
user 'Desktop'.  Unless you have a user named Desktop on your system, 
and write access to his home directory, I don't think that's what you 
want.


I think you mean alias_file=~/Desktop/mutt-1.5.19/etc/Muttrc.  Note 
the very significant slash after the tilde.


Ed


signature.txt
Description: Digital signature


Re: two address books

2009-06-02 Thread Ed Blackman

On Tue, Jun 02, 2009 at 08:36:49AM +0200, Robert Svoboda wrote:

I can bind macros to modify query_command to once use ldap,
then abook. 
The best would be to have both address books queried

simultaneously and get result where it'd be clear which
entries are from which address book. This is work for wrapper.


I use lbdb (little brother's database), which provides hooks for abook, 
ldap, and many more.  If I do a query for bill, I'll get something 
like:


1 Accounts  Billing Departme...   bill...@example.com 2009-05-01 15:14
2 Bill xx...@example.com   (VCF)
3 xx bill  x...@example.com(Palm)

That shows that I have one entry generated from an email I sent to that 
address on May 1, one entry from a VCF file on disk, and another from a 
Palm contact database on disk (synced from my phone).  All of those are 
configurable to one extent or another.


Mutt configuration is simple:

set query_command=lbdbq '%s'

I don't personally use abook or ldap, so I'm not sure my ~/.lbdbrc would 
be helpful, but I'd be willing to share if you'd like.


Ed



signature.txt
Description: Digital signature


Re: Conditionally removing signature

2009-07-07 Thread Ed Blackman

On Tue, Jul 07, 2009 at 02:06:23PM +0200, Rocco Rutte wrote:

Please see if this example and text above it helps you:

  http://dev.mutt.org/doc/manual.html#ex-recips


When was this added?  I'm using Mutt 1.5.17+20080114 (Ubuntu Hardy), and 
have a similar request.  I usually PGP sign emails sent direct to 
recipients (I turn it off for lists).  I have one person who I want to 
also encrypt the email to.  Currently I have this:


# sign, but don't encrypt, and use a new-style signature, by default. 
# Since we're going to modify the default for certain recipients below, we

# can't just set the variable, but have to set them in a match all send-hook

send-hook ~A set pgp_create_traditional=no
send-hook ~A set pgp_autosign=yes
send-hook ~A set pgp_autoencrypt=no

# Joe has several email addresses, but they all start with the same prefix
send-hook ~t joe@ set pgp_autoencrypt=yes
# ...

This autoencrypts whenever I email Joe directly (what I want) and when I 
email him and several others (not what I want).  I have to remember to 
turn off encryption in that case.


send-hook ^~t joe@ set pgp_autoencrypt=yes

I thought that this would do what I want, but it doesn't seem to do 
anything different than the non-^ version above.


Ed


signature.txt
Description: Digital signature


Re: Conditionally removing signature

2009-07-07 Thread Ed Blackman

On Tue, Jul 07, 2009 at 12:43:59PM -0500, Kyle Wheeler wrote:

On Tuesday, July  7 at 11:43 AM, quoth Ed Blackman:

send-hook ~t joe@ set pgp_autoencrypt=yes # ...


I think you probably want $crypt_autoencrypt instead of pgp_*.


I think it must have changed in a recent version that you have and I 
don't.  That and the -group argument to alias don't work with the 
version in Ubuntu Hardy (which is a bit over a year old).


I may experiment with compiling from source, or trying to backport the 
bleeding edge package from Ubunty Karmic (the upcoming fall release), 
which is based on Mutt 1.5.20.


I'll put your note aside until then, but thanks for the help!

Ed



signature.txt
Description: Digital signature


Re: Conditionally removing signature

2009-07-09 Thread Ed Blackman

On Tue, Jul 07, 2009 at 01:32:33PM -0500, Kyle Wheeler wrote:
Not unless Ubuntu broke it. The -group support was added to 1.5.12 
(released 2006-07-14). I don't remember when crypt_* stuff replaced 
the pgp_* stuff, but the related variable crypt_replyencrypt has been 
around since at least mutt 1.5.4 (released 2003-03-19). Your email 
says you use mutt 1.5.18, which should have both of those.


It was a hardware problem, caused by the nut behind the keyboard.  
grin


I had a typo in the alias line I used to test that feature.  For the 
crypt_* variables, I ran

 :set crypt_autoencrypt=no
 :set ?crypt_autoencrypt

Mutt responded with crypt_autoencrypt is unset, which I interpreted as 
crypt_autoencrypt is null meaning that Mutt didn't recognize 
crypt_autoencrypt as a legitimate variable.  The correct intepretation 
is crypt_autoencrypt is set to 'no', exactly what I told it to do.


Sorry for the static.

Ed


signature.txt
Description: Digital signature


Re: Problems with a2ps/enscript and printing in mutt

2010-01-06 Thread Ed Blackman

On Tue, Jan 05, 2010 at 11:30:17PM -0500, Joseph Ishac wrote:

Since print_decode is set, mutt is parsing the message before piping it.
I was wondering if there is a way to have mutt hand me the subject of
the message so that I could pass it to the -t option of enscript to
formulate a title.


I've attached my muttPrint script, which uses formail to grab the 
subject to pass to enscript.


Ed
#!/bin/sh
#
# muttPrint
#
# macro index,pager p \
# 'enter-commandsource ~/.mutt/rc/print.rcenterpipe-messagemuttPrint 
[enscript args]enter\
# enter-commandsource ~/.mutt/rc/unprint.rcenter'

# arguments always passed to enscript
args=-f Times-Roman12 --word-wrap --fancy-header=emacs-custom

# save the message to a tempfile
: ${TEMP:=$HOME/tmp}
tmpf=$TEMP/muttprint$$
cat $tmpf

# get Subject, stripping all occurrances of 'Re: ' and any initial spaces
subj=$(formail -cx Subject $tmpf | sed -e 's/Re: \?//g' -e 's/^\s\+//')

# get Date, and parse into a more regular, but still human-readable format
date=$(date -d $(formail -cx Date $tmpf) +%Y-%m-%d-%H:%M:%S)

# send message to print with appropriate title and all passed args
enscript --title $subj $date $args $@ $tmpf

# save the enscript return code, remove the temp file, and exit
rc=$?

rm $tmpf
exit $rc


signature.txt
Description: Digital signature


Re: search-tool for mailarchives?

2010-04-14 Thread Ed Blackman

On Wed, Apr 14, 2010 at 09:44:17PM +0200, sigi wrote:
I'm using archivemail to create archives of my mail-folders from time to 
time... if I need to search for old messages in my maildirs, I use 
mairix - but it can't index my *.gz-archives, right? 


mairix can search gzip and bzip2 compressed mbox folders, at least as 
of version 0.21, the version I use.  If you're looking for something 
that searches MH or Maildir folders that are presumably tarred and then 
gzipped, I can't help.  However, since mbox's shortcomings are less 
relevant for folders that are seldom or never changed, you may want to 
consider converting your archival folders to mbox before gzipping, and 
continuing to use mairix.


Ed


signature.txt
Description: Digital signature


Re: Question on Attachment sent by Mutt

2010-05-11 Thread Ed Blackman

On Tue, May 11, 2010 at 12:15:33PM +0200, Jostein Berntsen wrote:

On 11.05.10,15:50, Qi Zhang wrote:

# code
uuencode file_name file_name  att.email

cat mail_message  att.email

mutt -s Subject recei...@somewhere.net  att.email

with this script, I can send email with attachment very easy. and
gmail users have no problem reading these.
BUT, with some mail providers or clients can not read the attachments correctly.
what they can see is only code like @#$!...@$!#!@#...@#

Please somebody know what should I do to fix this problem?


Can you check with another file ending, like att.txt instead of 
att.email?


Since he's using shell redirects, that shouldn't matter: mutt can't use 
the extension to set the file type since it has no chance to see the 
extension.


My question is why do it that way at all?  The command 
  mutt -s 'Subject' -i mail_message -a file1 file2 ... -- recei...@example.com

should accomplish the same goal, but with less chance of errors.

Ed


signature.txt
Description: Digital signature


Re: Question on Attachment sent by Mutt

2010-05-12 Thread Ed Blackman

On Wed, May 12, 2010 at 03:28:47PM +0800, Qi Zhang wrote:

But I still have problems. That is: if I use -a $attachments, then
only attach one file, others will act as recipient. I should use -a
file1 -a file2 instead of -a file1 file2. Am I right?


As others have indicated in their examples, you don't need to prefix 
each file with -a.  Use -- to separate the list of attachments from 
the list of recipients:

  mutt -s 'subject' -i msg_body -a file1 file2 file3 -- recipient1 recipient2

Ed


signature.txt
Description: Digital signature


New 1.3.99i appears to be broken...

2002-05-20 Thread Vazquez, Ed

On OpenBSD 3.1-stable, with OpenSSL v0.9.6b

Built from ports:
automake-1.4-p5
autoconf-2.52
GNUmake-3.79.1
libslang-1.4.4
gettext-0.10.40
libiconv-1.7

configure options:

--sysconfdir=/etc/mutt \
--with-slang \
--with-regex \
--enable-pop \
--enable-imap \
--with-ssl \
--with-iconv

the configure script throws the errors:

(from config.log)
-
configure: In function `main':
configure:3533: syntax error befor `big'
configure: failed program was:
#line 3527 configure
#include confdefs.h
#include sys/types.h
#include sys/param.h
int main() {
-
configure: In function `main':
configure:7615: syntax error before `wc'
configure: failed program was:
#line 7606 configure
#include confdefs.h

#include stddef.h
#include stdlib.h
#ifdef HAVE_WCHAR_H
#include wchar.h
#endif
-
configure: In function `main':
configure:7861: syntax error before `s'
configure: failed program was:
#line 7852 configure
#include confdefs.h

#include stddef.h
#include stdlib.h
#ifdef HAVE_WCHAR_H
#include wchar.h
#endif
-

During the configure routine, stdout shows:

checking for catalogs to be installed... de ru it es ek fr pl nl cs id
sk ko el zh_TW zh_CN pt_BR eo gl sv da lt tr ja hu et ca
checking for iconv.h... yes
checking whether iconv.h defines iconv_t... yes
configure: warning: Unable to find an iconv function. See INSTALL for
help
checking for bind_textdomain_codeset... no

Despite all this, it appears to complete successfully 
despite the strange errors.

However, on running gmake, I get:

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../intl  -I/usr/local/include
-I../intl -Wall -pedantic -g -O2 -c auth.c
In file included from ../mutt.h:51,
from auth.c:23:
../charset.h:39 syntax error befor `ICONV_CONST'
gmake[2]: *** [auth.o] Error 1
gmake[2]: Leaving directory `/home/build/src/mail/mutt/mutt-1.3.99/imap'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directore `/home/build/src/mail/mutt/mutt-1.3.99'
gmake: *** [all-recursive-am] Error 2


Line 39 of charset.h is:
size_t mutt_iconv (iconv_t, ICONV_CONST char **, size_t *, char **,
size_t *, ICONV_CONST char **, const char *);

So, it has something to do with the fact that it can't
properly find libiconv.

I've tried several things:

* Hard setting the location of iconv in the configure
  options

* Re-building libiconv from the ports collection

* Building libiconv from source

* Leaving iconv out of the configure options (it auto-finds
  the headers, so that doesn't work)

* setting the --without-iconv flag in the configure
  options

All of this, and it still errors in the same place.

What am I missing?

-- 
Ed Vázquez

Wasn't there something about a PASCAL programmer knowing the value of
everything and the Wirth of nothing?





wu-imapd, mutt, recursive dir listings

2002-10-09 Thread Ed Schaller

I'm in the process of setting up a new mail server, I installed uw-imap
(debian sid uw-imap-ssl 2001adebian-7 ppc). During login (debian sid   
mutt 1.4.0-4 x86) the connection hangs for ~ 20 minutes. This same
configuration works fine on the old mail server (rh 6.2 uw-imap 2000c
x86).

Strace reveals that the client is hanging on a read while the server
recursively calls stat on every file in my home directory (and follows
sym links).

Using stunnel and tcpdump I can watch the connection. Here's the
stripped down version:

S: * OK [CAPABILITY IMAP4REV1 X-NETSCAPE LOGIN-REFERRALS AUTH=PLAIN
S: * AUTH=LOGIN] mail-server IMAP4rev1 2001.315 at Wed, 9 Oct 2002
02:30:37 -0600
S: * (MDT)
C: a00 login username password
S: a00 OK [CAPABILITY IMAP4REV1 X-NETSCAPE NAMESPACE MAILBOX-REFERRALS
SCAN
S: SORT THREAD=REFERENCES THREAD=ORDEREDSUBJECT MULTIAPPEND] User
username
S: authenticated
C: a01 list  

spin disks and wait forever here

S: * LIST (\NoSelect) / 
S: a01 OK LIST completed

Everything works fine with no long waits after this.

Twiddling with imap_namespace in .muttrc didn't change this initial
listing command.

Anyone seen anything like this? The lack of output for so much work and
previous versions not doing such makes me think there is a uw-imap bug,
but it works fine with other clients.  The initial list ignoring namespace
configs suggests a bug in mutt as well. Any thoughts or ideas?

On a slightly related issue. How do people like cyrus's imap server? Is
it worth converting large mail archives and scripts to the new format?
How much trouble does the new format and accessibility cause with
procmail and friends?

Thanks...

--

--

+-+---+---+
| Ed Schaller | [EMAIL PROTECTED] | mistymushroom |
+-+---+---+



msg31694/pgp0.pgp
Description: PGP signature


wu-imap recursive dir listing

2002-10-10 Thread Ed Schaller

I'm in the process of setting up a new mail server, I installed uw-imap
(debian sid uw-imap-ssl 2001adebian-7 ppc). During login (debian sid
mutt 1.4.0-4 x86) the connection hangs for ~ 20 minutes. This same
configuration works fine on the old mail server (rh 6.2 uw-imap 2000c
x86).

Strace reveals that the client is hanging on a read while the server
recursively calls stat on every file in my home directory (and follows
sym links).

Using stunnel and tcpdump I can watch the connection. Here's the
stripped down version:

S: * OK [CAPABILITY IMAP4REV1 X-NETSCAPE LOGIN-REFERRALS AUTH=PLAIN
S: * AUTH=LOGIN] mail-server IMAP4rev1 2001.315 at Wed, 9 Oct 2002
02:30:37 -0600
S: * (MDT)
C: a00 login username password
S: a00 OK [CAPABILITY IMAP4REV1 X-NETSCAPE NAMESPACE MAILBOX-REFERRALS
SCAN
S: SORT THREAD=REFERENCES THREAD=ORDEREDSUBJECT MULTIAPPEND] User
username
S: authenticated
C: a01 list  

spin disks and wait forever here

S: * LIST (\NoSelect) / 
S: a01 OK LIST completed

Everything works fine with no long waits after this.

Twiddling with imap_namespace in .muttrc didn't change this initial
listing command.

Anyone seen anything like this? The lack of output for so much work and
previous versions not doing such makes me think there is a uw-imap bug,
but it works fine with other clients.  The initial list ignoring namespace
configs suggests a bug in mutt as well. Any thoughts or ideas?

On a slightly related issue. How do people like cyrus's imap server? Is
it worth converting large mail archives and scripts to the new format?
How much trouble does the new format and accessibility cause with
procmail and friends?

Thanks...

--

--

+-+---+---+
| Ed Schaller | [EMAIL PROTECTED] | mistymushroom |
+-+---+---+



msg31695/pgp0.pgp
Description: PGP signature


Re: Using Find, Exclude one mailboxes folder

2010-07-15 Thread Ed Blackman

On Wed, Jul 14, 2010 at 09:01:01PM -0800, rog...@sdf.org wrote:

@#...@# find.

... anyways.

How can I exclude one folder from my mailbox list using a find
pipe?

muttrc:
mailboxes `find ~/.maildir/ -type d -name cur -printf '%h '`


find ~/.maildir/ -type d -name cur \( -regex '.*/\.roger' -prune -o -printf '%h 
' \)

Ed


signature.txt
Description: Digital signature


Re: How to re-procmail emails without modifying read/unread status

2010-08-06 Thread Ed Blackman

On Fri, Aug 06, 2010 at 10:48:05AM +0800, Yue Wu wrote:

In my case, after re-procmail, every email will be unread, I can't recorgnize
which are those I've read, I have to look those emails one by one and recall
if it's really read or unread by me.


In the script or procmail recipe that refiles them, read in the current 
read or unread status, and write another header with that status (eg, 
X-Refiled: read).  After you refile, use mutt header matching to 
update the status accordingly.


If you're going to do this more than once, you'll want to make a final 
pass to remove that header, so it doesn't mess you up on the next pass.


Ed


signature.txt
Description: Digital signature


RFC2047 Subjects

2010-09-02 Thread Ed Blackman
I've been seeing more and more =?US-ASCII?Q?...?= in email Subject 
lines lately.  At first, it was all from a particular (and not very 
technically apt) source, and I assumed that they were doing something 
wrong, and more or less ignored it.  But as I get emails from more and 
more sources, it's harder to assume they're all getting it wrong.


I did a little searching and found that RFC 2047 is the technical 
specification for these encoded strings, and that mutt does have RFC 
2047 support.  However, none of the muttrc entries that mention it seem 
relevant to RFC 2047 decoding for the index and pager display of the 
Subject line.


Here are the relevant headers from an email that isn't displayed 
correctly:


Subject: 
=?US-ASCII?Q?Intrade_Gazette:_John_Thune_for_President?_Roger_Clemens_heads_to_court._Will_the_'Ground_Zero_Mosque'_get_built??=
MIME-Version: 1.0
Content-Type: text/html;
charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

I would expect to see Intrade Gazette: ... in the index and pager, 
instead of =?US-ASCII?Q?Intrade_Gazette:_...


Thinking that it might be a charset issue, I tried charset-hook 
US-ASCII ISO-8859-1, but that did not change the display.


I'm using mutt from Ubunty hardy (8.04.4), with LANG=en_US.UTF-8.  
mutt -v output follows:


$ mutt -v
Mutt 1.5.17+20080114 (2008-01-14)
Copyright (C) 1996-2007 Michael R. Elkins and others.
Mutt comes with ABSOLUTELY NO WARRANTY; for details type `mutt -vv'.
Mutt is free software, and you are welcome to redistribute it
under certain conditions; type `mutt -vv' for details.

System: Linux 2.6.24-28-generic (i686)
ncurses: ncurses 5.6.20071124 (compiled with 5.6)
libidn: 1.1 (compiled with 1.1)
hcache backend: GDBM version 1.8.3. 10/15/2002 (built Jun 15 2006 
21:19:27)

Compile options:
-DOMAIN
+DEBUG
-HOMESPOOL  +USE_SETGID  +USE_DOTLOCK  +DL_STANDALONE
+USE_FCNTL  -USE_FLOCK
+USE_POP  +USE_IMAP  +USE_SMTP  -USE_GSS  -USE_SSL_OPENSSL  
+USE_SSL_GNUTLS  +USE_SASL  +HAVE_GETADDRINFO

+HAVE_REGCOMP  -USE_GNU_REGEX
+HAVE_COLOR  +HAVE_START_COLOR  +HAVE_TYPEAHEAD  +HAVE_BKGDSET
+HAVE_CURS_SET  +HAVE_META  +HAVE_RESIZETERM
+CRYPT_BACKEND_CLASSIC_PGP  +CRYPT_BACKEND_CLASSIC_SMIME  
-CRYPT_BACKEND_GPGME

-EXACT_ADDRESS  -SUN_ATTACHMENT
+ENABLE_NLS  -LOCALES_HACK  +COMPRESSED  +HAVE_WC_FUNCS  
+HAVE_LANGINFO_CODESET  +HAVE_LANGINFO_YESEXPR

+HAVE_ICONV  -ICONV_NONTRANS  +HAVE_LIBIDN  +HAVE_GETSID  +USE_HCACHE
ISPELL=/usr/bin/ispell
SENDMAIL=/usr/sbin/sendmail
MAILPATH=/var/mail
PKGDATADIR=/usr/share/mutt
SYSCONFDIR=/etc
EXECSHELL=/bin/sh
MIXMASTER=mixmaster
To contact the developers, please mail to mutt-...@mutt.org.
To report a bug, please visit http://bugs.mutt.org/.

patch-1.5.13.cd.ifdef.2
patch-1.5.13.cd.purge_message.3.4
patch-1.5.13.nt+ab.xtitles.4
patch-1.5.4.vk.pgp_verbose_mime
patch-1.5.6.dw.maildir-mtime.1
patch-1.5.8.hr.sensible_browser_position.3

Ed


signature.txt
Description: Digital signature


Re: RFC2047 Subjects

2010-09-02 Thread Ed Blackman

On Thu, Sep 02, 2010 at 03:11:30PM -0700, Michael Elkins wrote:

On Thu, Sep 02, 2010 at 02:49:00PM -0700, Michael Elkins wrote:
The problem is that the sender's MUA has not produced a valid RFC2047  
encoding.  Here is the ABNF (RFC2047, section 2, Syntax of  
encoded-words):


Conincidentally, it appears that even Twitter doesn't get this right.  
From an email that I just received:


From: Twitter twitter-bulkr-me=sigpipe@postmaster.twitter.com
Subject: =?utf-8?Q?Update: Twitter Apps and You=0A?=

Spaces are not allowed either:


Does mutt rely on the fact that encoded-text shouldn't have ? or SPACE 
because it makes the implementation easier?  Or is it just following the 
RFC strictly?  Reading the RFC, it's not clear to me *why* encoded-text 
can't have ? or SPACE.


I forwarded the message I copied the headers from, along with a one that 
had spaces in the encoded-text, to my work Outlook and to my Gmail 
account.  Both Outlook and Gmail decoded the subjects as intended, which 
is probably why Intrade and Twitter can get away with sending out 
non-conformant messages.


Any chance of a rfc2047 lenient decode, perhaps as an option?

Ed


signature.txt
Description: Digital signature


Re: [PATCH] more lenient RFC2047 parsing (was Re: RFC2047 Subjects)

2010-09-06 Thread Ed Blackman

On Thu, Sep 02, 2010 at 05:10:37PM -0700, Michael Elkins wrote:

On Thu, Sep 02, 2010 at 07:20:18PM -0400, Ed Blackman wrote:
I forwarded the message I copied the headers from, along with a one  
that had spaces in the encoded-text, to my work Outlook and to my  
Gmail account.  Both Outlook and Gmail decoded the subjects as  
intended, which is probably why Intrade and Twitter can get away with  
sending out non-conformant messages.


Any chance of a rfc2047 lenient decode, perhaps as an option?


Try the attached patch.


I've been running all weekend with this patch.  It works for both 
unencoded ? and SPACE characters in RFC2047 header lines.  I searched 
my mail corpus for RFC2047 encoded headers (both strictly conformant and 
non-conformant), and couldn't find any that were incorrectly displayed, 
and everything else looked fine, too.


Thanks!

Ed


signature.txt
Description: Digital signature


Spaces replaced by question marks?

2010-10-05 Thread Ed Blackman
In the past few weeks, I've been seeing lots of question marks in my 
mutt display, and finally took some time to track down what was 
happening so I could find out what's happening, and if I can get rid of 
them.


In the display, I'll see ? ? ? ? * Track your shipment.  If I pipe 
the part being displayed to od -a, I see runs of spaces where the 
display shows alternating question marks and spaces:

   0001160  sp   c   a   n   :  nl  sp  sp  sp  sp  sp  sp  sp  sp   *  sp
   0001200   T   r   a   c   k  sp   y   o   u   r  sp   s   h   i   p   m

Another example:
Suzie,
?
This email

od -a:
   000   S   u   z   i   e   ,  nl  sp  nl   T   h   i   s  sp

The messages I've seen affected have these MIME properties:
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

That makes the latter example understandable, if not desirable: having 
unquoted spaces at the end of the line is a violation of rule 3 of 
RFC2045, section 6.7: Octets with values of 9 and 32 MAY be 
represented as US-ASCII TAB (HT) and SPACE characters, respectively, but 
MUST NOT be so represented at the end of an encoded line.  Any TAB (HT) 
or SPACE characters on an encoded line MUST thus be followed on that 
line by a printable character.  But that rule concludes with 
Therefore, when decoding a Quoted-Printable body, any trailing white 
space on a line must be deleted, as it will necessarily have been added 
by intermediate transport agents.  I'd greatly prefer that to question 
marks.


I also don't see why leading runs of spaces, and runs of spaces in the 
middle of printable characters, also get the ?.


Mutt 1.5.20 (2009-06-14) on Ubuntu lucid, with Michael Elkin's lenient 
RFC2047 patch applied.  Other configuration details available on 
request.


Ed


signature.txt
Description: Digital signature


Re: Spaces replaced by question marks?

2010-10-05 Thread Ed Blackman

On Tue, Oct 05, 2010 at 03:30:18PM -0500, Derek Martin wrote:

On Tue, Oct 05, 2010 at 04:16:29PM -0400, Ed Blackman wrote:

In the display, I'll see ? ? ? ? * Track your shipment.  If I pipe
the part being displayed to od -a, I see runs of spaces where the
display shows alternating question marks and spaces:


The -a transforms the data in the sense that it ignores the high order
bit of the character -- so what you're seeing may not actually be
what's in the data.  Try od -ba, and wherever you see spaces, see if
the octal byte matches the ASCII code for a space (040).  If they
don't, the problem is most likely that the e-mail contains
non-iso-8859-1 characters, and Mutt can't figure out how to display
them.


Ah!  I didn't know that.  And indeed, they aren't 040 spaces:
000 123 165 172 151 145 054 012 240 012 124 150 151 163 040 145 155
  S   u   z   i   e   ,  nl  sp  nl   T   h   i   s  sp   e   m

240 instead of 040.

Anything I can do?


Failing that, there's a good chance that there's something wrong with
ME's patch, in which case you should post to the dev list, not here.


I didn't think it would, since it only affected headers, but since it 
was non-standard for that version I thought I would mention it.


Ed


signature.txt
Description: Digital signature


Re: [PATCH] handle NBSP in pager (was Re: Spaces replaced by question marks?)

2010-10-06 Thread Ed Blackman

On Wed, Oct 06, 2010 at 08:57:42AM -0700, Michael Elkins wrote:
Indeed, NBSP is not currently supported.  The attached patch will 
convert NBSP to a normal space, but avoid breaking when $smart_wrap is 
set.


I applied the patch to the Ubuntu lucid source for 1.5.20, and it is 
working fine for all the messages I saw the question marks on before, 
and a few more that I've seen since then.


Thanks!

Ed


signature.txt
Description: Digital signature


Re: decoding file names of MIME attachments

2010-10-13 Thread Ed Blackman

On Wed, Oct 13, 2010 at 11:35:15AM +0900, Dan Drake wrote:

On Wed, 13 Oct 2010 at 10:41AM +0900, Dan Drake wrote:

I'm wondering if there's any way to get Mutt to decode the filenames of
attachments. Here's a bit from an attachment I received today:


Whoops...I just looked in the archives for this list, and noticed that just
yesterday there was a message answering my question (the Strange
Attachment Names thread). Putting

   set rfc2047_parameters=yes

into my .muttrc does exactly what I want.


I'm wondering whether it's now appropriate to change this to default to 
'yes'.  I understand the reason it isn't yes by default: RFC 2047 says 
explicitly not to use RFC 2047 decoding on filename parameters.  That 
is because it would cause technically legitimate filenames to have 
decoding failures when they shouldn't have been decoded.  An attachment 
with

Content-Type: IMAGE/JPEG; name==?wonky,no?Q?failure?=
should be able to be saved to a file named =?wonky,no?Q?failure?=.

But the fact that users are being advised to set rfc2047_parameters=yes 
without that warning seems to validate my suspicion: technically 
legitimate file names that would fail RFC 2047 decoding are *much* more 
rare than file names that have been RFC 2047 encoded in violation of the 
spec, but that users just want to have saved with the name that the 
sender gave it.


Mutt should always send with the proper filename encoding (RFC 2231), of 
course.


Ed


signature.txt
Description: Digital signature


Re: Gmail Sent Mail folder and folder-hook

2010-11-23 Thread Ed Blackman

On Tue, Nov 23, 2010 at 02:24:43PM +0100, Francesco de Virgilio wrote:

I simply want to modify the Sent Mail folder index to show the
the To: column. I'm using local mail folders generated by
OfflineIMAP, so each folder has the name of the respective tag in
Gmail. It appears that the space in Sent Mail prevents Mutt to make
the folder-hook operative.

[...]

folder-hook =fradeve11/[Gmail].Sent\ Mail   'set index_format =%30t %Z 
%{%d/%m/%y} %-25.25n %s'


According to the muttrc man page, the folder argument to folder-hook is 
a regexp.  A test with a local mbox named 'space test' works for me with 
this folder hook:


folder-hook =space.test 'set index_format =%30t %Z %{%d/%m/%y} %-25.25n %s'

That uses the dot regexp character to match any character, including a 
space.  Technically that would also match 'spaceatest', 'spacebtest', 
etc, but I think it would be unlikely that someone would want to create 
a Gmail tag named 'SentXMail' where X is anything other than a space.  
So that solution would be a good workaround as long as you didn't do that.


Mutt's regex parser doesn't seem to support \s to match a space.  This 
didn't work for me:


folder-hook =space\stest 'set index_format =%30t %Z %{%d/%m/%y} %-25.25n %s'

Ed


signature.txt
Description: Digital signature


Re: PGP signed status flag not showing

2010-12-22 Thread Ed Blackman

On Mon, Dec 20, 2010 at 01:23:06PM -0700, Aaron Toponce wrote:

I'm struggling with this status flag in the message index. Most
mailboxes show the 's', 'S' and 'P' flags appropriately. However, there
are two mailboxes that don't. One is a local LUG mailing list, the other
is the GnuPG Users mailing list, ironically enough.

However, after viewing a message that is signed, when going back to the
index, the 's' flag will show, even though it didn't show before reading
the mail. PGP/GPG is working fine, as far as I can tell. I can send
encrypted mail, decrypt mail, sign and verify signatures.


I hesitated to jump in with my guess when you first posted this, but 
since no one else has responded with an answer, I'll give it a shot.


There are two kinds of PGP encrypted or signed messages: PGP/MIME and 
traditional inline.  But only PGP/MIME can be detected in the headers of 
the message.  My guess is that mutt shows the flags for the more common 
PGP/MIME messages all the time, because mutt has to parse the header for 
the fields that show up in the index.  For traditional inline PGP, mutt 
only shows the flags after it's had to parse the body to display it in 
the pager.


I can't find this documented in the man pages of my installed version of 
mutt, and don't have any traditional PGP meesages, so it's only a guess.  
But it does fit the facts and would be a reasonable thing to do.


Ed


signature.txt
Description: Digital signature


Re: PGP signed status flag not showing

2010-12-22 Thread Ed Blackman

On Wed, Dec 22, 2010 at 05:10:38PM -0700, Aaron Toponce wrote:

On Wed, Dec 22, 2010 at 04:54:19PM -0600, Derek Martin wrote:

For example, this post to gnupg-users absolutely IS a traditional
in-line PGP message:

  
http://www.gossamer-threads.com/lists/gnupg/users/52282?do=post_view_threaded#52282

A casual glance suggests there are many such messages.


Again, I don't have a problem with this. It's just that the only flag
showing, in fact, is just 'L' for the list. Nothing else, until after I
view the message of the list. It's entirely inconsistent with the 100+
mailboxes that I change to every day.


There are two tests you can do to see if there's something going wrong, 
or whether mutt is behaving as designed.


Open the gnupg-users list.  With the index displayed, search for ~h 
'multipart/signed'.  That looks for the PGP/MIME header that Mutt uses 
to flag a message as signed.  If you find a match, but there isn't an s 
or S in the message flags, then there might be something else going on.  
But if you get Not found, then Mutt is behaving as designed: there 
aren't any PGP/MIME messages in that mailbox, so Mutt won't show a PGP 
flag until you open some traditional messages in the pager.


Another test would be to find a message that shows up with the signed 
flag in some other mail box, and temporarily copy it to the gpg-users 
mailbox.  Then open gpg-users and see if it shows up with the signed 
flag there.  If so, then again Mutt is behaving as designed.  If it 
disappears, then there might be something awry with your config, or a 
bug in Mutt.


Ed


signature.txt
Description: Digital signature


Re: do not allow mutt to send email without attchement

2011-01-15 Thread Ed Blackman

On Sat, Jan 15, 2011 at 12:16:10PM +0300, Alexander V Vershilov wrote:

I have got a problem that sometimes I forgot add attachements
to my email, or misspress 'y' key instead of 'a'.
Idea of workaround is to add some markup in test (for example
'{{file}}') and if there is such a markup doesn't allow to send
email in send-hook, otherwise delete this markup and send email.


I use the vim plugin mentioned elsewhere in the thread for convenience, 
but also use a script that scans the final email before it's sent to 
sendmail, looking for keywords that would indicate that I intended to 
attach something but didn't.  Because it's a pass-through to the real 
sendmail program, it doesn't work if you're sending via direct SMTP or 
IMAP.


It started from the second script in 
http://wiki.mutt.org/?ConfigTricks/CheckAttach but I've added my own 
refinements (not checking for keywords in messages I resend (bounce) 
or in Content-Disposition filenames, etc).


The script works on the final email, so just aborts the send and gives 
you a warning if you should have attached something.  That's not as nice 
as an editor plugin that prompts you for which file to attach, but also 
isn't dependent on a specific editor.


Ed
#!/bin/bash

##
## Script: muttCheckAttach
##
## Original source: http://wiki.mutt.org/?ConfigTricks/CheckAttach
## Refinements by Ed Blackman e...@edgewood.to
##
## Edit muttrc to have this line:
## set sendmail = /path/to/muttCheckAttach /usr/lib/sendmail -oem -oi
##

## Attachment keywords that the message body will be searched for:
KEYWORDS='attach|patch'

## Check that sendmail or other program is supplied as first argument.
if [ ! -x $1 ]; then
echo Usage: $0 /path/to/mailprog args ...
echo e.g.: $0 /usr/sbin/sendmail -oem -oi
exit 2
fi

## Save msg in file to re-use it for multiple tests.
TMPFILE=`mktemp -t mutt_checkattach.XX` || exit 2
cat  $TMPFILE

## Define test for multipart message.
## Can't just be multipart, as in the original, since most of my messages are 
multipart/signed
function multipart {
grep -q '^Content-Type: multipart/mixed' $TMPFILE
}

## Define test for keyword search.
## Ignore keywords in Content-Disposition MIME headers
function word-attach {
grep -E -v '^|Content-Disposition' $TMPFILE | grep -E -i -q $KEYWORDS
}

## Header override.
## Also allow bounce Resent-From message through without check.
function header-override {
grep -i -E ^(X-attached: *none|Resent-From: )*$ $TMPFILE
}

## FINAL DECISION:
if multipart || ! word-attach || header-override; then
$@  $TMPFILE
EXIT_STATUS=$?
else
echo No file was attached but a search of the message text suggests there 
should be one.  Add a header \X-attached: none\ to override this check if no 
attachment is intended.
EXIT_STATUS=1
fi

## Delete the temporary file.
rm -f $TMPFILE

## That's all folks.
exit $EXIT_STATUS



signature.txt
Description: Digital signature


Re: do not allow mutt to send email without attchement

2011-01-16 Thread Ed Blackman

On Mon, Jan 17, 2011 at 11:16:30AM +1300, Cameron McCormack wrote:

One small issue:


function header-override {
grep -i -E ^(X-attached: *none|Resent-From: )*$ $TMPFILE
}


I think that line should be

   grep -i -E ^(X-attached: *none|Resent-From: ) $TMPFILE

otherwise all mails get sent.


Good catch!  Thanks!

Ed


signature.txt
Description: Digital signature


Re: format string: time for today, date for others.

2011-01-20 Thread Ed Blackman

On Fri, Jan 07, 2011 at 05:29:32AM -0600, David Champion wrote:

Aha, finally I have discovered a use for mutt's %strftime expando.
You can optimize this one step further.

   set index_format=./format_date.sh '%[%Y%m%d]' '%%Y%m%d' |

   #!/bin/sh

   if [ $1 -eq $2 ]; then
echo %4C %Z %{   %H:%M} %-15.15F (%?l?%4l%4c?) %?H?[%H]?%s%
   else
echo %4C %Z %{%d.%m.%y} %-15.15F (%?l?%4l%4c?) %?H?[%H]?%s%
   fi

A single exec per message now; that's as good as it gets without
patching mutt.


Outstanding!  I didn't notice a slowdown from the extra exec, but saving 
cycles isn't a bad thing if you don't have to sacrifice clarity.


I went a little bit crazy with this, and now have different formats for 
less than a day old, more than a day but less than a week old, more than 
a week but less than 30 days, and more than 30 days.  I've attached it.


Here's a (censored) view of my index right before I started this 
message:


 102 12/16/10 xx...@xx.xx (   8) x - xxx xx. 
 103   +   Dec 27  xxx xxx xx (  80)  xx xxx xx 
 104   +   Jan 03 xx xxx  (  98) xx: xx xxx 
 105   T   Jan 04 xx  ( 104) xxx xxx xxx
 106   L   Jan 07 x   (  54) xx: xx xx:  xxx x, 
 xxx xx.
 107   Jan 07 x   (  92)  xx  xx  x 
 1/4 xxx
 108   +   Jan 12 xxx x x (  82) xx xx xxx xx 
 109   +   Jan 13 x, x(  23) xx: !
 110   +  Mon 9pm x xxx   (  20) xx: x4x xxx xx (xxx: x 
/ )
 111   T  Tue 2pm  xx ( 153) xxx xxx  x
 112   T Wed 11am xxx ( 157) xx
 113  Wed 3pm x xx( 266)  xxx xxx, xx 
x_xx__xx
 114   T   8:59pm x   (  21) x xxx xxx xxx xx x 
xxx
 115   +   9:11pm xx xxx  (  50) xx:  

The script relies on Unix epoch seconds for the calculation, so the break 
point is 24 hours ago, 168 hours ago, etc, not day boundaries, but 
that's what I want.  I think day boundaries would be possible with some 
work on the msg_age calculation, maybe $(( ($now/86400) - ($msg_date/86400) ))?


Ed
#!/bin/bash
# format_date
#
# In .muttrc:
# set index_format=/path/to/format_date '%[%s]' '%%s' |
#
# 
http://groups.google.com/group/de.comm.software.mailreader.misc/browse_thread/thread/ab966bddc0b424
 46/421549103438b830?q=#421549103438b830
# via Andreas Kneib apo...@web.de
# mutt-users Message-ID: 20110105233817.ga23...@andreas.kneib.biz
# Improvements by
# David Champion d...@uchicago.edu
# Ed Blackman e...@edgewood.to

msg_date=$1   # datetime of message in local timezone 
in epoch seconds
now=$2# current time in local timezone in 
epoch seconds
msg_age=$(( ($now - $msg_date) / 86400 )) # age of message in 
integer days

if [ $msg_age -ge 30 ]; then
  format=%[%m/%d/%y]  # '01/20/11'
elif [ $msg_age -ge 7 ]; then
  format=%8[%b %d]# '  Jan 20'
elif [ $msg_age -ge 1 ]; then
  format=%8[%a %-I%P] # ' Thu 6pm'
else
  format=%[ %_I:%M%P] # '  6:41pm'
fi

echo %4C %Z $format %-15.15F (%?l?%4l%4c?) %?H?[%H]?%s%


signature.txt
Description: Digital signature


Re: strange content-types of attachments

2011-02-09 Thread Ed Blackman

On Wed, Feb 09, 2011 at 11:06:52AM +, Chris G wrote:

I had something *vaguely* similar yesterday, a supplier sent me a note
about an order I had placed and it was:-

   [-- application/octet-stream is unsupported (use 'v' to view this part) --]

... which is OK[ish], but the file name was:-

   =?iso-8859-1?B?SU9TVF9DU0gyMTA1MjAucGRm?

It was actually a PDF.  Why they couldn't just reply to my E-Mail I
don't know.


That is a RFC2047 encoding of IOST_CSH210520.pdf.  RFC 2047 
*explicitly* says not to use RFC 2047 decoding on file name parameters.


Unfortunately, some commonly used mail user agents ignore that section 
and send file names encoded that way instead of using the correct way 
specified in RFC 2231.


You can tell Mutt to use RFC2047 decoding on MIME file names with
  set rfc2047_parameters=yes

I've argued before that Mutt should make that the default.

--
Ed Blackman


signature.txt
Description: Digital signature


Re: strange content-types of attachments

2011-02-09 Thread Ed Blackman

On Wed, Feb 09, 2011 at 08:26:03PM +, Chris G wrote:

On Wed, Feb 09, 2011 at 01:49:33PM -0500, Ed Blackman wrote:

You can tell Mutt to use RFC2047 decoding on MIME file names with
  set rfc2047_parameters=yes


Would that be in addition to the 'normal' decoding which works with most
attachments?  I.e. would everything that worked before continue to work
correctly?


Yes.  The only thing that might break (and I'm not even sure it would) 
is if someone sent you a file actually named something like 
=?blah?Q?foo?.  In other words, a legitimate file name that *looks* 
like it's RFC2047 encoded, but actually isn't.


In practice, most people don't send files with weird names like that, 
and there's a large set of people who use non-compliant user agents that 
send files with RFC2047 encoded names.


--
Ed Blackman


signature.txt
Description: Digital signature


Re: Google 2-step authentication

2011-02-11 Thread Ed Blackman

On Thu, Feb 10, 2011 at 07:04:14PM -0700, Aaron Toponce wrote:

Will mutt be supporting Google's newly announced 2-step authentication?
I don't use any other mail client other than mutt, but I would like to
take advantage of the extra security when it's available for my account.

http://goo.gl/nP3ML

Thoughts?


I can't speak for the mutt devs, but in their place I wouldn't be eager 
to add gmail-specific code to ask for two-factor verification codes.  If 
they add it for Gmail, they'll have to add different code when Yahoo 
comes out with their own spin on it, then Hotmail, then...


Google thought of that, though.  After you enable two-factor 
authentication, you can create an application-specific password for 
applications like mutt that don't ask for verification codes.  See: 
https://www.google.com/accounts/IssuedAuthSubTokens


I'm not sure how the application-specific part of application-specific 
passwords works, though.  If I create a password for mutt, can I use the 
same password if I telent to gmail on the imap port and enter raw IMAP 
commands?  If not, how does it tell the difference?


--
Ed Blackman


signature.txt
Description: Digital signature


Re: renaming temporary files

2011-02-18 Thread Ed Blackman

On Fri, Feb 18, 2011 at 05:13:55PM -0500, Paul Hoffman wrote:

Then /path/to/my/script has something along these lines:

#!/bin/zsh

typeset file=$1 label subject; shift
typeset editor=${VISUAL:-$EDITOR}

main() {
   grep '^Subject: ' $file | read label subject
   if [[ -n $subject ]]; then
   newfile=$(sanitize-subject $subject)
   ln -f $file $file:h/$newfile
   fi
   exec ${editor:-vi} $file


Since $editor doesn't know anything about $newfile, it gets left around 
afterward.


I think he would want to replace the editor line above with:

${editor:-vi} $file
rm $newfile

Alternately, he might just want a script that will allow him to more 
easily identify the leftover tempfiles.  No changes to muttrc needed for 
this:


#!/usr/bin/perl -w

#
# Name: listMuttTemp
# By: Ed Blackman e...@edgewood.to
# Invocation: listMuttTemp /path/to/mutt-tempfiles/mutt-*
#

use POSIX;

foreach my $file (@ARGV) {
  if(open(my $fh, '', $file)) {
while($fh) {
  if(/^Subject: /) {
my @modificationTime = localtime((stat($file))[9]);

print $file:\n$_ . strftime(%x %X, @modificationTime) . \n\n;
  }
}

close($fh);
  }
  else {
print STDERR Couldn't read $file: $!\n;
  }
}

That produces:
$ listMuttTemp /tmp/mutt-*
/tmp/mutt-loghyr-1237-5892-3031e76d5f93d2eeb87:
Subject: Re: renaming temporary files
02/18/2011 05:27:35 PM

--
Ed Blackman


signature.txt
Description: Digital signature


Re: What can I do if I don't want to uncollapse a thread after i read it

2011-04-13 Thread Ed Blackman

On Wed, Apr 13, 2011 at 10:44:16PM +0800, Dan wrote:

but after i read a new message and returned to index, the thread contains that 
message would be uncollapsed. what should i do if i want to all threads stay 
collapsed even after i read messages?


Untested, but maybe you could remap the key in the pager that exits to 
the index (normally 'q') to a macro that does exit to index, collapse 
all threads.


Hmmm... in a brief test, both
  macro pager q exitcollapse-all
and
  macro pager q exitenter-commandpush collapse-allenter
work every other time for me.  I view a message, hit 'q', and am back at 
the index with all threads collapsed.  I view another message (or the 
same one again), hit 'q', and am back at the index with all threads 
uncollapsed.  View another message, hit 'q', and am back at the index 
with all threads collapsed.  Etc.


Maybe someone with a better understanding will suggest a better 
solution.


--
Ed Blackman


signature.txt
Description: Digital signature


Re: mh format questions

2011-04-15 Thread Ed Blackman

On Fri, Apr 15, 2011 at 02:11:30PM -0500, David Champion wrote:

* On 14 Apr 2011, Paul E Condon wrote:

I have been using fetchmail and procmail to get my mail from my ISP
and distribute to several mbox folders using mutt as MUA.
I want to switch to using MH instead of mbox folder format. I have


Not to answer your question, but as Michael Tatge alluded, I would use
Maildir instead of MH unless you have a specific need to interact with
MH-compatible software.


I have actually been migrating from Maildir to MH for backup efficiency.  
I have procmail sort email into folders, and put a (sometimes modified) 
copy in my inbox where I can read and delete it, secure in the knowledge 
that I kept the original.


That means that I don't regularly read any mail folder other than my 
inbox.


If I use Maildir mail folders, that means that all my mail gets backed 
up in /path/to/folder/new.  Occasionally I will open one of those 
folders in mutt, moving all the mail to /path/to/folder/cur.  The next 
incremental backup then deletes the copy in /new from the backup and 
backs up the new copy in /cur.  Beyond that, flags are stored in the 
file name, so changing flags causes another backup delete/add.


With MH, on the other hand, message 13524 is always message 13524, 
regardless of whether I've seen it or not, or what the message flags 
are.  The flags are in .mh_sequences which is tiny if I care about 
saving those flags, and easy to exclude from backup if I don't.


--
Ed Blackman


signature.txt
Description: Digital signature


Re: mairix search

2011-05-02 Thread Ed Blackman

On Fri, Apr 29, 2011 at 02:08:33PM -0700, Omen Wild wrote:

Quoting Ed Blackman e...@edgewood.to on Fri, Apr 29 17:03:


In my case, mairixquery is a Perl script that prompts me for the mairix
search string, gives me yes or no prompts for whether to search threads
or augment previous results, and saves the most recent 100 searches so
that I can make edits if the query returns too little or way too much.


That sounds really interesting.  Any chance you would be willing to
share it?


Sure.  I've attached it.

It was originally the shell script that Christian Ebert posted a couple 
of years ago.  He reposted an enhanced version in this thread.  I got 
frustrated with having to retype the same queries with slight 
variations, so converted it to Perl to take advantage of the built-in 
history feature in Term::ReadLine, and have enhanced it from there.


Features:
- saves last 100 (configurable) queries in $HOME/.mairixquery (configurable)
- automatically replaces X:me in typed queries with 
   X:myem...@example.com (you'll want to edit $me in the script to 
   use your own adress, of course!).  I quite frequently want to find 
   emails that I sent or that were addresssed or copied to me, and this 
   cuts down on typing my own address quite a bit.
- saves the answers to include threads? and add to existing results? 
   in the history, and uses them to set the default for the questions.  
   If I didn't want to use threads the last time I used this query, I 
   most likely don't want to this time.
- expands %name% so that it matches all email addresses reurned from a 
   lbdbq search for name.  This is the one idiosyncratic piece that's 
   hardcoded.  Ithought about making lbdbq configurable, but the code 
   around it is very dependant on lbdbq's output structure.  If you don't 
   use %foo%, it will never call lbdbq, though.


Patches and suggestions welcome.  If there are people interested in 
hacking on it, I'd be happy to start a little github project.


--
Ed Blackman
#!/usr/bin/perl -w

# customizable variables

my $me = 'e...@edgewood.to';
my $histFile = $ENV{HOME}/.mairixquery;
my $histSaveLines = 100;

# code begins

use strict;
use Term::ReadLine;

$ENV{PATH} = $ENV{HOME}/bin:$ENV{PATH};

my ($Agent) = $0 =~ m@.*/([^/]*)@;

print Enter mairix query:\n;

my $term = new Term::ReadLine $Agent;

if($histFile) {
  $term-read_history($histFile);
  # don't automatically add to history, so lines can be changed before being 
saved
  $term-MinLine(undef);
}

my $query = $term-readline('query') or die No query\n;
my @args;

# mairix doesn't like multiple commas, so collapse runs of commas to one
$query =~ s/,,+/,/g;

# if there are words in percents (%bill%), expand it out using lbdb
$query = expandNames($query);

my ($threads) = $query =~ /--(no)?threads /;
$threads = 'yes' if(!defined($threads));

if(yorn(Retrieve thread(s)?, $threads)) {
  unshift @args, --threads;
  $threads = 'yes';
}
else {
  $threads = 'no';
}

$query =~ s/--(no)?threads //;

my ($augment) = $query =~ /--(no)?augment /;
$augment = 'no' if(!defined($augment));

if(yorn(Append message(s) to mfolder?, $augment)) {
  unshift @args, --augment;
  $augment = 'yes';
}
else {
  $augment = 'no';
}

$query =~ s/--(no)?augment //;

push @args, map {
  # make it easy to find my address without typing it out
  s/^(\w+):me$/$1:$me/;

  # limit message-id strings to 31 chars (mairix limit)
  if(/^(m:.{0,31}).*/) {
$_ = $1;
  }

  $_;
} split(' ', $query);

system(('mairix', @args));

# mairix doesn't understand --no arguments, so they need to be added to saved 
args after execution
unshift @args, '--nothreads' if($threads eq 'no');
unshift @args, '--noaugment' if($augment eq 'no');

if($histSaveLines  $histSaveLines  0) {
  $term-add_history(join(' ' ,  @args));
  $term-write_history($histFile);
  $term-history_truncate_file($histFile, $histSaveLines);
}

sub yorn {
  my $prompt = shift;
  my $default = shift;

  $| = 1;
  $prompt .=  ( . ( lc($default) eq 'yes' ? [yes]/no : yes/[no]) . ) ;

  my $ans = $term-readline($prompt);

  $ans = 'yes' if($ans eq ''  $default eq 'yes');

  return $ans =~ /^y.*/i;
}

sub expandNames {
  my $query = shift;

  while ($query =~ /[\W\b]%(\w+)%(?:[\W\b]|$)/) {
my $name = $1;
my @expanded;

foreach my $match (split(/\n/, qx(lbdbq '$name' | tail -n +2))) {
  my ($address, $name, $where) = split(/\t/, $match);

  push @expanded, $address;
  push @expanded, join(',', split(/ /, $name));
}

my $expanded = join('/', @expanded);

$expanded = $name if(!$expanded);   # fall back to replacing '%foo%' with 
'foo' if no matches

$query =~ s/%$name%/$expanded/;
  }

  return $query;
}


signature.txt
Description: Digital signature


Re: quoted-printable not displaying correctly

2011-05-04 Thread Ed Blackman

On Tue, May 03, 2011 at 11:20:55PM +, Grant Edwards wrote:

The first is

 Content-Type: text/plain; charset=utf-8
 Content-Transfer-Encoding: quoted-printable

[...]

The text/plain body looks something like this:

Weird... where did all those question marks come from?=C2=A0 I just checked=
my sent file and they're not there.=C2=A0 I'm gramatically correct.=C2=
=A0 -jill=20


I don't have a solution, but some searching confirmed my suspicion from 
the context that the intended character is a non-breaking space.  The 
bytes C2 A0 in UTF-8 is the character 00A0, NO-BREAK SPACE.  I don't 
know what's at fault, but thought the additional information might help 
some one.


--
Ed Blackman


signature.txt
Description: Digital signature


Re: Quirks using format:fixed

2011-05-17 Thread Ed Blackman

On Tue, May 17, 2011 at 02:42:03PM -0400, Tim Gray wrote:

On May 17, 2011 at 12:25 PM -0600, Aaron Toponce wrote:

Or, I could just set tw=0 for vim, and enable format:flowed in my
~/.muttrc. That would probably be the easiest route.


It's unclear from your message whether or not you realize this, but 
setting f=f in your muttrc doesn't actually do diddly-squat to the 
actual formatting of your message.  It just sets a header to let 
recipients know that the message body is expected to be f=f.  I think 
it also does another step (space stuffing), but it does NOT add the 
proper trailing spaces to paragraphs which should be wrapped.  That 
needs to occur in the editor or in a wrapping script.


I hope I have the above correct.


That's correct from my experience.  You need to set the header in mutt, 
AND make sure that the message is formatted as specified in the 
format=flowed RFC 3676 (short summary, a trailing space at the end of 
lines that you want to flow).  That's because you're allowed to have 
fixed lines inside a format=flowed message.


I got tired of checking whether a given line ended with a space (which 
was chosen precisely because its prescence at the end of lines wouldn't 
be very noticible in clients that didn't support RFC 3676), and created 
a vim mail syntax plugin that puts a white underscore at the end of 
lines that end with a space, so I can see at a glance which lines will 
flow and which won't.


--
Ed Blackman


signature.txt
Description: Digital signature


Re: imap_pass password management

2011-05-18 Thread Ed Blackman

On Wed, May 18, 2011 at 07:24:49PM +0200, Ђорђе Тодоровић wrote:

On Wed, 18 May 2011, Ђорђе Тодоровић wrote:


On Wed, 18 May 2011, Richard wrote:

imap_pass = `echo -n $(pwsafe -p ACCOUNT_NAME -e -q | tail -n 1) `


That works fine, thank you. Also I found this link:
 http://www.mail-archive.com/mutt-users@mutt.org/msg36375.html


I just noticed that this example doesn't work with passwords that contain
certain special characters (#'). Anyone know how to sanitize input so mutt can
read passwords from stdin?

If a password contains #, mutt reads an empty string.
If a password contains quotes, imap_pass gets a password + entire muttrc file
below a set imap_pass... field.


Mutt treats the output of a command in backticks as if it were typed 
directly into the config file.  So if your password is abc#123, then

  imap_pass = `echo -n $(pwsafe -p ACCOUNT_NAME -e -q | tail -n 1) `
will translate to
  imap_pass = abc#123

Mutt will parse # as the beginning of a comment, ignore it and the rest 
of the line, and set your password to abc.


The solution is to tell mutt that the output of the command is a literal 
string:

  imap_pass = `echo -n $(pwsafe -p ACCOUNT_NAME -e -q | tail -n 1) `

Some brief testing indicates that Mutt does the right thing for output 
that contains # and , but I don't use IMAP so I'm not completely 
certain.


--
Ed Blackman


signature.txt
Description: Digital signature


Re: mutt and some GMail features

2011-06-05 Thread Ed Blackman

On Sun, Jun 05, 2011 at 04:19:10PM -0400, Chris Brennan wrote:

* Ionel Mugurel Ciobica tga...@chem.tue.nl [2011-06-05 21:37:13 +0200]:


If you use vim for other than editing e-mails, you may want not to add
that limit in your .vimrc. Instead add this to your .muttrc:

set editor=/usr/bin/vim -c 'set ft=mail et tw=72'


Perfect, I will add that over textwidth in my .vimrc, thanks


That works OK for a small number of settings, but can become hard to 
manage.  If vim filetype detection is enabled and working properly 
(entering :set filetype in command mode in vim returns 
filetype=mail), you can create $HOME/.vim/after/ftplugin/mail.vim and 
enter mail-specific settings there. For instance, mine starts out like:


syntax on
setlocal wrap
setlocal textwidth=72
 do text=flowed wrapping
setlocal formatoptions+=w
 don't autoindent or smartindent, as that just adds weird spaces into the
 middle of flowed text paragraphs
setlocal noautoindent nosmartindent

As you can see, you can take as much space as you want to make things 
easy for your future self to understand why you're selecting certain 
settings.


--
Ed Blackman


signature.txt
Description: Digital signature


Re: Ignoring my_hdr

2011-06-05 Thread Ed Blackman

On Sun, May 29, 2011 at 04:51:01PM +0100, David Woodfall wrote:

On (13:42 29/05/11), Jamie Paul Griffin ja...@gnix.co.uk put forth the 
proposition:
IIUC, you're talking about when you are composing in the editor, not 
mutt, which would explain why. I guess this means you have 
$edit_headers set in $your muttrc file, unset it and you won't see the 
headers.


Is that the only way? I really like to see the To: Cc: and Subject:
headers when composing.


You could change your editor to a script that will:

1) copy the original message to a temp message
2) remove unwanted headers from the temp message
3) invoke your editor on the temp message
4) update the original message with the retained headers and full body 
from the temp message once the editor returns

5) remove the temp message (mutt will remove the original)

Note that the process above will modify the original even if you don't 
make any edits, and will thus defeat mutt's detection of unmodified 
messages.  You can just live with that, or add:


2.5) save the ctime of your temp message
3.5) go to 5 if the saved ctime doesn't change

--
Ed Blackman


signature.txt
Description: Digital signature


Re: mh format questions

2011-06-06 Thread Ed Blackman

On Sat, Apr 16, 2011 at 06:31:39AM -0600, Paul E Condon wrote:

On 20110415_163420, Ed Blackman wrote:

I have actually been migrating from Maildir to MH for backup
efficiency.  I have procmail sort email into folders, and put a
(sometimes modified) copy in my inbox where I can read and delete it,
secure in the knowledge that I kept the original.

That means that I don't regularly read any mail folder other than my
inbox.


This is very interesting. One thing you don't mention in this very
brief brief for MH is the placement in your processing chain of
spamassassin, or other spam filtering. Is the sending emails thru SA
done in the same procmail step that splits the emails into two streams,
inbox and archive?


I'm getting around to cleaning up old email, and saw that I didn't 
respond.  Sorry for the delay.


The rough order of my procmailrc is:
- Emails consumed directly by programs, mostly from other programs.
- Anti-spam

Messages that get to this point either didn't trip anti-spam rules on a 
first pass, or tripped a rule and got segregated, but then got released 
and reinjected with a header that ensures that it skips the anti-spam 
rules on the second pass.


Decisions on archiving come next.  I use bogofilter with a different 
config file and wordlist to add X-Archivicity.


Messages that are identified as not-archive, and messages to 
identifiable mailing lists regardless of archivicity, get copied to a 
archive-not folder (and copied to the list folder, for identifiable 
mailing lists).  A cron task prunes archive-not down to a fixed number 
of messages that represents an average month's worth of no-archive 
messages.  That gives me a small fallback if I later wish I had saved 
something.


Messages that are identified as unsure-archive get copied to the 
archive-unsure folder, which I periodically empty manually with mutt 
macros that retrain bogofilter and save the email to archive or 
archive-not.


Messages that are identified as yes-archive get copied to the archive 
folder.


All three archive choices are copies, so the message is still being 
processed.  The final stop is inbox.


--
Ed Blackman


signature.txt
Description: Digital signature


Re: abrt mail send if failed attach

2011-07-13 Thread Ed Blackman

On Tue, Jul 12, 2011 at 12:45:43AM +0200, Eric Smith wrote:

If I add an Attach: heder with an invalid filename causing a failure
to attach the file, is it possible to have mutt disable mail send.

This often occurs when quickly exiting the editor and pressing y
without noticing the failure.


I don't think what you're specifically asking for is possible without 
code changes to mutt.


I use two approaches which deal with 99% of the intended to attach a 
file but didn't problem for me.


First I use vim to compose messages, and use a function that prompts me 
to attach a file if I use the words 'attach' or 'patch' in the message.  
It adds Attach: headers, but allows me to find the file with tab 
completion, so it's very rare for me to get the file name wrong.


I then use a script as a pass-through to sendmail.  It looks for the 
same keywords.  If it finds them, but doesn't find an attachment, it 
exits without sending the message, leaving an error message on the 
screen instead.


I've attached my mutt check-for-attachments script (refined from the 
version on http://wiki.mutt.org/?ConfigTricks/CheckAttach) and my vim 
function script.


--
Ed Blackman
#!/bin/bash

##
## Script: muttCheckAttach
##
## Original source: http://wiki.mutt.org/?ConfigTricks/CheckAttach
## Refinements by Ed Blackman e...@edgewood.to
##
## Edit muttrc to have this line:
## set sendmail = /path/to/muttCheckAttach /usr/lib/sendmail -oem -oi
##

## Attachment keywords that the message body will be searched for:
KEYWORDS='attach|patch'

## Check that sendmail or other program is supplied as first argument.
if [ ! -x $1 ]; then
echo Usage: $0 /path/to/mailprog args ...
echo e.g.: $0 /usr/sbin/sendmail -oem -oi
exit 2
fi

## Save msg in file to re-use it for multiple tests.
TMPFILE=`mktemp -t mutt_checkattach.XX` || exit 2
cat  $TMPFILE

## Define test for multipart message.
## Can't just be multipart, as in the original, since GPG signed messages
## are multipart/signed, but signature shouldn't be treated as an attachment
function multipart {
grep -q '^Content-Type: multipart/mixed' $TMPFILE
}

## Define test for keyword search.
## Ignore keywords in quoted body lines, response Subjects, and
## Content-Disposition MIME headers
function word-attach {
grep -E -v '^|Content-Disposition|^Subject: Re:' $TMPFILE | grep -E -i 
-q $KEYWORDS
}

## Header override.
## Also allow mutt bounces (with header Resent-From) through without check.
function header-override {
grep -i -E ^(X-attached: *none|Resent-From: ) $TMPFILE
}

## FINAL DECISION:
if multipart || ! word-attach || header-override; then
$@  $TMPFILE
EXIT_STATUS=$?
else
echo No file was attached but a search of the message text suggests there 
should be one.  Add a header \X-attached: none\ to override this check if no 
attachment is intended.
EXIT_STATUS=1
fi

## Delete the temporary file.
rm -f $TMPFILE

## That's all folks.
exit $EXIT_STATUS

 To install, copy into existing ~/.vim/after/ftplugin/mail.vim,
 or save it into ~/.vim/plugin/mail/ and edit ~/.vim/after/ftplugin/mail.vim
 to have this line: runtime mail/muttAttach.vim

 Script: muttAttach.vim
 Author: Ed Blackman
 Email:  e...@edgewood.to

 This file was modified from a version from Brian Medley
 freesoftw...@4321.tv, which was modified from Cedric Duval's version.
 http://cedricduval.free.fr/download/vimrc/mail

 Description:
 This function creates a file-write hook that looks for key words that
 indicate the user wishes to attach a file, and prompts for the file,
 then causes it to be attached using the Mutt Attach: pseudo-header.

 If the user responds to the prompt with 'none', add the X-Attached: none
 header to indicate that other attachment processing scripts shouldn't
 expect to find an attachment despite the prescence of key words.

 
 Check Attachments
 

if !exists(CheckAttach)
function! CheckAttach()
let check='attach,patch'
let oldPos=getpos('.')
let ans=1
let val = join(split(escape(check,' \.+*'), ','),'\|')
1
let s:ignorecase_save=ignorecase
set ignorecase
if search('\%('.val.'\)','W')
let ans=input(Attach file?: (leave empty to abort): , , file)
while (ans != '')
normal magg}-
if ans != 'none'
   call append(line('.'), 'Attach: '.ans)
else
   call append(line('.'), 'X-Attached: '.ans)
endif
redraw
let ans=input(Attach another file?: (leave empty to abort): , , 
file)
endwhile
endif
exe :write . expand(amatch)
let ignorecase=s:ignorecase_save
call setpos('.', oldPos)
endfu

augroup script
au!
au BufWriteCmd,FileWriteCmd mutt* :call CheckAttach()
augroup END
endif


signature.txt
Description: Digital signature


Re: abrt mail send if failed attach

2011-07-13 Thread Ed Blackman

On Wed, Jul 13, 2011 at 11:19:35AM -0400, Ed Blackman wrote:
I use two approaches which deal with 99% of the intended to attach a 
file but didn't problem for me.


I forgot to mention that I've enhanced the two of them to work together.  
The original vim function prompted for an attachment, added Attach: 
headers when you did type something, and stopped prompting if you 
pressed enter without typing anything.


I enhanced it so that if you type none, it adds the X-Attached: none 
header that the other script looks for to signal that attachments aren't 
expected, even though there are attachment key words are in the email.  
Like this one.  grin


--
Ed Blackman


signature.txt
Description: Digital signature


Re: set different index_format for mails

2011-11-08 Thread Ed Blackman

On Tue, Nov 08, 2011 at 02:13:05PM +0100, Gregor Zattler wrote:

It's not possible to change the index format for individual
emails in the index but you can colour different email entries
differently.


Actually, it is.  If you set index_format to a shell command that ends 
with a pipe, that Mutt will run that shell command for each message and 
use the output as the actual index_format.  If you pass index_format 
expandos as arguments, Mutt will pass the expanded string.  The shell 
command could then use that to emit different formats for different 
messages.


For example, I have a script called format_date, and have this in 
.muttrc:

  set index_format=/path/to/format_date '%[%s]' '%%s' |

The script emits a different date format for each message in the index 
depending on how old it is: '  6:41pm' if less than a day, ' Thu 6pm' if 
more than a day but less than a week, '  Jan 20' if more than a week but 
less than 30 days, and '01/20/11' if more than 30 days.  See 
http://marc.info/?l=mutt-usersm=129556814118983 and the thread that 
leads up to it.


A different program could be written to examine the message flags in 
'%Z' instead of the time, and output different formats depending on 
those flags.  The script in the message linked above could serve as a 
starting point, though the middle part where it's doing the date 
calculations would need to be replaced with flag comparisons.


I don't have time to experiment with creating a full solution for the 
original poster, but hopefully this will point someone in the right 
direction.


--
Ed Blackman


signature.txt
Description: Digital signature


Re: set different index_format for mails

2011-11-09 Thread Ed Blackman

On Wed, Nov 09, 2011 at 11:01:27AM +0800, stardiviner wrote:

= On [2011-11-08 12:03:50 -0500]:
Ed Blackman Said:

On Tue, Nov 08, 2011 at 02:13:05PM +0100, Gregor Zattler wrote:
It's not possible to change the index format for individual
emails in the index but you can colour different email entries
differently.

Actually, it is.  If you set index_format to a shell command that
ends with a pipe, that Mutt will run that shell command for each
message and use the output as the actual index_format.  If you pass
index_format expandos as arguments, Mutt will pass the expanded
string.  The shell command could then use that to emit different
formats for different messages.

For example, I have a script called format_date, and have this in
.muttrc:
  set index_format=/path/to/format_date '%[%s]' '%%s' |

This really is a good idea.
I want to set index_format for different type mails like:
new, deleted, replied, signed, encrypted ...
But I do not know how to use those value like ~N ~R ~D ~g ~G etc.
Do you know how to pass them to script ?


Those are patterns, you can't pass them.  You can pass the format 
strings that are listed in muttrc under index_format.  It looks like all 
the patterns you are interested in are reflected in the message flags 
format string, %Z.  So you'd change index_format in .muttrc to:

  set index_format=/path/to/format_flags '%Z' |

Then create a format_flags script loosely based on mine that parses the 
flags argument and echos the right index_format based on what's passed 
in the flags.


--
Ed Blackman


signature.txt
Description: Digital signature


Re: variable date format

2011-11-22 Thread Ed Blackman

On Mon, Nov 21, 2011 at 04:36:00PM -0600, David Champion wrote:

Caveats: I remember this coming up but I don't remember exactly when or
in what context.  (If you have a URL where you got this I could double
check.)


The start of the thread is here: 
http://marc.info/?l=mutt-usersm=129426504121286w=2

Part of the thread is about the date conditional patch that you use, but 
Andreas Kneib contributed the index_format script that he had gotten 
from de.comm.software.mailreader.misc.  A couple people made 
improvements, and I went nuts with the concept.


I'm not sure where the OP got his version.  Mine has the correct 
index_format in the documentation comment block.



There should be two arguments to the script, but the $index_format
there passes only one.  You also need the current timestamp.

The simplest solution is probably to change the script: replace
this line:
   now=$2# local current time in epoch seconds
with this:
   now=$(date +%s)

But I haven't tested this.  Maybe Ed will see this and have a better
answer.


I use the attached script and the following index_format:

set index_format=/path/to/format_date '%[%s]' '%%s' |

That uses the %%s expando to avoid having to exec date to get the 
local current time in epoch seconds.


--
Ed Blackman
#!/bin/bash
# format_date
#
# In .muttrc:
# set index_format=/path/to/format_date '%[%s]' '%%s' |
#
# 
http://groups.google.com/group/de.comm.software.mailreader.misc/browse_thread/thread/ab966bddc0b424
 46/421549103438b830?q=#421549103438b830
# via Andreas Kneib apo...@web.de
# mutt-users Message-ID: 20110105233817.ga23...@andreas.kneib.biz
# Improvements by
# David Champion d...@uchicago.edu
# Ed Blackman e...@edgewood.to

msg_date=$1   # datetime of message in local timezone 
in epoch seconds
now=$2# current time in local timezone in 
epoch seconds
msg_age=$(( ($now - $msg_date) / 86400 )) # age of message in 
integer days

if [ $msg_age -ge 30 ]; then
  format=%[%m/%d/%y]  # '01/20/11'
elif [ $msg_age -ge 7 ]; then
  format=%8[%b %d]# '  Jan 20'
elif [ $msg_age -ge 1 ]; then
  format=%8[%a %-I%P] # ' Thu 6pm'
else
  format=%[ %_I:%M%P] # '  6:41pm'
fi

echo %4C %Z $format %-15.15F (%?l?%4l%4c?) %?H?[%H]?%s%


signature.txt
Description: Digital signature


Re: Macro to move mail to trash in Gmail.

2012-01-13 Thread Ed Blackman

On Thu, Jan 12, 2012 at 08:38:01AM -0600, Luis Mochan wrote:

Acoording to the manual, there is a variable:

resolve

Type: boolean
Default: yes

When set, the cursor will be automatically advanced to the next
(possibly undeleted) message whenever a command that modifies the
current message is executed.


I found unsetting resolve all the time was annoying, since most of the 
time I *do* want to move to the next message.  Try this macro.  It uses 
a pattern I picked up in this group: save the current setting, change 
it, perform the desired action, then reset to the saved setting.


macro index,pager D enter-commandset my_resolve=\$resolve resolve=noenter\
clear-flagNsave-message+Gmail/trashenter\
enter-commandset resolve=\$my_resolve my_resolveenter move message to the 
trash

I haven't tested this particular macro, but I just rewrote the macros 
that I have that previously did save to mailbox (implicitly moving to 
next entry); move to previous entry, and they work just great with 
save resolve value; set resolve=no; save; restore saved resolve value.


--
Ed Blackman


signature.txt
Description: Digital signature


Re: Macro to move mail to trash in Gmail.

2012-01-13 Thread Ed Blackman

On Fri, Jan 13, 2012 at 06:39:00PM -0600, Christian Dysthe wrote:

On 01/13/12 at 11:36am, Ed Blackman wrote:

macro index,pager D enter-commandset my_resolve=\$resolve resolve=noenter\
clear-flagNsave-message+Gmail/trashenter\
enter-commandset resolve=\$my_resolve my_resolveenter move message to the 
trash


Thank you so much! This macro works exactly like I would like it to
except for one minor issue: It does not move to the next message after
the e-mail is delete (moved to Gmail trash). The problem before was
that it moved to the next mail and moved that to trash. Now it works
perfectly with regards to deleting and moving the mail. If it's no way
or have it move to the next mail after deletion  to do that I'm fine
with the way it works now.


OK.  You just need to move the save until after resolve is restored.  
That way the save will delete and move to the next message.


macro index,pager D enter-commandset my_resolve=\$resolve resolve=noenter\
clear-flagN\
enter-commandset resolve=\$my_resolve my_resolveenter\
save-message+Gmail/trashenter move message to the trash

Still untested.

--
Ed Blackman


signature.txt
Description: Digital signature


Re: Macro to move mail to trash in Gmail.

2012-01-14 Thread Ed Blackman

On Sat, Jan 14, 2012 at 07:50:12AM -0600, Christian Dysthe wrote:

On 01/13/12 at 09:30pm, Ed Blackman wrote:

OK.  You just need to move the save until after resolve is
restored.  That way the save will delete and move to the next
message.

macro index,pager D enter-commandset my_resolve=\$resolve resolve=noenter\
clear-flagN\
enter-commandset resolve=\$my_resolve my_resolveenter\
save-message+Gmail/trashenter move message to the trash


I've been using the macro some more. On thing I noticed is that when I
delete from the pager the mail is moved to trash immediately, but when
I do it from the index I have to refresh the folder before it's moved.
Why the difference?


I wouldn't expect a difference.  I would expect that in both cases, the 
message would be in the trash immediately after the macro completes.  In 
both cases, I would also expect that the message would still be in the 
original folder, marked for deletion, until you refresh the folder.


I don't actually use mutt to access Gmail, or IMAP at all.  I just have 
a bit of experience with writing macros, and combined the save; set; 
operate; restore pattern for macros, Luis Mochan's mention of the 
resolve setting, and your original attempt creating a macro.  So if the 
above isn't what you're seeing, hopefully someone else can help.


--
Ed Blackman


signature.txt
Description: Digital signature


  1   2   >