Browse Source

Mailing list folders and rules with Mutt

Bob Mottram 11 years ago
parent
commit
c63e36136f
1 changed files with 62 additions and 0 deletions
  1. 62
    0
      beaglebone.txt

+ 62
- 0
beaglebone.txt View File

1111
 service dovecot restart
1111
 service dovecot restart
1112
 #+END_SRC
1112
 #+END_SRC
1113
 
1113
 
1114
+** Create Email folders and rules
1115
+A common situation with email is that you may be subscribed to various mailing lists and want incoming email from those to be automatically grouped into a separate folder for each list.
1116
+
1117
+We can make a script to make adding mailing list rules easy:
1118
+
1119
+#+BEGIN_SRC: bash
1120
+emacs /usr/bin/mailinglistrule
1121
+#+END_SRC
1122
+
1123
+Add the following:
1124
+
1125
+#+BEGIN_SRC: bash
1126
+#!/bin/bash
1127
+MYUSERNAME=$1
1128
+MAILINGLIST=$2
1129
+SUBJECTTAG=$3
1130
+MUTTRC=/home/$MYUSERNAME/.muttrc
1131
+PM=/home/$MYUSERNAME/.procmailrc
1132
+LISTDIR=/home/$MYUSERNAME/Maildir/$MAILINGLIST
1133
+if [ ! -d "$LISTDIR" ]; then
1134
+  mkdir -m 700 $LISTDIR
1135
+  mkdir -m 700 $LISTDIR/tmp
1136
+  mkdir -m 700 $LISTDIR/new
1137
+  mkdir -m 700 $LISTDIR/cur
1138
+fi
1139
+chown -R $MYUSERNAME:$MYUSERNAME $LISTDIR
1140
+echo ":0" >> $PM
1141
+echo "* ^Subject:.*[$SUBJECTTAG].*" >> $PM
1142
+echo "$LISTDIR/cur" >> $PM
1143
+chown $MYUSERNAME:$MYUSERNAME $PM
1144
+if [ ! -f "$MUTTRC" ]; then
1145
+  cp /etc/Muttrc $MUTTRC
1146
+  chown $MYUSERNAME:$MYUSERNAME $MUTTRC
1147
+fi
1148
+#+END_SRC
1149
+
1150
+Save and exit, then make the script executable.
1151
+
1152
+#+BEGIN_SRC: bash
1153
+chmod +x /usr/bin/mailinglistrule
1154
+#+END_SRC
1155
+
1156
+Now we can add a new mailing list rule with the following, where /myusername/ is your username, /mailinglistname/ is the name of the mailing list (with no spaces) and /subjecttag/ is the tag which usually appears within square brackets in the subject line of emails from the list.
1157
+
1158
+#+BEGIN_SRC: bash
1159
+mailinglistrule myusername mailinglistname subjecttag
1160
+#+END_SRC
1161
+
1162
+Repeat this command for as many mailing lists as you need.  Then edit your local Mutt configuration.
1163
+
1164
+#+BEGIN_SRC: bash
1165
+emacs /home/myusername/.muttrc
1166
+#+END_SRC
1167
+
1168
+Search for the *mailboxes* variable and add entries for the mailing lists you just created.  For example:
1169
+
1170
+#+BEGIN_SRC: bash
1171
+mailboxes = =sent =mailinglistname
1172
+#+END_SRC
1173
+
1174
+Then save and exit.
1175
+
1114
 ** Setting up a web site
1176
 ** Setting up a web site
1115
 
1177
 
1116
 #+BEGIN_VERSE
1178
 #+BEGIN_VERSE