Re: Press any key to continue

2023-09-08 Thread Ed Blackman
I know this is a blast from the past, but I wanted to thank Christian for this 
long-ago message!  I often put aside messages for when I have time to explore 
something that is interesting to me.  I am not so good at actually going back 
and looking at them later.I had a little time recently and found his 
message.  I knew and use the first two of his points in my mutt config, so 
obviously 8-years-ago me was interested in the last one.

What a wonder!  I'm much happier now that all my macros use a space to begin 
all  and  commands, the shell escape and 
pipe-messages I do manually have only the commands that I typed in manually, 
not ones from macros.

Thanks Christian, and thanks to the mutt devs for such a great mail reader!

Ed

On Fri, Sep 25, 2015 at 09:42:50AM +0100, Christian Ebert wrote:
> * Ben Boeckel on Monday, September 21, 2015 at 14:36:34 -0400
> > On Mon, Sep 21, 2015 at 12:32:02 -0500, David Champion wrote:
> >> set my_wait_key=$wait_key
> >> unset wait_key
> >> set wait_key=$my_wait_key
> >
> > Well, that looks nasty, but it works:
> >
> >macro generic \Cy \
> >":set my_wait_key = $wait_key:unset 
> > wait_keykillall -USR1 offlineimap:set wait_key 
> > = $my_wait_key:unset my_wait_key" \
> >"kick offlineimap"
> >
> > I still think some command or function to do this would help a lot.
> > Wrapping all functions like this is…tedious to say the least. It also
> > makes reading these things annoying since the meat of the binding is
> > buried 65 characters into the line.
> 
> Sure. You can make it more readable though with line breaks:
> 
> macro pager F "\
>  set my_pipe_decode=\$pipe_decode my_wait_key=\$wait_key \
> pipe_decode=no wait_key=no\
>  /usr/bin/procmail -p -m  
> ~/.procmail/show-x-face.procmailrc\
>  set pipe_decode=\$my_pipe_decode wait_key=\$my_wait_key \
> &my_pipe_decode &my_wait_key\
> " "view x-face"
> 
> The above also:
> - uses key-binding independent 
> - unsets the my_* variables at the end to avoid conflicts
> - precedes commands with a space, so the macro internal commands
>   do not become part of history
> 
> 
> --
>   Was heißt hier Dogma, ich bin Underdogma!
> [ What the hell do you mean dogma, I am underdogma. ]
> free movies   --->>> http://www.blacktrash.org/underdogma
> http://itunes.apple.com/podcast/underdogma-movies/id363423596

-- 
Ed Blackman


Re: DKIM fails depending on Content-Transfer-Encoding

2023-09-06 Thread Ed Blackman
On Wed, Sep 06, 2023 at 01:33:30PM +0200, f...@igh.de wrote:
> Can I force Mutt to use quoted-printable or base64 by default for
> encoding of plain text?

It would be better to fix the DKIM problem, but as I have no idea about that, 
I'll tell you how I force q-p encoding: include a non-ASCII space in my 
signature.

The space between my first and last name in my signature is a non-breaking 
space, eg   in HTML.  In vim I used  to insert it.  
The non-ASCII character in the message body tickles mutt to send the message 
encoded as quoted-printable.

-- 
Ed Blackman


Re: [OT-ish] Want command line program to selectively delete emails

2023-08-06 Thread Ed Blackman
On Sun, Aug 06, 2023 at 06:41:30PM +0100, Darac Marjal wrote:
> On 04/08/2023 19:34, Ed Blackman wrote:
> > I could probably port archivemail to Python3 with enough time.
> 
> I had a go at rewriting archivemail into python3 (partly because I wanted to
> pipe messages into spam learning as I archived things), but I've now settled

Any chance you still have it?

