mkogg.py: Fix 'self.get_mp4_metadata(self, source)'
[blog.git] / posts / Mutt.mdwn
index 2604086e026517e46cd53d197c93445d59de34db..8750a1e6143f7c3d1d3ee08cc06a16e23a449310 100644 (file)
@@ -15,8 +15,19 @@ and msmpt with
 
   $ apt-get install mutt msmtp
 
-Configure
-=========
+Local account
+=============
+
+Mutt is a very flexible beast, and in the past I've used some of the
+more complicated setups described below.  However, I eventually broke
+down and got a domain name, after which it made more sense to setup a
+local [[Postfix]] server, and have Mutt interact with this local
+server.  I'll keep the IMAP/POP examples below because they might be
+useful for those of you that don't want to run your own mail server
+;).
+
+Single IMAP account
+===================
 
 You configure Mutt with the file `~/.muttrc`.  To set it up with the
 Drexel email system, I looked up the server addresses, and created the
@@ -25,11 +36,11 @@ Drexel email system, I looked up the server addresses, and created the
     # login information
     set imap_user='<your-username>@drexel.edu'
     set imap_pass='<your-password>'
-    set from="<your-username>@drexel.edu"
+    set from='<your-username>@drexel.edu'
     set use_from=yes # required so msmtp knows which account to use to send mails
 
     # setting your realname is optional, but drexel addresses can be cryptic...
-    set realname="<your-realname>"
+    set realname='<your-realname>'
 
     # email server location
     set spoolfile=imaps://<your-username>@imap.mail.drexel.edu:993/INBOX
@@ -45,7 +56,7 @@ Drexel email system, I looked up the server addresses, and created the
     set mail_check=600 # check for new mail every 10 minutes when user is active
     set timeout=600    # check for new mail every 10 min. when user is not active
 
-    set editor="/usr/bin/emacs -nw"   # use emacs for writing emails
+    set editor='/usr/bin/emacs -nw'   # use emacs for writing emails
     set edit_headers                  # allow editing headers while you're in emacs
 
 Since this file contains your password, you should not allow other
@@ -92,15 +103,10 @@ Usage
 
 There's list of basic shortcuts across the top of the Mutt screen.
 Most importantly, `?:Help`, which will give a list of all the current
-shortcuts.
-
-Tutorial
-========
+shortcuts.  An excellent tutorial page is [my first mutt][mfm].
 
-An excellent tutorial page is [my first mutt][mfm].
-
-Multiple accounts
-=================
+Multiple IMAP accounts
+======================
 
 I finally had some time to play around and get Drexel mail and Gmail
 working at the same time.  The basic setup is the same as above, using
@@ -122,8 +128,8 @@ First configure msmtp with:
          user <drexel-username>
          password <drexel-password>
          tls on
-         #tls_trust_file /etc/ssl/certs/ca-certificates.crt
-         tls_trust_file /etc/pki/tls/cert.pem
+         tls_trust_file /etc/ssl/certs/ca-certificates.crt
+         #tls_trust_file /etc/pki/tls/cert.pem
 
     account gmail
          host smtp.gmail.com
@@ -142,13 +148,13 @@ server. `<drexel-username>` is your username (`abc123`),
 `<drexel-from-address>` can be the same as `<drexel-username>`, but
 you can use any address you've set up as an alias.
 `<gmail-from-address>@gmail.com` is your full gmail email address. The
-`tls_trust_file` line depends on your distribution.  For Debian-based
-distributions, use the `ca-certificates.crt` line; and for Red
-Hat-based distributions, use the `cert.pem` line.  I don't know where
-the certificate information is stored for other distributions, but
-googling about should find it.
+`tls_trust_file` line depends on your distribution.  For Gentoo and
+Debian-based distributions, use the `ca-certificates.crt` line; and
+for Red Hat-based distributions, use the `cert.pem` line.  I don't
+know where the certificate information is stored for other
+distributions, but googling about should find it.
 
-Then configure mutt with
+Configure mutt with
 
     # ~/.muttrc
 
@@ -170,8 +176,8 @@ Then configure mutt with
 
     # switch FROM field so msmtp changes sending account
     # http://home.nyc.rr.com/computertaijutsu/mutt.html
-    macro generic "<esc>1" ":set from='<drexel-from-address>@drexel.edu'"
-    macro generic "<esc>2" ":set from='<gmail-username>@gmail.com'"
+    macro generic '<esc>1' ":set from='<drexel-from-address>@drexel.edu'"
+    macro generic '<esc>2' ":set from='<gmail-username>@gmail.com'"
     # no send2-hook in version 1.4.2.2i
     send-hook '~f <drexel-from-address>@drexel.edu' 'set sendmail="/usr/local/bin/msmtp "'
     send-hook '~f <gmail-username>@gmail.com' 'set sendmail="/usr/local/bin/msmtp -a gmail"'
@@ -180,8 +186,8 @@ Then configure mutt with
 
     set use_from=yes # required so msmtp knows which account to use to send mails
 
