[solved] Re: get mail in directory browser

2009-04-06 Thread Zhengquan Zhang
On Tue, Apr 07, 2009 at 05:55:52AM +0200, Nicolas Sebrecht wrote:
> On Mon, Apr 06, 2009 at 09:56:08PM -0500, Zhengquan Zhang wrote:
> 
> > macro index,pager G "! /usr/bin/getmail -v \n" "Invoke getmail"
> 
> macro generic,pager G "! /usr/bin/getmail -v \n" "Invoke getmail"
Thanks, Nicolas,
> 
> -- 
> Nicolas Sebrecht

-- 
Zhengquan


Re: get mail in directory browser

2009-04-06 Thread Zhengquan Zhang
On Mon, Apr 06, 2009 at 10:39:17PM -0500, Kyle Wheeler wrote:
> On Monday, April  6 at 09:56 PM, quoth Zhengquan Zhang:
> >macro index,pager G "! /usr/bin/getmail -v \n" "Invoke getmail"
> >
> >to get mail from pop servers.
> 
> While simple-looking, it's generally a better idea to call the 
> functions you want to use directly from your macro, rather than use 
> keybindings that may later change. For example, if you ever decide to 
> rebind the ! key, or bind the "! " combination, this macro would stop 
> working unexpectedly.
> 
> Here's a better way of writing the same macro:
> 
> macro index,pager G "/usr/bin/getmail -v" \
>  "Invoke Getmail"
> 
> >But as you see the macro works only in index and pager environment.
> >I also want to be able to get mail when I was in directory browser, that
> >is when I was changing mailboxes.
> 
> Easy - just add another comma:
> 
> macro index,pager,browser G ...etc...
> 
> OR you could try:
> 
> macro generic G ...etc...
> 
> But that latter would be overridden by any 
> index/pager/browser-specific G keybindings.
> 
Thanks Kyle, I appreciate it so much.
Zhengquan

> 
> ~Kyle
> -- 
> The average Ph.D thesis is nothing but the transference of bones from 
> one graveyard to another.
> -- J. Frank Dobie, "A Texan in England"

-- 
Zhengquan


Re: get mail in directory browser

2009-04-06 Thread Nicolas Sebrecht
On Mon, Apr 06, 2009 at 09:56:08PM -0500, Zhengquan Zhang wrote:

> macro index,pager G "! /usr/bin/getmail -v \n" "Invoke getmail"

macro generic,pager G "! /usr/bin/getmail -v \n" "Invoke getmail"

-- 
Nicolas Sebrecht


Re: get mail in directory browser

2009-04-06 Thread Kyle Wheeler
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Monday, April  6 at 09:56 PM, quoth Zhengquan Zhang:
>macro index,pager G "! /usr/bin/getmail -v \n" "Invoke getmail"
>
>to get mail from pop servers.

While simple-looking, it's generally a better idea to call the 
functions you want to use directly from your macro, rather than use 
keybindings that may later change. For example, if you ever decide to 
rebind the ! key, or bind the "! " combination, this macro would stop 
working unexpectedly.

Here's a better way of writing the same macro:

macro index,pager G "/usr/bin/getmail -v" \
 "Invoke Getmail"

>But as you see the macro works only in index and pager environment.
>I also want to be able to get mail when I was in directory browser, that
>is when I was changing mailboxes.

Easy - just add another comma:

macro index,pager,browser G ...etc...

OR you could try:

macro generic G ...etc...

But that latter would be overridden by any 
index/pager/browser-specific G keybindings.

~Kyle
- -- 
The average Ph.D thesis is nothing but the transference of bones from 
one graveyard to another.
-- J. Frank Dobie, "A Texan in England"
-BEGIN PGP SIGNATURE-
Comment: Thank you for using encryption!

iEYEARECAAYFAknayuUACgkQBkIOoMqOI16lowCbBu4J7u/BR/UtzDaCiInaBeUA
S0MAoMjF4fgKLMn7phMhlKuTFNe/9oLv
=J24c
-END PGP SIGNATURE-