> on using imapfilter (https://github.com/lefcha/imapfilter) as a good
> toolkit. You can basically use it as a Lua library for IMAP handling - that
> is, imapfilter will do the heavy lifting of connecting, authenticating,
> listing etc, you just need to provide it a filter file which tells it what
> to do. (For example, you can say "Get all the messages in box 'Foo' and, for
> each one if the received date is greater than X days and AND the message is
> not flagged, then delete this message").

I'd prefer something that operated on a local mail store, but I am running 
Dovecot so I can access my mail folders from my phone  Hmmm...

-- 
Ed Blackman


Re: [OT-ish] Want command line program to selectively delete emails

2023-08-06 Thread Ed Blackman
On Mon, Aug 07, 2023 at 01:57:04AM +1000, Nemo Thorx wrote:
> Quoting Ed Blackman from 04 Aug (a Friday in 2023) at 1434 hours...
> > Any suggestions for a command line program to select emails for
> > deletion based on command line options?  I specifically want one that
> > can remove emails that were received more than X days ago, but can
> > also express "but don't delete if they're flagged".
> 
> 
> 
> > I could call mutt (see, kinda OT!) with "-e" to tag, delete, sync, and
> > quit, but that seems fiddly and heavyweight.
> 
> But if it's being run from cron overnight or something, are you ever
> going to notice? 

Fair enough for "heavyweight".

I've saved your message in case I change my mind.

-- 
Ed Blackman


Re: [OT-ish] Want command line program to selectively delete emails

2023-08-06 Thread Ed Blackman
On Fri, Aug 04, 2023 at 03:15:41PM -0400, Jon LaBadie wrote:
> On Fri, Aug 04, 2023 at 02:34:44PM -0400, Ed Blackman wrote:
> > I could probably port archivemail to Python3 with enough time.
> 
> I make extensive, but very basic, use of archivemail.  I'm concerned about
> its going away.  Does anyone know of an equivalent, maintained,
> program?  Shame if it is dropped.  Though the last update was what,
> 2011 I think, it has caused no problems, it just works.

The issue is that the Python3 email API is much different from the Python2 API.

Knowing that there's at least one other archivemail user that might be 
interested in a Python3 port, I've put some work in.

Do *not* get your hopes up.  After about 5 hours, I'm down to 36 errors and 
failures in the 99 item test suite, having started from about 68 errors and 
failures after a quick Py2->Py3 syntax port.  I've also noted the absence of a 
lot of test cases.  I'm not close enough for coverage to mean anything, but I'm 
guessing the test suite covered less than half the lines of the existing code.

For now I'll keep working on it as I have time and interest, but I might drop 
it if I find something better.

-- 
Ed Blackman


[OT-ish] Want command line program to selectively delete emails

2023-08-04 Thread Ed Blackman
Any suggestions for a command line program to select emails for deletion based 
on command line options?  I specifically want one that can remove emails that 
were received more than X days ago, but can also express "but don't delete if 
they're flagged".

I had been using archivemail 
(https://manpages.debian.org/buster/archivemail/archivemail.1.en.html) from 
cron to delete emails in certain folders. It saves me from having to manually 
go in and purge folders for lists that I want to have available, but don't ever 
read old messages.

It allows commands like:
 archivemail --quiet --delete --days=30 ~/mail/folder1/
 archivemail --quiet --delete --days=30 --include-flagged ~/mail/folder2/

It supports reading Maildir, IMAP, mbox, MH, but the mailboxes I need to purge 
are all maildir.

When I recently upgraded to Debian 12, I found that archivemail has been 
removed from Debian because it's an unmaintained Python 2 program.

I could probably port archivemail to Python3 with enough time.

I could compile Python2 from source, but don't want to.

I could call mutt (see, kinda OT!) with "-e" to tag, delete, sync, and quit, 
but that seems fiddly and heavyweight.

I could extract the interesting parts of archivemail into my own script (most 
of the script is about *archiving* email, which I'm not interested in).

I could give up on using the message headers to determine the message date, 
learn how filenames are constructed in Maildir (to read the flags) and use a 
shell script built around "find".

None of those options are great, so I thought I'd see if there's something that 
I could just install.

-- 
Ed Blackman


Re: unset folder-hook

2023-07-17 Thread Ed Blackman
On Mon, Jul 17, 2023 at 07:02:34AM -0500, Ranjan Maitra wrote:
> On Sun Jul16'23 10:03:01PM, Ed Blackman wrote:
> > In my .muttrc I have:
> >
> > # Set $strict_threads in large mailboxes (which are likely to have 
> > duplicated subjects)
> > folder-hook .   set strict_threads=no
> > folder-hook =sent   set strict_threads=yes
> > folder-hook =.archive*  set strict_threads=yes
> 
> Thanks very much for this, however, I get an error, when I do the following:
> 
>  folder-hook .  'unset smtp_url'; 'set strict_threads=no'
>  folder-hook '(mutt|fedora|postfix|fetchmail|openbox)' 'set from =
> em...@address.com; set smtp_url="something"; set smtp_pass="somethingelse"; 
> set
>  envelope_from_address="em...@address.com"; set use_envelope_from=yes; set 
> from = "em...@address.com"; my_hdr Bcc:; set forward_format = "[FW frm 
> %a:%s]";set realname = "Real Name"; set ssl_force_tls = yes; set ssl_starttls 
> = yes'; 'set strict_threads=yes'

I think the syntax error you're getting is because the syntax is:
 folder-hook [!]regexp command

but you have two things after the regex.  Try:

 folder-hook .  'unset smtp_url; set strict_threads=no'

See how the command is all one quoted string?

You also have a ton of settings on that one line.  You might consider:

 folder-hook . 'source ~/.mutt/folder_defaults.rc'
 folder-hook '(mutt|fedora)'   'source ~/.mutt/folder_techlists.rc'  # or 
whatever name

Then make sure that *every* setting is set (or unset) in each RC file.  So if 
you set ssl_starttls in folder_techlists.rc, you'll need to set or unset it in 
folder_defaults.rc.  Otherwise, you will have different settings depending on 
which folders you have visited.

-- 
Ed Blackman


Re: unset folder-hook

2023-07-16 Thread Ed Blackman
On Thu, Jul 13, 2023 at 09:44:30AM -0500, Ranjan Maitra wrote:
> On Thu Jul13'23 02:10:02PM, Francesco Ariis wrote:
> > In my .muttrc I have:
> >
> > folder-hook sent "set something foobar"
> > folder-hook !sent "set something something_else"
> >
> > maybe you can use it too in your setup?
> 
> What if I have three sets of folder hooks in addition to the default? Also, 
> can I not just revert the !sent (in your case) to the default, without 
> setting everything else? I wonder if there is be a way to do the hooks only 
> for a specific set of folders and nothing else.

In my .muttrc I have:

# Set $strict_threads in large mailboxes (which are likely to have duplicated 
subjects)
folder-hook .   set strict_threads=no
folder-hook =sent   set strict_threads=yes
folder-hook =.archive*  set strict_threads=yes

The "." applies to every folder, and sets a default.  The last two change the 
setting for a specific folder, and a set of folders matching a regex.

-- 
Ed Blackman


Re: Color messages in the index view dynamically

2022-07-13 Thread Ed Blackman
I can get you part of the way, but someone else will have to help with the last 
part (if it's possible at all).

I have mutt set up to use a different index_format on a per-message basis, so 
that I can see more detailed time information for messages that are newer, and 
courser and courser as the message gets older.  For example, '  4:41pm' for a 
message less than a day old, up to '01/20/22' for a message over 30 days old.

I do this by adding this line to .muttrc:
set index_format="/home/edgewood/.mutt/bin/format_date '%[%s]' '%1<%s>' |"

That sets the index_format for each individual message by running the 
format_date command and passing information from the message, in this case the 
datetime of the message in epoch seconds, and the current datetime in epoch 
seconds.

The command then prints a different index command depending on the difference 
between them.

(Note, it looks like http://www.mutt.org/doc/manual/#index-format-hook is the 
modern way to do this.)

You could do this:
set index_format="/path/to/format_subject '%s' |"

That command would need to examine the passed subject, and print something 
different depending on what it was.

But that's where I run out of ideas.  I don't *think* you can embed ANSI color 
commands in the index format, and I don't know of a way to run shell commands 
in the pattern for color commands.

Maybe this inspires someone else that can get you closer.

Ed

On Thu, Jul 07, 2022 at 04:40:26PM +0300, dm1...@gmail.com wrote:
> Hi all,
> 
> I have some messages with a subject line containing the "due:[here
> goes some date]" text. I want mutt to color these messages differently
> and dynamically (at every opening or refreshing the mailbox) according
> to whether the date in the subject is in the past or the future
> compared with the current date.
> Is it possible to accomplish?
> 
> It would be nice to enchance the "todo.txt" approach with the "to-do
> mailbox" advantages :-)
> 
> Best,
> 
> --
> Dmitry

-- 
Ed Blackman


[OT] fetchmail replacement supporting Oauth

2022-05-01 Thread Ed Blackman
Slightly off topic, but I am using this to download mail for mutt to read.

Google seems serious about disabling app passwords for good this time in favor 
of Oauth.  I use fetchmail to download (not leaving on server) mails from a 
handful of single use gmail accounts to read locally in mutt.  The unreleased 
version of fetchmail support oauthbearer, but I don't feel like building 
fetchmail from git when I only really use it out of inertia.

Does anyone use anything fetchmail-like that:
- supports Oauth
- allows download then delete (ie, I don't want a sync)
- is in Debian bullseye (bonus if it's in buster)

-- 
Ed Blackman


Re: How to warn before sending email if "Subject:" is empty

2021-12-28 Thread Ed Blackman
On Fri, Dec 24, 2021 at 05:18:57AM +, Sam Lee via Mutt-users wrote:
> Is it possible to make Mutt warn about an empty "Subject:" right before
> sending the email?
> 
> The `abort_nosubject` configuration variable is not relevant here
> because `abort_nosubject` is only for configuring what happens when
> there is no subject given at the subject prompt.
> 
> I am looking for something similar to `abort_noattach`'s
> "No attachments, cancel sending?" warning that appears right before
> email is sent. Is there something similar for warning about an empty
> "Subject:"?

I don't believe it's possible directly with Mutt configuration, but if you send 
via sendmail (instead of SMTP), you can do that with the sendmail command 
instead, replacing it with a script that checks the email it's about to send, 
and aborts with a message if it has an empty Subject: line.

I have a similar script that, among other things, checks that I actually have 
attachments when I have "attach" or "patch" in my body text.

If you send via SMTP, I don't think you can hook into send like that.  You 
could change your editor to a script that 1) calls the real editor then 2) 
checks for an empty Subject:.  That would not prevent you from removing it in 
Mutt compose window afterward, though.

-- 
Ed Blackman


Re: index-format-hook date pattern for current week

2021-11-04 Thread Ed Blackman
On Tue, Aug 31, 2021 at 05:54:23AM -0700, li...@ifohancroft.com wrote:
[...]
> index-format-hook date "~d<1d" "%[%H:%M]" # If it's from today - I only want
> the time
> index-format-hook date "~d<1w" "%[%d %a]" # If it's from this week - I only
> want the day and the date
[...]
> The rest works as I want it to and as I expect it to, besides the week
> pattern. If any email is from the last seven days, it gets caught by the
> week pattern. I don't want that. I want only emails from the current week to
> get caught by the week pattern, not all emails from the last 7 days.
> 
> Here's what is currently happening:
> 
> Today is Tuesday, August 31st. In my email, currently, the oldest email
> being caught by the week pattern is from Wednesday, August 25th.
> 
> Here's what I want to be happening:
> 
> Today is Tuesday, August 31st. In my email, the oldest email that should be
> getting caught by the week pattern should be from Monday, August 30th.

Sorry for the late response, and I don't have a direct answer to your question, 
but since I didn't see any direct answers I figured I'd share my solution that 
might be something that you can adapt.

I use a Mutt pipe variable to let me use a script to set the index format, 
passing the datetime of the message and the current datetime as variables.  I 
then have the script do date calcuations and echo an otherwise fixed index 
format that has a variable date format.

My current script does what your index-format-hook does: shows the weekday name 
if the difference between the message and the current datetime is between 7 and 
1 days.  But since it's a shell script, the test can be changed to something 
else to do what you want.

Despite running the shell script for each visible message, I don't notice any 
slowdown.

Here's an untested patch for what you're asking for, using GNU date supporting 
the %V format string (ISO week number with Monday as the first day of the 
%week).  Note that this runs two more commands ("date" twice) for dates that 
are less than 7 days old.  I doubt that will make it noticibly slower, but test 
it.

Replace
 format="%8[%a %-I%P]" # ' Thu 6pm'

with

 # use week day name only within the same ISO week number, with weeks starting 
on Monday
 if [ "$(date +%V -d "@$now")" = "$(date +%V -d "@$msg_date") ]; then
  format="%8[%a %-I%P]"# ' Thu 6pm'
 else
  format="%8[%b %d]"   # '  Jan 20'
 fi

In ~/.mutt/muttrc:

# Show different date/time formats in index based on message age
# WORKAROUND: '<%s>' used to work, but doesn't in NeoMutt 1.7.2. Width 
specifier fixes.
set index_format="/home/edgewood/.mutt/bin/format_date '%[%s]' '%1<%s>' |"

~/.mutt/bin/format_date:

#!/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 
# mutt-users Message-ID: <20110105233817.ga23...@andreas.kneib.biz>
# Improvements by
# David Champion 
# Ed Blackman 

# 2018-10-24: remove annoying ^N and spaces added by NeoMutt 1.7
# arguments are both epoch seconds, so limiting to just digits is safe

msg_date="${1//[!0-9]}" # datetime of message in local timezone 
in epoch seconds
now="${2//[!0-9]}"  # 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%"

-- 
Ed Blackman


Re: multiple color schemes

2021-09-09 Thread Ed Blackman
On Wed, Sep 08, 2021 at 01:20:27AM -0400, Jon LaBadie wrote:
> I'd like to reduce that to a single macro that toggles between
> the files or one that allows selecting from multiple scheme
> files, perhaps in round robin fashion.

I use this to toggle printer destinations between three settings:

In ~/.mutt/muttrc:
 source ~/.mutt/rc/print-normal.rc

In ~/.mutt/rc/print-normal.rc:
 macro index  ":source ~/.mutt/rc/print-pdf.rc\n"
 set print_command="~/.mutt/bin/muttPrint --highlight=mail"
 set ?print_command

In ~/.mutt/rc/print-pdf.rc:
 macro index  ":source ~/.mutt/rc/print-pdf-onepage.rc\n"
 set print_command="~/.mutt/bin/muttPrint --highlight=mail -P PDF"
 set ?print_command

In ~/.mutt/rc/print-pdf-onepage.rc:
 macro index  ":source ~/.mutt/rc/print-normal.rc\n"
 set print_command="~/.mutt/bin/muttPrint --highlight=mail -P PDF -a 1"
 set ?print_command

So each redefines ^P to source the *next* one in the round-robin.  When 
sourced, it changes, then echos, the print_command, to remind me where I am in 
the rotation.  Probably not needed for something immediately visible like the 
color scheme.

-- 
Ed Blackman


Re: format=flowed

2019-01-05 Thread Ed Blackman
On Wed, Dec 19, 2018 at 11:10:02AM -0800, Will Yardley wrote:
> I honestly think that without better editor integration, and / or some
> way of validating that the content is actually formatted properly (or
> post-editing formatting within Mutt), that it's not a good idea for Mutt
> to support flowed text. Even when people are using the right options in
> vim and doing everything else right, it seems very fragile and prone to
> generating invalid flowed emails.

I stopped using format=flowed because not much besides Mutt supports it, 
and particularly not GMail and Outlook.  But when I did use it, I 
configured vim to use syntax highlighting to add an underline highlight 
to the trailing space at the end of a line that format=flowed uses to 
know that it's a line that should be flowed.

It was subtle enough to not bother me when composing (since the sentence 
your composing has a "trailing space" before you start the next word), 
but blatent enough to see when I'm looking over the message before 
saving.

In ~/.vim/after/syntax/mail.vim, I have:

" color trailing spaces to easily see where format=flowed lines will wrap and
" not wrap
syntax match lineEndWrap / $/
hi WrapLines term=bold,underline cterm=bold,underline gui=bold,underline

if &background == "dark"
  hi WrapLines ctermfg=White ctermbg=Black guifg=Black guibg=White
else
  hi WrapLines ctermfg=Black ctermbg=White guifg=Black guibg=White
endif

hi def link lineEndWrap WrapLines

-- 
Ed Blackman


Re: Rich text & Mutt [Was: How to tell GUI MUAs to show message in a fixed font?]

2017-05-02 Thread Ed Blackman
On Fri, Apr 28, 2017 at 08:30:03PM +1000, Erik Christiansen wrote:
> Darac, I'm sorry, but that run-on corruption of email quoting is quite
> unreadable. A failed experiment perhaps?

If you pipe the text/enriched message part to a simple pager (eg, less), 
you'll see that, as described, he composed a regular email with some 
text/enriched markers, then changed the MIME type from text/plain to 
text/enriched.

According to https://en.wikipedia.org/wiki/Enriched_text, a single 
newline in enriched text is treated like a space, thus leading to his 
paragraphs delimited by double-newlines being wrapped together.  Since 
he didn't remove the quote markers, they got wrapped, too.

-- 
Ed Blackman


Re: How to tell GUI MUAs to show message in a fixed font?

2017-05-02 Thread Ed Blackman
On Fri, Apr 28, 2017 at 02:16:08PM +, Grant Edwards wrote:
> So how, in the editor, do you tell Mutt that you've created a
> multipart alternative body?

Arrange for the editor to return a MIME message?  Right now if you set 
edit_headers and manual compose a MIME message, mutt wipes out the MIME 
headers and leaves the MIME parts as garbage in the single text/plain 
part.

But if mutt would examine the message returned from $editor to see 
whether it's a MIME message, and leave the structure intact if so, that 
would be a cheap way of allowing people to hook their own MIME 
composition systems in.  People could set $editor to "markdown_mime 
/path/to/real/editor %s" which would call the editor with what mutt 
passes, but create a MIME structure with the result before handing it 
back to mutt.

There's some complexity around what to do if $edit_headers is no (look 
for a minimal MIME structure with only the MIME headers and parts?), how 
to handle reedits (pass just the text/plain part back to $editor?  pass 
the whole thing including MIME parts?), etc, but better than overloading 
$sendmail.

-- 
Ed Blackman


Re: How to tell GUI MUAs to show message in a fixed font?

2017-05-02 Thread Ed Blackman
On Sat, Apr 29, 2017 at 06:36:42PM +1000, Erik Christiansen wrote:
> Impressive. Works well in mutt, too. But when it comes time to reply to
> such niftiness, we might be better off hard wrapping it, to restore the
> plaintext quoting - at least when multiple authors are quoted, or we
> won't know what was written by Arthur, Martha, or Mo.
> (Maybe the GUI world doesn't fuss much with attribution?)

The GUI world largely doesn't do trimmed inline replies.  They top-post 
without trimming.

-- 
Ed Blackman


Re: How to be warned about non-existent aliases?

2017-04-27 Thread Ed Blackman
On Wed, Apr 26, 2017 at 03:07:28PM +0100, Chris Green wrote:
> On Tue, Apr 25, 2017 at 02:34:56PM -0400, Ed Blackman wrote:
> > alias uk-riders uk-rid...@the-hug.net
> > # remembering is hard, aliases are cheap
> > alias uk-r uk-riders
> > alias ukr uk-riders
> > alias ukriders uk-riders
> > 
> Yes, but I belong to 60 or more lists, it would get  bit wordy!

I don't generally add lots of alias variants when I subscribe to a new 
list.  But when I see "To: notanalias@$hostname", I immediately open my 
mailing list aliases file and add "alias notanalias whatImeant".  Over a 
small number of posts to the new list, I exhaust the "here's a new way 
to get the alias wrong" space and the aliases cover all the old ways, so 
I don't have to think about what it should be.

Sort of a variant on "put it back in the first place that you looked for 
it", except I put it in all the places!

-- 
Ed Blackman


Re: How to be warned about non-existent aliases?

2017-04-25 Thread Ed Blackman
On Tue, Apr 25, 2017 at 11:16:05AM +0100, Chris Green wrote:
> Yes, it's a problem I have with mutt too.  For example I'm subscribed
> to a list called uk-rid...@the-hug.net which is aliased to uk-r, or is
> it ukr, or   

alias uk-riders uk-rid...@the-hug.net
# remembering is hard, aliases are cheap
alias uk-r uk-riders
alias ukr uk-riders
alias ukriders uk-riders

-- 
Ed Blackman


Re: How to be warned about non-existent aliases?

2017-04-25 Thread Ed Blackman
On Tue, Apr 25, 2017 at 10:36:32AM +0200, Antoine Amarilli wrote:
> I was interested to know whether there is a configuration option in mutt
> to warn the user when entering a wrong alias (that is, a recipient that
> does not contain '@' but is not known to mutt's alias database).

No configuration option that I know of, but if you send email via 
sendmail (vs SMTP), you could use a variant of 
https://dev.mutt.org/trac/wiki/ConfigTricks/CheckAttach to check that 
To, Cc, and Bcc don't contain "@$hostname" and refuse to send if so, 
otherwise passing on to sendmail.

-- 
Ed Blackman


Re: Set time zone from folder-hook?

2014-12-24 Thread Ed Blackman

On Fri, Dec 19, 2014 at 08:59:01AM +1100, Cameron Simpson wrote:

On 18Dec2014 16:50, Bernard Massot  wrote:

Dates in the index are built following the index_format variable. For
this purpose, index_format uses the strftime function's string
expansion mechanism, which doesn't provide means to show time as UTC.
However the "date" program can build UTC dates, and mutt can use
external programs to build configuration variables.

[...]
_If_ you went that way (for the index performance; as Bernard points 
out his approach invokes an outside script for every index line - 
though probably only for every _displayed_ index line, not the whole 
mail folder at once),


I use an external script to set index_format.  My script varies the time 
display based on how old the message is: messages in the last 24 hours 
display the detailed time (eg, '6:41pm'), messages in the last week show 
weekday and abbreviated time (eg, 'Thu 6pm'), and so on.


I don't need to invoke date, as everything I want to do can be 
accomplished with shell-internal math, but it's still running my script 
for every displayed index line.


I can't visually tell the difference between turning the external script 
invocation off (aside from the loss of my variable time format) or 
keeping it on.  This is on Linux on a ~7 year old system, no brand new 
speed daemon.  So the OP might want to try it.


Note that Windows is reportedly much slower to create processes than 
Linux and probably OSX, so Windows users of mutt might see a slowdown 
using an external script where the same muttrc under Linux on the same 
machine might not, but modern systems are so ridiculously fast that it's 
worth a try anyway.


--
Ed Blackman


Re: display text when a main contains HTML and text

2014-09-18 Thread Ed Blackman

On Thu, Sep 18, 2014 at 12:52:25PM +0200, Nathan Schwarz wrote:

But alternative_order works fine, no more html-mail or lynx-dumps :)


However, note that at least some multipart/alternative emails come with 
an empty or trivial text/plain part.  I don't know why someone would go 
to the trouble of writing a tool that would send multipart and then not 
put anything in the text/plain, but it does happen.  If you use 
alternative_order to prefer plain text (as I do), you'll need to 
recognize that sometimes you will need to manually select the HTML part 
read the email.


--
Ed Blackman


Re: Format flowed equals no space in depth 1

2014-09-17 Thread Ed Blackman

On Wed, Sep 17, 2014 at 12:24:31PM -0500, Derek Martin wrote:

I'm not suggesting Mutt should be just like Outlook or Firefox--it
serves a different niche (but it is indeed a niche).  However I do
think that it's hard to argue convincingly that Mutt users would not
universally benefit if it handled more of the esoteric details for
them (at least by default, still allowing advanced users to do what
they want).  For some of that, closer integration of the pieces is
going to be required, practically speaking.


I'm not one of the developers of Mutt, nor am I some representative of 
all of Mutt's users.  However, it seems to me that the devs and at least 
most of the users like things as they are, such that you need to know a 
good bit about email to use Mutt.  Otherwise they would be developing 
changes[1] or switching to another email client.


That being the case, I don't know that passionate rants on the mailing 
list are going to do much good.  The people on this list have 
self-selected to be users of a email tool that requires you to know a 
bit about email internals to use it, and have further self-selected to 
join a list to converse and swap tips about that editor with other 
like-minded people.  Making things easier for non-geeks, when non-geeks 
are not likely to want to use mutt for many other reasons other than 
difficulties writing flowed or HTML text, doesn't seem to be a priority.


[1] Quick googling finds this message suggesting a feature freeze for 
1.6: http://markmail.org/message/pdqwhg277u7lwzer  Note that we recently 
passed the 8th anniversary.


--
Ed Blackman


signature.txt
Description: Digital signature


Re: delete only undeleted messages?

2014-02-26 Thread Ed Blackman

On Wed, Feb 26, 2014 at 04:45:00PM +0100, Peter P. wrote:

   folder-hook . 'macro pager d "=Trash \r"

[...]

Is there a way to incoorporate the status/flag of a message as
conditional for the above key binding to only allow saving to trash if
the message is not marked as 'deleted'?


You might want to investigate the 'trash' patch, which is commonly 
already applied to packaged versions of mutt.  
http://cedricduval.free.fr/mutt/patches/#trash


If you don't have the patch and don't want to build mutt to apply it, 
there are not a lot of good options.  The main problem is there's no way 
I know of to do general conditional logic ("if message isn't marked as 
deleted, save to trash, otherwise do nothing") directly in a macro.


The only conditional logic I know of is tag-prefix-cond, but I can't 
think of a way to use that for your end.


You can use backticks to move some of the conditional logic to a shell 
script.  You would need a macro that would pipe a message to save it in 
a known location, then use :push with backticks to call a program that 
read the email in that location, then either emitted the command to save 
the message or a noop depending on whether the email's Message-Id was in 
a cache.


It would look something like this:

macro index d 'cat > /tmp/message.txt\
:push `/path/to/script.sh`' "Save to trash folder"

/path/to/script.sh would:
1) read /tmp/message.txt and extract the Message-Id
2) check to see if the Message-Id was in the cache
3) if not, print '=Trash' and add the Id to 
the cache


