How can I get mail from /var/mail/jatmin to my spoolfile ~/INBOX ?
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.
Re: How can I get mail from /var/mail/jatmin to my spoolfile
Thanks for the suggestions, but as far as I understand, they are all about how I can automatically forward my local mail to a mail file within my home directory. This is not what I want to do, because that would mean that the 'same' file, namely $HOME/Mail/Inbox, gets changed differently on my different machines and then I am in trouble synchronizing them. The mail must sit in /var/mail/jatmin until I start mutt on that machine and then it should be picked up and transferred to my $HOME/INBOX file. That way I guarantee that the INBOX file is only changed on one machine and then synchronization is easy. Any other suggestions? Cheers, Josef. On Fri, Feb 06, 2009 at 11:19:21AM +0100, Ionel Mugurel Ciobica wrote: > On 6-02-2009, at 11h 06'55", Ionel Mugurel Ciobica wrote about "Re: How can > I get mail from /var/mail/jatmin to my spoolfile ~/INBOX ?" > > > > I have my maibox in file located in $HOME/Mail by simply setting the > > MAIL variable. I use tcsh so this goes in my .login: > > > > setenv MAIL $HOME/Mail/Inbox > > > > for bash you may need to have this in .profile or similar: > > > > MAIL=$HOME/Mail/Inbox > > export $MAIL > > > > Then, in my .procmailrc config file, I also set the default to the > > same file. Here is the head of my $HOME/.procmailrc file: > > > > SHELL=/bin/sh > > PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin > > MAILDIR=$HOME/Mail #make sure it exists > > Mail=$MAILDIR > > DEFAULT=$MAILDIR/Inbox #completely optional > > LOGFILE=$MAILDIR/from #recommended > > EGREP=/bin/egrep > > FORMAIL=/usr/bin/formail > > > >:0 > >* ^From @some string.* > >$DEFAULT > > > > > > The first setting tells mutt (and other applications) were to look for > > new e-mails. The second tell were the mail should be delivered. > > > > > > You could, of course, replace Inbox with Inbox_`hostname` on all > computers to avoind loosing mail. > > Ionel
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 "\ unset wait_key\ \ if [[ -s /var/mail/$USER ]]; then\ cat /var/mail/$USER >> ~/INBOX;\ echo -n > /var/mail/$USER;\ fi\ set wait_key\ " "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.
Re: How can I get mail from /var/mail/jatmin to my spoolfile
On Sun, Feb 08, 2009 at 11:15:31AM +0800, bill lam wrote: > On Sat, 07 Feb 2009, Josef Atmin wrote: > > After having discovered macros I came up with the following solution for > > moving mail from /var/mail/jatmin to ~/INBOX. > > > >macro index,pager G "\ > > unset wait_key\ > > \ > > if [[ -s /var/mail/$USER ]]; then\ > > cat /var/mail/$USER >> ~/INBOX;\ > > echo -n > /var/mail/$USER;\ > > fi\ > > set wait_key\ > > " "fetch local and pop3 mail" > > > > Did you forget to file lock mail/$USER on entry of script? > Thanks for pointing that out. How would I do that? Set permissions to non-writable? Josef.
Re: How can I get mail from /var/mail/jatmin to my spoolfile
Thanks! Here is the improved macro: macro index,pager G "\ unset wait_key\ \ if [[ -s /var/mail/$USER ]]; then\ mutt_dotlock -p /var/mail/$USER;\ cat /var/mail/$USER >> ~/INBOX;\ echo -n > /var/mail/$USER;\ mutt_dotlock -p -u /var/mail/$USER;\ fi\ set wait_key\ " "fetch local and pop3 mail" Josef. On Sun, Feb 08, 2009 at 11:01:03PM +0800, bill lam wrote: > On Sun, 08 Feb 2009, Josef Atmin wrote: > > Thanks for pointing that out. How would I do that? Set permissions to > > non-writable? > > Does any of the followings help? > $ man -k lock | grep "(1)" >