get mail in directory browser

2009-04-06 Thread Zhengquan Zhang
Dear mutt community,
I use 

macro index,pager G "! /usr/bin/getmail -v \n" "Invoke getmail"

to get mail from pop servers.

But as you see the macro works only in index and pager environment.
I also want to be able to get mail when I was in directory browser, that
is when I was changing mailboxes.

Could you please tell me how to modify the macro definition to make it
working?

Thanks,


-- 
Zhengquan


Re: spoolfile and move clarification

2009-04-06 Thread Zhengquan Zhang
On Mon, Apr 06, 2009 at 06:42:30PM -0500, Kyle Wheeler wrote:
> On Monday, April  6 at 05:26 PM, quoth Zhengquan Zhang:
> >here is a snippet of my getmailrc
> >
> >[destination]
> >type = MDA_external
> >path = /usr/bin/procmail
> >
> >I use getmail to fetch mail from pop server and use procmail to 
> >process the mails. I 'guess' I don't have a spoolfile for getmail 
> >since my spoolfile in /var/mail is always empty. I also posted the 
> >question "whether I have a spoolfile in this situation" on getmail 
> >mailing list.
> 
> :)
> 
> You don't have a spoolfile in this case. Your mail is being handed 
> directly to the external MDA (namely, procmail).
Thanks, Kyle, I have got postfix running on another machine and whenever I
send email to that machine it will be stored in /var/mail. I guess that
is why I thought it should have a spoolfile;)
> 
> ~Kyle
> -- 
> Seeing a murder on television [...] can help work off one's 
> antagonisms. And if you haven't any antagonisms, the commercials will 
> give you some.
> -- Alfred Hitchcock

-- 
Zhengquan


Re: spoolfile and move clarification

2009-04-06 Thread Kyle Wheeler
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Monday, April  6 at 05:26 PM, quoth Zhengquan Zhang:
>here is a snippet of my getmailrc
>
>[destination]
>type = MDA_external
>path = /usr/bin/procmail
>
>I use getmail to fetch mail from pop server and use procmail to 
>process the mails. I 'guess' I don't have a spoolfile for getmail 
>since my spoolfile in /var/mail is always empty. I also posted the 
>question "whether I have a spoolfile in this situation" on getmail 
>mailing list.

:)

You don't have a spoolfile in this case. Your mail is being handed 
directly to the external MDA (namely, procmail).

~Kyle
- -- 
Seeing a murder on television [...] can help work off one's 
antagonisms. And if you haven't any antagonisms, the commercials will 
give you some.
-- Alfred Hitchcock
-BEGIN PGP SIGNATURE-
Comment: Thank you for using encryption!

iEYEARECAAYFAknak2YACgkQBkIOoMqOI15k0gCgv2Gd4/jkMoCcD5unH5JowqC8
ZKsAoKL49BjcMhQ9BJahFh/zhjV8RJtF
=OER6
-END PGP SIGNATURE-


Re: spoolfile and move clarification

2009-04-06 Thread Daniel Dalton
On Mon, Apr 06, 2009 at 04:40:19PM -0500, Zhengquan Zhang wrote:
> DEFAULT=$MAILDIR/inbox/

Ah yes, thanks! That did the trick.

Cheers,

Daniel.


signature.asc
Description: Digital signature


Re: spoolfile and move clarification