If the message was in the cache, the script would do nothing, causing 
the macro to do nothing further.


Pretty convoluted, and race-prone since you have to save the message in 
a fixed location.  There might be further tricks to remove that 
particular limitation, but I've procrastinated enough today.


--
Ed Blackman


Re: Adding to Alias

2013-10-09 Thread Ed Blackman

On Mon, Oct 07, 2013 at 03:05:15PM -0400, Patrick Shanahan wrote:

* Ed Blackman  [10-07-13 14:52]:

It does mean that I occasionally clobber a manual settings change I've
made when I just want to refresh the screen, but I try not to make too
many manual settings changes.  If I do something manually twice, it's
usually worth the time to script it, if only because I won't forget how
to do it the next time I want to do it.


If the file(s) you source contain settings you have altered manually
within a mutt session, your manual settings will replaced by the settings
contained within the sourced file(s).  Any other action would not make
sense or *why* would one/you source files?


I'm not puzzled about the behavior, or complaining about it.  The OP had 
expected the  keybinding to reload his aliases.  Others 
explained that  redraws your screen.  I was just pointing out 
that he could create a macro (and I have done so) that tells mutt that 
^L should redraw the screen AND reload my muttrc (including my aliases).


That works for me most of the time, but does have the downside I pointed 
out: when you tie two things together, sometimes you want just one of 
them.


