nsbin/add-mutt+procmail-autosort
Nico Schottelius a69a70a411 add matching for postfix
Signed-off-by: Nico Schottelius <nico@denkbrett.schottelius.org>
2008-07-24 09:31:08 +02:00

53 lines
1.2 KiB
Bash
Executable file

#!/bin/sh
#
# Nico Schottelius <nico@schottelius.(net|org)>
# Date: 22-Aug-2003
# Last Modified: 2004-08-22
# Add mutt hooks and procmail entries at the same time
# Please 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