nsbin/add-mutt+procmail-autosort
Nico Schottelius b8fba1aabe add some headers to old files
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2010-01-02 13:59:38 +01:00

70 lines
1.9 KiB
Bash
Executable file

#!/bin/sh
#
# 2003-2010 Nico Schottelius (nico-nsbin at schottelius.org)
#
# This file is part of nsbin.
#
# nsbin is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# nsbin is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with nsbin. If not, see <http://www.gnu.org/licenses/>.
#
# Date: 2003-08-22
#
# Add mutt hooks and procmail entries at the same time
# Use a 'DEFAULT' entry in procmailrc to make it work.
#
PROCMAILRC=~/.procmailrc
MUTT_MAILBOXES=~/.mutt/mailboxes
MUTT_HEADERS=~/.mutt/hooks
#PROCMAIL_MATCH='(^TO|^Delivered-To: )' # email after that
PROCMAIL_MATCH='(^TO|^X-Original-To: )' # email after that
echo generating new mutt and new procmailentry
read -p "To Email: " email
read -p "To which folder: " folder
read -p "Your name: " name
read -p "Comment: " comment
echo "Email=$email"
echo "Name=$name"
echo "Comment=$comment"
echo "Folder=$folder"
read -p "Enter to continue" bla
# procmail: insert at first line
cat << EOF >> $PROCMAILRC
### autogenerated by add-mutt+procmail-autosort ($comment)
:0
* $PROCMAIL_MATCH$email
$folder/
EOF
# mutt/checking
cat << EOF >> $MUTT_MAILBOXES
### for $email / $name / $comment
mailboxes +$folder/
EOF
# mutt/headers
cat << EOF >> $MUTT_HEADERS
# $comment
folder-hook $folder 'my_hdr From: $name <$email>'
folder-hook $folder 'set from="$email"'
EOF
# folder; {new,cur,tmp} does not work in ash
mkdir -p ~/Maildir/$folder/new
mkdir -p ~/Maildir/$folder/cur
mkdir -p ~/Maildir/$folder/tmp