It's not a big problem, especially because it encourages me to not do 
too many things manually, just to have to figure it out again the next 
time I want to do it, or to lose it when the mutt session ends.


--
Ed Blackman


Re: Adding to Alias

2013-10-07 Thread Ed Blackman

On Sat, Sep 21, 2013 at 12:18:17PM -0700, Josef Bailey wrote:

I go into my ~/.mutt-alias and i can manually add stuff to my alias ..
The problem is i need a way to refresh the screen show it shows up in
mutt .. i tried ^L witch is refersh in my key bindings but that was a
no go


I have replaced the default meaning of ^L in my keybindings:

macro generic \Cl ":source ~/.mutt/muttrc\n"

That makes mutt reread my muttrc (which I keep in ~/.mutt), then refresh 
the screen (the default behavior).


It does mean that I occasionally clobber a manual settings change I've 
made when I just want to refresh the screen, but I try not to make too 
many manual settings changes.  If I do something manually twice, it's 
usually worth the time to script it, if only because I won't forget how 
to do it the next time I want to do it.


--
Ed Blackman


Re: New mail indicator

2012-05-11 Thread Ed Blackman

On Thu, May 10, 2012 at 04:39:33PM -0400, Ed Blackman wrote:

On Thu, May 10, 2012 at 06:58:28PM +0700, Diep Pham Van wrote:

