Re: How can I get mail from /var/mail/jatmin to my spoolfile
After having discovered macros I came up with the following solution for
moving mail from /var/mail/jatmin to ~/INBOX.
macro index,pager G "\
<enter-command>unset wait_key<enter>\
<shell-escape>\
if [[ -s /var/mail/$USER ]]; then\
cat /var/mail/$USER >> ~/INBOX;\
echo -n > /var/mail/$USER;\
fi<return>\
<enter-command>set wait_key<enter>\
<fetch-mail>" "fetch local and pop3 mail"
This seems to do what I want. It is a hack, and I am not quite sure
whether it is safe (therefore my version within the if-statement looks
like
cp /var/mail/$USER ~/=var=mail=$USER-backup;\
cp ~/INBOX ~/INBOX-backup;\
cat /var/mail/$USER >> ~/INBOX;\
echo -n > /var/mail/$USER;\
echo There has been local e-Mail!;\
sleep 2;\
for the time being to have some backup). However, it's ok for me.
Cheers, Josef.
On Fri, Feb 06, 2009 at 10:30:29AM +0100, Josef Atmin wrote:
>
> Hello mutt users,
>
> I am new to mutt and cannot figure out how to move mail from my local
> spoolfile /var/mail/jatmin (or /var/spool/mail/jatmin) to my mutt
> $spoolfile ~/INBOX when I press 'G' (or automatically).
>
> I need this for the following reason. Since I work in different
> cities, I use different computers in different domains. I synchronize
> my home directories with unison (a great tool btw). I receive external
> email via a pop server and local mail via /var/mail/jatmin. For
> security reasons I want the local mail to stay local and not forward it
> to my pop server. I also cannot forward it to my ~/INBOX file, because
> of the synchronization issue (I would get modified files on different
> machine and would have to merge the different versions of INBOX each
> time I synchronize my home directories). I also want to avoid to set
> the mutt $spoolfile to /var/mail/jatmin because I need all my current
> mail in my home directory, again because of the synchronization issue,
> and I don't want to visit /var/mail/jatmin each time I want to check
> whether I have new local mail.
>
> So I would like to configure mutt such that the 'G' command not only
> fetches mail from the pop server but also from /var/mail/jatmin. Is
> there any way I can do this?
>
> I have found nothing in the documentation. The question came up
> on the mailing list previously, but the solution suggested was to
> set $spoolfile to /var/mail/jatmin and maybe $mbox to ~/INBOX. But this
> is not what I want, because it is quite cumbersome. I also know
> about the 's' commant to save a mail in a different mbox, but that is
> cumbersome as well. I want an elegant solution.
>
> Best regards,
>
> Josef.