-This sets up your two mailboxes (drexel and gmail) where you can
-recieve mail.  It also sets up methods for switching between the two
+This sets up your two mailboxes (`drexel` and `gmail`) where you can
+receive mail.  It also sets up methods for switching between the two
 accounts.  To ease in configuring the two accounts, we split most of
 the configuration details into `~/.mutt/common`, `~/.mutt/drexel`, and
 `~/.mutt/gmail`.  Sourcing common brings in some configuration
@@ -199,26 +205,26 @@ behaving much more intuitively.
 
 The specific configuration files are:
 
-The common configuration (these are all optional).
+The common configuration (these are all optional):
 
     #~/.mutt/common
-    set realname="<your-realname>"
+    set realname='<your-realname>'
 
-    set move=no       # stop asking to "move read messages to mbox"
+    set move=no        # stop asking to "move read messages to mbox"
 
     set mail_check=600 # check for new mail every 10 minutes when user is active
-    set timeout=600   # check for new mail every 10 minutes when user is not active
+    set timeout=600    # check for new mail every 10 minutes when user is not active
 
-    set editor="/usr/bin/emacs -nw"    # use emacs as the editor
+    set editor='/usr/bin/emacs -nw'    # use emacs as the editor
     set edit_headers                   # editable headers
 
-The Drexel setup
+The Drexel setup:
 
     #~/.mutt/drexel
     # Drexel information
 
-    # Drexel mail server addresses from
-    #  http://www.drexel.edu/IRT/support/ConfigureEmail.html
+    # Drexel mail server addresses extracted from
+    #  https://askdrexel.drexel.edu/app/answers/detail/a_id/2786
     # email server location
     set spoolfile=imaps://<drexel-username>@imap.mail.drexel.edu:993/INBOX
     set folder=imaps://<drexel-username>@imap.mail.drexel.edu:993/
@@ -231,9 +237,9 @@ The Drexel setup
     # see ~/.msmtp for configuration
     set sendmail=/usr/local/bin/msmtp
 
-    set from="<drexel-from-address>@drexel.edu"
+    set from='<drexel-from-address>@drexel.edu'
 
-And the Gmail setup
+The Gmail setup:
 
     # Gmail information
 
@@ -248,9 +254,9 @@ And the Gmail setup
 
     # use msmtp to send outgoing mail to the mailserver
     # see ~/.msmtp for configuration
-    set sendmail="/usr/local/bin/msmtp -a gmail"
+    set sendmail='/usr/local/bin/msmtp -a gmail'
 
-    set from="<gmail-username>@gmail.com"
+    set from='<gmail-username>@gmail.com'
 
 Firing up `mutt` takes you to your Drexel inbox like you're used to.
 You can change directories like your used to with `c`.  You switch
@@ -258,9 +264,9 @@ accounts with `c TAB TAB`.  The first tab lists all the mailboxes in
 your Drexel account, and the second lists all of your available
 accounts (mailboxes).
 
