Objectmix
Tags Register Mark Forums Read

Re: Adding a custom header to existing mail : Mutt

This is a discussion on Re: Adding a custom header to existing mail within the Mutt forums in Other Technologies category; Thanks for the help everyone. I ended up using a combination of the edit command (mentioned by Lech) and the shell script (mentioned by Alan). Remember, this was my question: > In mutt, how do I add a header to an existing e-mail? > I would like to do this to categorize my mail. So, while browsing > mail in mutt, I'd like to hit a key to add a custom header to a > particular e-mail to indicate that it's, for example, related to > project foo. Then I can later filter on this header to see only mail ...


Object Mix > Other Technologies > Mutt > Re: Adding a custom header to existing mail

Mutt Mutt Mail

Reply

 

LinkBack Thread Tools
  #1  
Old 04-01-2004, 01:08 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: Adding a custom header to existing mail

Thanks for the help everyone. I ended up using a combination of the
edit command (mentioned by Lech) and the shell script (mentioned by
Alan).

Remember, this was my question:

> In mutt, how do I add a header to an existing e-mail?
> I would like to do this to categorize my mail. So, while browsing
> mail in mutt, I'd like to hit a key to add a custom header to a
> particular e-mail to indicate that it's, for example, related to
> project foo. Then I can later filter on this header to see only mail
> related to project foo.


Here's what I did. I added the following line (broken up here for
clarity) to muttrc:

macro index <f2> "
<enter-command>set editor='~/.mutt/markproj.sh foo'<enter>
<edit>
<enter-command>set editor='vi'<enter>"

What this line does is, when F2 is hit, it sets the mutt editor to
"markproj.sh foo", where markproj.sh is a script that adds a header to
the e-mail (see below) and foo is the project I want to mark this
e-mail as. Then it edits the file, which causes mutt to call the
script with the project name (foo) as the first parameter and the file
containing the e-mail as the second parameter.

A stripped down version of markproj.sh looks like this:

proj=$1
file=$2
formail -A "X-Project: $proj" < $file > $file.tmp
mv $file.tmp $file
sleep 1
touch $file

This uses formail to add the X-Project line to the e-mail. The last
two lines are needed to ensure that mutt sees a change in the write
timestamp of the file and realizes that the file has changed.

I still have a question about mutt:

- How do I remember/restore the old value of a variable? (It would be
nice if I could store the value of the editor variable somewhere,
change it, and reset it back to the original value.) Mutt doesn't seem
to support custom variables. Is there any plan of adding custom
variables?
  #2  
Old 04-01-2004, 04:09 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: Adding a custom header to existing mail

On 31 Mar 2004 22:08:51 -0800, Jake <jakelundy@hotmail.com> wrote:
>
>
> Thanks for the help everyone. I ended up using a combination of the
> edit command (mentioned by Lech) and the shell script (mentioned by
> Alan).
>


<snip>

> I still have a question about mutt:
>
> - How do I remember/restore the old value of a variable? (It would be
> nice if I could store the value of the editor variable somewhere,
> change it, and reset it back to the original value.) Mutt doesn't seem
> to support custom variables. Is there any plan of adding custom
> variables?


Good of you to post this for the Archives...

As for storing the variable, you probably need to do that in a file called
~/.muttvar or something. Just add a line to the script like:

echo $var > ~/.muttvar

and it will overwrite the previous value.

AC

  #3  
Old 04-03-2004, 12:39 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: Adding a custom header to existing mail

Alan Connor <zzzzzz@xxx.yyy> wrote in message news:<Z_Qac.10733$lt2.7037@newsread1.news.pas.earthlink.net>...

> > - How do I remember/restore the old value of a variable? (It would be
> > nice if I could store the value of the editor variable somewhere,
> > change it, and reset it back to the original value.) Mutt doesn't seem
> > to support custom variables. Is there any plan of adding custom
> > variables?

>
> As for storing the variable, you probably need to do that in a file called
> ~/.muttvar or something. Just add a line to the script like:
>
> echo $var > ~/.muttvar
>
> and it will overwrite the previous value.


From what I understand, "$var" above is a shell environment variable.
I want "$var" to be a mutt variable. So I'd like to call a script
*from mutt*, and pass mutt variable values to the script. Is this
possible?
  #4  
Old 04-03-2004, 03:52 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: Adding a custom header to existing mail

On 2 Apr 2004 21:39:08 -0800, Jake <jakelundy@hotmail.com> wrote:
>
>
> Alan Connor <zzzzzz@xxx.yyy> wrote in message news:<Z_Qac.10733$lt2.7037@newsread1.news.pas.earthlink.net>...
>
>> > - How do I remember/restore the old value of a variable? (It would be
>> > nice if I could store the value of the editor variable somewhere,
>> > change it, and reset it back to the original value.) Mutt doesn't seem
>> > to support custom variables. Is there any plan of adding custom
>> > variables?

>>
>> As for storing the variable, you probably need to do that in a file called
>> ~/.muttvar or something. Just add a line to the script like:
>>
>> echo $var > ~/.muttvar
>>
>> and it will overwrite the previous value.

>
> From what I understand, "$var" above is a shell environment variable.


Not an environment variable, just a shell variable.

Environment variables are things like $EDITOR and $PATH and $DISPLAY...


> I want "$var" to be a mutt variable. So I'd like to call a script
> *from mutt*, and pass mutt variable values to the script. Is this
> possible?


Don't know, Jake, but someone around here will, I would think.

A lot of Mutt's variables are fixed, so those can just be copied.

As for calling a script from Mutt, you can use the "!" command to
do that, invoking it from a keyboard macro to save a keystroke
or two.

These call fetchmail from Mutt with a capital F.

macro index F "!fetchmail^M"
macro pager F "!fetchmail^M"

Wish I could be of more help.

AC

Reply

Thread Tools


Similar Threads

Thread Thread Starter Forum Replies Last Post
Adding a custom header to the response usenet DOTNET 1 10-31-2007 10:53 AM
Adding new methods to existing classes usenet Javascript 18 08-28-2007 02:11 PM
Adding an existing IRA account usenet Microsoft Money 1 06-24-2007 05:11 PM
Adding a custom header to all outgoing messages usenet Pegasus 2 05-27-2006 06:00 PM
Importing existing mail from Outlook2002 or Eudora 6 to Pegasus-mail? usenet Pegasus 7 09-27-2003 10:19 AM


All times are GMT -5. The time now is 08:25 AM.

Managed by Infnx Pvt Ltd.