2009-04-06 Thread Zhengquan Zhang
On Mon, Apr 06, 2009 at 05:11:13PM -0500, Kyle Wheeler wrote:
> On Monday, April  6 at 04:50 PM, quoth Zhengquan Zhang:
> >> If that's your entire muttrc, it is meaningless. It would only have 
> >> any meaning if you use mbox-hooks elsewhere in your config.
> >
> > Thanks, so is there any rationale behind how to set spoolfile and mbox 
> > if we consider using getmail4 and procmail with mutt? There are so many 
> > different muttrc over the web and it is really confusing for a 
> > beginner...
> 
> Think about mutt this way: mutt is, first and foremost, a mailbox 
> viewer. It will show you the contents of a mailbox. There are some 
> hooks in there (mostly for historical reasons) for handling spoolfiles 
> and such, but unless you run your own mail server, chances are that 
> stuff is irrelevant.
Thanks for the insight, I used to think mutt is not only a mailbox
viewer.
> 
> If you tell mutt about mail that might be elsewhere (e.g. with a 
> $spoolfile setting), mutt will think you told it because you expect it 
> to DO something with that information. Don't put in information that 
> mutt doesn't need to know. So if you use getmail and procmail to 
> deliver your mail to a set of folders in your home directory, tell 
> mutt to look in those folders. You shouldn't even be using a 
> spoolfile, and mutt certainly doesn't need to be told to go looking 
> for one.
here is a snippet of my getmailrc

[destination]
type = MDA_external
path = /usr/bin/procmail

I use getmail to fetch mail from pop server and use procmail to process
the mails. I 'guess' I don't have a spoolfile for getmail since my
spoolfile in /var/mail is always empty. I also posted the question
"whether I have a spoolfile in this situation" on getmail mailing list.


> 
> The $spoolfile also specifies "what folder does mutt open when you 
> launch it". So, for example, I use something similar to this:
> 
>  set folder="imap://u...@mailserver/"
>  set spoolfile=+INBOX
>  set postponed=+Drafts
>  set record=+Sent
>  unset mbox
> 
> Thus, when I launch mutt, it opens up my INBOX (i.e. $spoolfile).
> 
> Does that help?

Thank you very much Kyle, I appreciate your explanations.
> 
> ~Kyle
> -- 
> Life is too important to be taken seriously.
>  -- Oscar Wilde


Re: spoolfile and move clarification

2009-04-06 Thread Kyle Wheeler
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Monday, April  6 at 04:50 PM, quoth Zhengquan Zhang:
>> If that's your entire muttrc, it is meaningless. It would only have 
>> any meaning if you use mbox-hooks elsewhere in your config.
>
> Thanks, so is there any rationale behind how to set spoolfile and mbox 
> if we consider using getmail4 and procmail with mutt? There are so many 
> different muttrc over the web and it is really confusing for a 
> beginner...

Think about mutt this way: mutt is, first and foremost, a mailbox 
viewer. It will show you the contents of a mailbox. There are some 
hooks in there (mostly for historical reasons) for handling spoolfiles 
and such, but unless you run your own mail server, chances are that 
stuff is irrelevant.

If you tell mutt about mail that might be elsewhere (e.g. with a 
$spoolfile setting), mutt will think you told it because you expect it 
to DO something with that information. Don't put in information that 
mutt doesn't need to know. So if you use getmail and procmail to 
deliver your mail to a set of folders in your home directory, tell 
mutt to look in those folders. You shouldn't even be using a 
spoolfile, and mutt certainly doesn't need to be told to go looking 
for one.

The $spoolfile also specifies "what folder does mutt open when you 
launch it". So, for example, I use something similar to this:

 set folder="imap://u...@mailserver/"
 set spoolfile=+INBOX
 set postponed=+Drafts
 set record=+Sent
 unset mbox

Thus, when I launch mutt, it opens up my INBOX (i.e. $spoolfile).

Does that help?

~Kyle
- -- 
Life is too important to be taken seriously.
 -- Oscar Wilde
-BEGIN PGP SIGNATURE-
Comment: Thank you for using encryption!

iEYEARECAAYFAknafgEACgkQBkIOoMqOI17QbQCfRUm0CYoKrrq/0pi+ly5WfdNT
gUwAoKwpry2iP8ugxO6HyPS/pXvs4fBI
=som2
-END PGP SIGNATURE-


Re: spoolfile and move clarification