-Strangely (I haven't figured out why yet), `c TAB` from gmail also
+Strangely (I haven't figured out why yet), `c TAB` from `gmail` also
 lists the *drexel* directories.  No problem though, you can get a list
-of gmail directories with `c +TAB TAB TAB` from gmail (I also don't
+of gmail directories with `c +TAB TAB TAB` from `gmail` (I also don't
 understand what the second `TAB` does).
 
 Anyhow, that should get people started.
@@ -289,12 +295,12 @@ a `.mutt/comcast` file:
 
     # use msmtp to send outgoing mail to the mailserver
     # see ~/.msmtp for configuration
-    set sendmail="/usr/local/bin/msmtp -a gmail"
+    set sendmail='/usr/local/bin/msmtp -a gmail'
 
-    set from="<gmail-username>@gmail.com"
+    set from='<gmail-username>@gmail.com'
 
     set nopop_delete
-    set pop_checkinterval="600"
+    set pop_checkinterval=600
 
 Where the gmail stuff is because I'm sending mail using Gmail when I'm
 looking at my Comcast account.  This avoids using Comcast as much as
@@ -329,12 +335,12 @@ Once you've got a key set up, determine the key ID for your pair with
     pub   1024D/0xFC29BDCDF15F5BE8 2008-08-09 [expires: 2009-08-09]
     …
 
-Where `0xFC29BDCDF15F5BE8` is my long key ID (I don't understand the
-difference between the long and short keys, but I figure the longer
-one must be more specific, and since I only have to enter it once for
-Mutt, I chose the longer key.)
+Where `0xFC29BDCDF15F5BE8` is my long key ID (long IDs are short IDs
+prefixed with additional fingerprint information).  I use the long ID
+here because it is more specific and I only have to enter it once for
+Mutt.
 
-Then, tell Mutt how to use `gpg`, adding
+Tell Mutt how to use `gpg` by adding
 
     source ~/.mutt/pgp
 
@@ -345,23 +351,23 @@ to your `.muttrc` file and creating `~/.mutt/pgp` as follows
     # `Everything You Need To Know To Start Using GnuPG with Mutt'
     # http://codesorcery.net/old/mutt/mutt-gnupg-howto
 
-    set pgp_decode_command="gpg %?p?--passphrase-fd 0? --no-verbose --batch --output - %f"
-    set pgp_verify_command="gpg --no-verbose --batch --output - --verify %s %f"
-    set pgp_decrypt_command="gpg --passphrase-fd 0 --no-verbose --batch --output - %f"
-    set pgp_sign_command="gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --detach-sign --textmode %?a?-u %a? %f"
-    set pgp_clearsign_command="gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --textmode --clearsign %?a?-u %a? %f"
-    set pgp_encrypt_only_command="/usr/lib/mutt/pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust --encrypt-to 0xFC29BDCDF15F5BE8 -- -r %r -- %f"
-    set pgp_encrypt_sign_command="/usr/lib/mutt/pgpewrap gpg --passphrase-fd 0 --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust --encrypt-to 0xFC29BDCDF15F5BE8 -- -r %r -- %f"
-    set pgp_import_command="gpg --no-verbose --import -v %f"
-    set pgp_export_command="gpg --no-verbose --export --armor %r"
-    set pgp_verify_key_command="gpg --no-verbose --batch --fingerprint --check-sigs %r"
-    set pgp_list_pubring_command="gpg --no-verbose --batch --with-colons --list-keys %r"
-    set pgp_list_secring_command="gpg --no-verbose --batch --with-colons --list-secret-keys %r"
+    set pgp_decode_command='gpg %?p?--passphrase-fd 0? --no-verbose --batch --output - %f'
+    set pgp_verify_command='gpg --no-verbose --batch --output - --verify %s %f'
+    set pgp_decrypt_command='gpg --passphrase-fd 0 --no-verbose --batch --output - %f'
+    set pgp_sign_command='gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --detach-sign --textmode %?a?-u %a? %f'
+    set pgp_clearsign_command='gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --textmode --clearsign %?a?-u %a? %f'
+    set pgp_encrypt_only_command='/usr/lib/mutt/pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust --encrypt-to 0xFC29BDCDF15F5BE8 -- -r %r -- %f'
+    set pgp_encrypt_sign_command='/usr/lib/mutt/pgpewrap gpg --passphrase-fd 0 --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust --encrypt-to 0xFC29BDCDF15F5BE8 -- -r %r -- %f'
+    set pgp_import_command='gpg --no-verbose --import -v %f'
+    set pgp_export_command='gpg --no-verbose --export --armor %r'
+    set pgp_verify_key_command='gpg --no-verbose --batch --fingerprint --check-sigs %r'
+    set pgp_list_pubring_command='gpg --no-verbose --batch --with-colons --list-keys %r'
+    set pgp_list_secring_command='gpg --no-verbose --batch --with-colons --list-secret-keys %r'
     set pgp_autosign=yes
     set pgp_sign_as=0xFC29BDCDF15F5BE8
     set pgp_replyencrypt=yes
     set pgp_timeout=1800
-    set pgp_good_sign="^gpg: Good signature from"
+    set pgp_good_sign='^gpg: Good signature from'
 
 The above file autosigns all your sent emails (`set
 pgp_autosign=yes`), but you can obviously turn that off if you would
@@ -372,10 +378,10 @@ new e-mail; thank, you [Chad Perrin][compose-view-p]).
 Browsing email with links
 =========================
 
-Usually mutt is pretty good about handling HTML in emails.  When you
+Usually Mutt is pretty good about handling HTML in emails.  When you
 get emails that are obviously HTML, `v` will take you to the
 attachment list (which should show the email as type `text/html`), and
-enter will open the email in your browser ([[w3m]], right?).
+enter will open the email in your browser (via [[mailcap]]).
 
 Sometimes you get `text/plain` emails with URLs in them, or maybe the
 above procedure just isn't working.  In that case, add
@@ -384,8 +390,8 @@ above procedure just isn't working.  In that case, add
 
 somewhere in your mutt configuration files (thank you, [Bruno
 Postle][links]).  Then pressing `Ctrl-b` will pipe the email you're
-looking at into w3m.  Pressing `:` in w3m will scan the document for
-URL-like strings and make them browsable.
+looking at into [w3m][].  Pressing `:` in w3m will scan the document
+for URL-like strings and make them browsable.
 
 Folder size in status bar
 =========================
@@ -393,7 +399,7 @@ Folder size in status bar
 Add the folder size to the status bar by adding `%l` or `%L` to
 `status_format` in your `~/.muttrc` file.  For example
 
-    set status_format="-%r-Mutt: %f %L"
+    set status_format='-%r-Mutt: %f %L'
 
 
 [Mutt]: http://www.mutt.org/
@@ -403,5 +409,6 @@ Add the folder size to the status bar by adding `%l` or `%L` to
 [GnuPG]: http://www.gnupg.org/
 [compose-view-p]: http://blogs.techrepublic.com.com/security/?p=413
 [links]: http://mutt.blackfish.org.uk/following-links/
+[w3m]: http://w3m.sourceforge.net/
 
 [[!tag tags/tools]]