Sometimes when reading a new mail, I must going to an other folder and
after some searching, I have no idea where is my previous
folder.

Or is there some tool that I don't know but every one use to make your
life with mutt easier?


I read mutt inside of screen, and use a macro to change folders such 
that the new folders is opened in a separate screen window, keeping 
the original folder where I left it.


macro index F 'set my_folder=`mutt-prompt 
"Change to folder" \\`; push "!screen -X screen mutt -f 
$my_folder\"'


That's all one line.  It uses mutt-prompt, which I got from this 
mailing list a while ago.  I'd be happy to post or send it if anyone's 
interested.


Diep Pham Van replied in an email direct to me: "Post it please. And how 
can I use this with tmux? :D"


I've attached it.  It's mostly as I received it, though I added a line 
to change directory to $HOME/mail, which is where $folder points to.  
That lets me use tab completion to enter the names of mailboxes under 
$folder.  This will only work for local mailboxes, though.


I don't know tmux, but "screen -X screen " tells a running 
screen to open a new window running .  If I typed "screen -X 
screen mutt" at a command prompt in a screen window, screen will create 
a new screen window running mutt and switch to it.  The macro uses that 
to switch to a new window running mutt in the given folder.


I presume that tmux has something similar, and someone more familiar 
with tmux may help you adjust the macro.


--
Ed Blackman
#!/bin/bash
##
## usage: mutt-prompt "prompt text"
## 
## In muttrc:
##   set my_var=`mutt-prompt "Folder"`
##

cd ~/mail

# save current tty state
s=`stty -g`

# redirect default i/o, saving current stdout in fd 5
exec 5>&1
exec >/dev/tty &5

# reset tty state
stty "$s"


signature.txt
Description: Digital signature


Re: Send-hook "set my_hdr" Not Working as Expected

2012-05-10 Thread Ed Blackman

On Thu, May 10, 2012 at 09:28:03PM +0100, Koralatov wrote:

On Thu, May 10, 2012 at 19:09, Ed Blackman wrote:

I use this pattern:

send-hook . my_hdr "From: "
send-hook "~t @mutt.org"my_hdr "From: "
send-hook "~t @example.com" my_hdr "From: "


I'm testing it now, but so far, it seems to work.  Should I use the same
pattern ("~t b...@blah.com") for "set signature" as well?


Assuming you want the signature to change in sync with the From: line, 
yes.  You can use any patterns that fit your needs, not just ~t.


--
Ed Blackman


signature.txt
Description: Digital signature


Re: New mail indicator

2012-05-10 Thread Ed Blackman

On Thu, May 10, 2012 at 06:58:28PM +0700, Diep Pham Van wrote:

Sometimes when reading a new mail, I must going to an other folder and
after some searching, I have no idea where is my previous
folder.

Or is there some tool that I don't know but every one use to make your
life with mutt easier?


I read mutt inside of screen, and use a macro to change folders such 
that the new folders is opened in a separate screen window, keeping the 
original folder where I left it.


macro index F 'set my_folder=`mutt-prompt 
"Change to folder" \\`; push "!screen -X screen mutt -f 
$my_folder\"'


That's all one line.  It uses mutt-prompt, which I got from this mailing 
list a while ago.  I'd be happy to post or send it if anyone's 
interested.


--
Ed Blackman


signature.txt
Description: Digital signature


Re: Send-hook "set my_hdr" Not Working as Expected

2012-05-10 Thread Ed Blackman

On Wed, May 09, 2012 at 10:47:58PM +0100, Koralatov wrote:

 send-hook *   "unmy_hdr From:"
 send-hook *   "my_hdr From: Michael Graham "
 send-hook @mutt.org   "unmy_hdr From:"
 send-hook @mutt.org   "my_hdr From: Koralatov "


I use this pattern:

send-hook . my_hdr "From: "
send-hook "~t @mutt.org"my_hdr "From: "
send-hook "~t @example.com" my_hdr "From: "

It works for me.

--
Ed Blackman


signature.txt
Description: Digital signature


Re: Mail times/date in local time zone

2012-03-30 Thread Ed Blackman

On Fri, Mar 30, 2012 at 02:27:47PM -0500, Kumar Appaiah wrote:

Often, I wish to know the time at which someone wrote me an e-mail
converted to the local time zone. Since most of my contacts live in
another time zone, (and some use the time zone + even though that
isn't where they live), I have to do some mental calculations which
I'd like to avoid sometimes.

Currently, my workaround for this is to make Mutt unignore a header
called X-Date, and add a procmail recipe like this:


Your procmail recipe adds the date at the time the message is received.  
Perhaps using "%(fmt)" in your index_format instead of the default 
"%{fmt}" would help you get the desired time format in the index.


man muttrc and search for index_format to learn the difference between 
the two.  If you don't have an index_format set, the default is

"%4C %Z %{%b %d} %-15.15L (%?l?%4l&%4c?) %s".  Experiment with
"%4C %Z %(%b %d) %-15.15L (%?l?%4l&%4c?) %s" instead.

I don't think there's a way to change it in the pager.

--
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 "set my_resolve=\$resolve resolve=no\
N\
set resolve=\$my_resolve &my_resolve\
+Gmail/trash" "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


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 "set my_resolve=\$resolve resolve=no\
N+Gmail/trash\
set resolve=\$my_resolve &my_resolve" "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 "set my_resolve=\$resolve resolve=no\
N\
set resolve=\$my_resolve &my_resolve\
+Gmail/trash" "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-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 "set my_resolve=\$resolve resolve=no\
N+Gmail/trash\
set resolve=\$my_resolve &my_resolve" "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: 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-users&m=129426504121286&w=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 
# mutt-users Message-ID: <20110105233817.ga23...@andreas.kneib.biz>
# Improvements by
# David Champion 
# Ed Blackman 

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: 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: 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-users&m=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: 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.  


--
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 
##
## 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   ..."
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 "bounce"s (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
" , 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("")
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: 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: 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  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: 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  [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: 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: 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: 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: mairix search

2011-05-02 Thread Ed Blackman

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

Quoting Ed Blackman  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: mairix search

2011-04-29 Thread Ed Blackman

On Fri, Apr 29, 2011 at 01:56:51PM +0200, Sebastian Tramp wrote:

I have a question regarding macros in mutt. Currently I use these two
macros for searching:

macro generic ,f "mairix " "search via mairix"
macro generic ,,f "=search" "load the search 
results mailbox"

Can I optimize it in the way that after finishing the search with ,f -
the result mailbox is automatically loaded?


I run mutt inside screen, and use the following macro to switch to a 
separate window to run a mairix query.  It will open mutt on the search 
folder if the query is successful.  Otherwise, it will exit, which 
returns me to the original screen session (mutt).


# prompt for mairix search parameters
macro index,pager,browser ,m "\
 set my_wait_key=\$wait_key wait_key=no\
screen -X screen -t 'mutt search' sh -c 'mairixquery && mutt -f 
=search'\
set wait_key=\$my_wait_key &my_wait_key" "mairix query"

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.


It doesn't need to be that fancy for this strategy to work for you, 
assuming you read mutt inside screen.  All it has to do is let you enter 
mairix command line options after the new screen has already been 
launched.


--
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: 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 ""
and
  macro pager q "push "
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: 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 
# 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: 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: 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: 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: 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 % 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 
# mutt-users Message-ID: <20110105233817.ga23...@andreas.kneib.biz>
# Improvements by
# David Champion 
# Ed Blackman 

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: 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: 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 
##
## 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   ..."
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: 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: 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: 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: 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: [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: 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


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: [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


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 
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


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 .
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: mutt on a remote machine

2010-08-31 Thread Ed Blackman

On Tue, Aug 31, 2010 at 07:31:58PM +0300, Alex Sa wrote:

Is there any way to protect these folders? Or give up using 'em? Or
any other workaround?

encryption via your secure shell?


Thanks, PAtrick, but what kind of encryption do you mean? And if these
folders will be decrypted after the mutt starts, then they will be
available to almost anyone, who will be logged to the machine in the
same time? :)


Are you worried about other users on the machine, not including the 
admin, or also about the admin?


If you're just worried about other users invading your privacy, just 
point your header_cache to a directory that is owned by you with 
permissions set to 700.  My home directory is 700, which will keep other 
users out of anything under it.


If you can't trust the admin to respect your privacy, don't get an 
account on that machine.  Outside of a very locked-down, "trusted 
computing" environment, anything you do to try to secure yourself can be 
undone by a determined admin.  At best you can protect yourself from 
casual snooping.


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


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: Add header automatically

2010-06-27 Thread Ed Blackman

On Sat, Jun 26, 2010 at 09:09:06PM +0200, Eric Smith wrote:

Thanks Michael, yes that works.  But effect is to send that null file
each time that you do not actually want to attach a file, in which
case you would edit that header and remove the placeholder filename.


I have my $editor set to a Perl script that manipulates the incoming 
message in various custom ways before handing it off to my real editor.  
Adding a new header would be trivial.


The only disadvantage is that I have lost the "Aborted unmodified 
message" detection, which I could fix if I ever was bothered enough to 
figure out how mutt detects unmodified messages (file timestamp?)


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


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: 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: 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 \
# 'source ~/.mutt/rc/print.rcmuttPrint 
[enscript args]\
# source ~/.mutt/rc/unprint.rc'

# 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: 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.  



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: 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-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: 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: 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: 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: 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.  mutt instead of 


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


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: what is the benefit of imap? Another meta-question.

2009-03-18 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!




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: 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 " 
 "


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

macro index p "set my_weed=$weedunset weed
 set weed=$my_weed"

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 
, the message prints, and it should be reset by the 
second .


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: 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  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 "set my_weed=$weedunset 
weed" to the beginning of the macro and "set 
weed=$my_weed" at the end.  I'm guessing at the content of the 
macro, but that should work.


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: 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  [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 ', 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  editor function clears that line. Thus,
the above is equivalent to:

   macro compose z "Identity_" "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 
alias Identity_school  Ed Blackman 
alias Identity_hobby   Ed Blackman 

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

macro compose z "Identity_" "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: 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: 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-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 <

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: 


Ed


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


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 .
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: 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 . 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


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 'set pipe_decodemuttPrint 
--highlight=mail -P ToPDF'

#!/bin/sh
#
# muttPrint
#
# macro index,pager p \
# 'set pipe_decodemuttPrint [enscript 
args]'

# 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


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: how to mark all as read?

2009-01-04 Thread Ed Blackman

On Mon, Jan 05, 2009 at 02:12:46PM +0800, Chengqi(Lars) Song wrote:

i know how to do it step by step:
ctrl-t
~N 
;N 

but how to bind this function to a single key?


macro index c 
"~T\n~N\n~T\n"

Change the key to something you'd prefer.  The first part clears any 
existing tags, so that the  doesn't turn the New flag on for 
those messages.  It won't do anything if you don't have tagged messages.


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 s "!screen -X screen mutt -f =sent\n"
macro index F 'set my_folder=`mutt-prompt "Change to folder" \\`; push 
"!screen -X screen mutt -f $my_folder\"'

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 c "!screen -X screen mutt -f ^\n"

Explanation:
"" 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


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


  1   2   >