2009-04-06 Thread Zhengquan Zhang
On Mon, Apr 06, 2009 at 04:43:41PM -0500, Kyle Wheeler wrote:
> On Monday, April  6 at 04:13 PM, quoth zhang zhengquan:
> >Dear mutt community,
> >here is a snippet of my muttrc
> >
> >set spoolfile=+inbox
> >set mbox=+inbox
> >set mbox_type=Maildir
> >set folder="~/.muttmail"
> >set move=yes
> 
> Both $spoolfile and $mbox may not be what you want them to be, since 
> (because they use the "+" prefix) they depend on the value of $folder, 
> which is defined AFTER they need it. You probably want to set the 
> $folder value first.
Sorry I did not notice this, but in my muttrc I set folder first...
> 
> >since spoolfile and mbox are the same folder and move=yes,
> >what is the meaning of move=yes in this situation?
> 
> If that's your entire muttrc, it is meaningless. It would only have 
> any meaning if you use mbox-hooks elsewhere in your config.

Thanks, so is there any rationale behind how to set spoolfile and mbox
if we consider using getmail4 and procmail with mutt? There are so many
different muttrc over the web and it is really confusing for a
beginner...


Z
> 
> ~Kyle
> -- 
> Do not seek to follow in the footsteps of the men of old. Seek what 
> they sought.
> -- Matsuo Basho


Re: spoolfile and move clarification

2009-04-06 Thread Kyle Wheeler
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Monday, April  6 at 04:13 PM, quoth zhang zhengquan:
>Dear mutt community,
>here is a snippet of my muttrc
>
>set spoolfile=+inbox
>set mbox=+inbox
>set mbox_type=Maildir
>set folder="~/.muttmail"
>set move=yes

Both $spoolfile and $mbox may not be what you want them to be, since 
(because they use the "+" prefix) they depend on the value of $folder, 
which is defined AFTER they need it. You probably want to set the 
$folder value first.

>since spoolfile and mbox are the same folder and move=yes,
>what is the meaning of move=yes in this situation?

If that's your entire muttrc, it is meaningless. It would only have 
any meaning if you use mbox-hooks elsewhere in your config.

~Kyle
- -- 
Do not seek to follow in the footsteps of the men of old. Seek what 
they sought.
-- Matsuo Basho
-BEGIN PGP SIGNATURE-
Comment: Thank you for using encryption!

iEYEARECAAYFAknad4wACgkQBkIOoMqOI141FACg2KPkZ2YUeSCX/ZKDg/lt4yR5
tEoAoLF1PtlEk6rpHj2q8yRpfEYpVrtY
=KliJ
-END PGP SIGNATURE-


Re: spoolfile and move clarification

2009-04-06 Thread Zhengquan Zhang
On Tue, Apr 07, 2009 at 07:33:11AM +1000, Daniel Dalton wrote:
> On Mon, Apr 06, 2009 at 04:13:47PM -0500, zhang zhengquan wrote:
> > Dear mutt community,
> > here is a snippet of my muttrc
> > 
> > set spoolfile=+inbox
> 
> If I do this, how do i tell procmail the default inbox has changed from
> /var/mail/daniel?
> I tried exporting $MAIL in .bashrc, but messages still got dropped in
> that old folder in /var/mail...
> 
> Thanks!
> 
> Daniel.

in .procmailrc

MAILDIR=$HOME/.muttmail
DEFAULT=$MAILDIR/inbox/

and in getmailrc
I have

[destination]
type = MDA_external
path = /usr/bin/procmail

my /var/spool/mail is always empty

I wonder whether I used spoolfile at all because getmail directly
redirects mails to procmail...

Z


Re: spoolfile and move clarification

2009-04-06 Thread Daniel Dalton
On Mon, Apr 06, 2009 at 04:13:47PM -0500, zhang zhengquan wrote:
> Dear mutt community,
> here is a snippet of my muttrc
> 
> set spoolfile=+inbox

If I do this, how do i tell procmail the default inbox has changed from
/var/mail/daniel?
I tried exporting $MAIL in .bashrc, but messages still got dropped in
that old folder in /var/mail...

Thanks!

Daniel.


signature.asc
Description: Digital signature


spoolfile and move clarification

2009-04-06 Thread zhang zhengquan
Dear mutt community,
here is a snippet of my muttrc

set spoolfile=+inbox
set mbox=+inbox
set mbox_type=Maildir
set folder="~/.muttmail"
set move=yes

since spoolfile and mbox are the same folder and move=yes,
what is the meaning of move=yes in this situation?

I copied this snippet from another user's rc and would like to
understand the pros and cons of this setup,

Thanks,
-- 
Zhengquan


Re: mutt's internal fetch mail problem

2009-04-06 Thread Zhengquan Zhang
On Mon, Apr 06, 2009 at 09:56:15PM +0200, Rocco Rutte wrote:
> Hi,
> 
> * zhang zhengquan wrote:
> 
> > I used to use G to fetch mail from the pop server and also I have
> > getmail running in cron to getmail from pop server.
> > I realized that internal fetch mail might not redirect the incoming
> > mail to procmail so it is not filtered?
> 
> As documented in the manual, the fetch-mail function stores mail in
> $spoolfile.
> 
> Rocco
Thanks Rocco, I have remapped G to point to getmail,
Zhengquan


Re: mutt's internal fetch mail problem

2009-04-06 Thread Rocco Rutte
Hi,

* zhang zhengquan wrote:

> I used to use G to fetch mail from the pop server and also I have
> getmail running in cron to getmail from pop server.
> I realized that internal fetch mail might not redirect the incoming
> mail to procmail so it is not filtered?

As documented in the manual, the fetch-mail function stores mail in
$spoolfile.

Rocco


mutt's internal fetch mail problem

2009-04-06 Thread zhang zhengquan
Dear mutt users,
recently I noticed that my procmail recipe is not working with mutt's
internal fetch mail feature.
I used to use G to fetch mail from the pop server and also I have
getmail running in cron to getmail from pop server.
I realized that internal fetch mail might not redirect the incoming
mail to procmail so it is not filtered?

Can anybody verify this?
Thanks,

-- 
Zhengquan


Re: Use gvim with mutt to compose email

2009-04-06 Thread Kyle Wheeler
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Monday, April  6 at 09:01 PM, quoth Dave Feustel:
> I currently have the mutt editor set to vim. I would like to 
> use gvim instead, but when I specify gvim and start a reply 
> to an email, gvim starts with an empty screen. Is there a 
> way to get mutt to start gvim with the message already loaded?

The reason that gvim starts with an empty screen is because of the way 
it detaches itself from the terminal.

The way mutt handles the editor is by creating a temporary file for 
the message, launching the editor, and waiting for it to exit. When 
(as far as mutt can tell) the editor exits, it reads and then deletes 
the temporary file. When you launch gvim, it creates a second gvim 
process that is detached from the terminal, and then the first 
(original) one exits. Mutt notices that this first one exited, and so 
deletes the temporary file. Thus, by the time the second gvim process 
has gotten underway, the temporary file is gone. More importantly, 
mutt is no longer paying attention to whatever gvim might do.

The way to fix this situation is to prevent gvim from disconnecting 
itself from the terminal, so that mutt can properly wait for it. Do 
this by setting $editor to "gvim -f"

Make sense?

~Kyle
- -- 
I have always found that mercy bears richer fruits than strict 
justice.
 -- Abraham Lincoln
-BEGIN PGP SIGNATURE-
Comment: Thank you for using encryption!

iEYEARECAAYFAknaP9EACgkQBkIOoMqOI16FOwCgmaaeReRStRISK4nPv2JcZWKU
ALYAoLL86h3TvmcQFm+xKle/767WXqbW
=Nhfk
-END PGP SIGNATURE-


Use gvim with mutt to compose email

2009-04-06 Thread Dave Feustel
I currently have the mutt editor set to vim. I would like to
use gvim instead, but when I specify gvim and start a reply
to an email, gvim starts with an empty screen. Is there a
way to get mutt to start gvim with the message already loaded?

Thanks.