The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.
Difference between revisions of "Package:Mutt"
m (Duncan.britton moved page Mutt to Package:Mutt: Moved Mutt to Package:Mutt) |
|||
(20 intermediate revisions by the same user not shown) | |||
Line 9: | Line 9: | ||
This turns off the default behavior of mutt where hitting space to scroll will automatically move to the next message when the end of the current message is reached. This is very annoying when scrolling in long emails like cron jobs, and the line above sets this behavior to off. | This turns off the default behavior of mutt where hitting space to scroll will automatically move to the next message when the end of the current message is reached. This is very annoying when scrolling in long emails like cron jobs, and the line above sets this behavior to off. | ||
== angry_vincent's .muttrc == | == angry_vincent's .muttrc: == | ||
<pre> | <pre> | ||
Line 89: | Line 90: | ||
# Coloring quoted text - coloring the first 7 levels: | # Coloring quoted text - coloring the first 7 levels: | ||
color quoted cyan black | color quoted cyan black | ||
color quoted1 yellow black</pre> | color quoted1 yellow black | ||
</pre> | |||
== Interesting Color Options == | == Interesting Color Options == | ||
http://github.com/altercation/mutt-colors-solarized | * http://github.com/altercation/mutt-colors-solarized | ||
== golodhrim's mutt config == | == golodhrim's mutt config == | ||
First I split up my muttconfig in several subfiles under <tt>~/.mutt</tt>. The resulting files | First I split up my muttconfig in several subfiles under <tt>~/.mutt</tt>. The resulting files are: | ||
* <code>~/.mutt/account_hooks</code> | |||
* <code>~/.mutt/colors</code> | |||
* <code>~/.mutt/folder_hooks</code> | |||
* <code>~/.mutt/gpg</code> | |||
* <code>~/.mutt/lists</code> | |||
* <code>~/.mutt/macros</code> | |||
* <code>~/.mutt/mutt-alias</code> | |||
* <code>~/.mutt/muttrc</code> | |||
* <code>~/.mutt/sidebar</code> | |||
* <code>~/.secret/.passwd.gpg</code> | |||
=== account_hooks === | |||
Edit <code>~/.mutt/account_hooks</code>: | |||
<pre> | <pre> | ||
#------------------------------------------------------------------------- | #------------------------------------------------------------------------- | ||
# Account Hooks | # Account Hooks | ||
#------------------------------------------------------------------------- | #------------------------------------------------------------------------- | ||
Line 120: | Line 123: | ||
</pre> | </pre> | ||
=== ~/.mutt/colors | === colors === | ||
Edit the file <tt>~/.mutt/colors</tt>: | |||
<pre> | <pre> | ||
#------------------------------------------------------------------------- | #------------------------------------------------------------------------- | ||
Line 140: | Line 145: | ||
</pre> | </pre> | ||
=== | === folder_hooks === | ||
<pre> | <pre> | ||
#-------------------------------------------------------------------------- | #-------------------------------------------------------------------------- | ||
# Folders, mailboxes and folder hooks | # Folders, mailboxes and folder hooks | ||
#-------------------------------------------------------------------------- | #-------------------------------------------------------------------------- | ||
Line 163: | Line 168: | ||
=== ~/.mutt/gpg === | === ~/.mutt/gpg === | ||
<pre> | <pre> | ||
# vim:syn=muttrc | # vim:syn=muttrc | ||
Line 210: | Line 217: | ||
=== ~/.mutt/lists === | === ~/.mutt/lists === | ||
<pre> | <pre> | ||
#------------------------------------------------------------------------- | #------------------------------------------------------------------------- | ||
Line 219: | Line 228: | ||
=== ~/.mutt/macros === | === ~/.mutt/macros === | ||
<pre> | <pre> | ||
# Macros to toggle the sidebar visibility | # Macros to toggle the sidebar visibility | ||
Line 230: | Line 241: | ||
=== ~/.mutt/alias === | === ~/.mutt/alias === | ||
<pre> | <pre> | ||
alias nick Realname <email@host.tld> | alias nick Realname <email@host.tld> | ||
Line 236: | Line 248: | ||
=== ~/.mutt/muttrc === | === ~/.mutt/muttrc === | ||
<pre> | <pre> | ||
# Some minimal Mutt settings, Gentoo-style. These reflect the Gentoo | # Some minimal Mutt settings, Gentoo-style. These reflect the Gentoo | ||
Line 328: | Line 342: | ||
=== ~/.mutt/sidebar === | === ~/.mutt/sidebar === | ||
<pre> | <pre> | ||
#-------------------------------------------------------------------------- | #-------------------------------------------------------------------------- | ||
Line 351: | Line 366: | ||
For this file follow the next steps: | For this file follow the next steps: | ||
* Step 1: | * Step 1: | ||
Create a folder <tt>~/.secret</tt> and inside a file <tt>.passwd</tt> | Create a folder <tt>~/.secret</tt> and inside that directory, create a file called <tt>.passwd</tt>. Enter the following into it: | ||
<pre> | <pre> | ||
user1: passwd1 | user1: passwd1 | ||
user2: passwd2 | user2: passwd2 | ||
</pre> | </pre> | ||
where user1 and user2 are | |||
where "user1" and "user2" are identifiers for the accounts you added in the account_hooks and folder_hooks files, as well as at the start of the muttrc. | |||
* Step 2: | * Step 2: | ||
Now encrypt the file with your gpg-key | Now, encrypt the file with your <tt>gpg-key</tt>. If you don't have one, execute <tt>gpg --gen-key</tt> and create one. After that, don't forget to delete your unencrypted password storage: | ||
<console> | <console> | ||
$ ##bl##gpg -r 0x<Your-ID-fingerprint> -o .passwd.gpg --encrypt .passwd | $ ##bl##gpg -r 0x<Your-ID-fingerprint> -o .passwd.gpg --encrypt .passwd | ||
$ ##bl##rm -f .passwd | $ ##bl##rm -f .passwd | ||
</console> | </console> | ||
=== Mutt postfix setup === | === Mutt postfix setup === | ||
Postfix is another popular and powerful mail transfer agent which | Postfix is another popular and powerful mail transfer agent which is easier to configure than sendmail. Let's start a quick postfix mail transfer setup that will work with mutt. Set the <tt>sasl,berkdb</tt> USE flags to <tt>mail-mta/potsfix</tt> and <tt>mail-client/mutt</tt> in <tt>/etc/portage/package.use/</tt>: | ||
<console> | <console> | ||
# ##i##echo "mail-mta/postfix berkdb sasl" >> /etc/portage/package.use/mail | # ##i##echo "mail-mta/postfix berkdb sasl" >> /etc/portage/package.use/mail | ||
Line 371: | Line 390: | ||
</console> | </console> | ||
Edit <tt>/etc/postfix/main.cf</tt> and add the following lines: | Edit <tt>/etc/postfix/main.cf</tt> and add the following lines: | ||
<pre> | <pre> | ||
relayhost = smtp.gmail.com:587 | relayhost = smtp.gmail.com:587 | ||
Line 378: | Line 399: | ||
smtp_sasl_security_options = noanonymous | smtp_sasl_security_options = noanonymous | ||
</pre> | </pre> | ||
Create and edit | |||
Create and edit the aforementioned authorization file: <tt>gmail_passwd</tt>: | |||
<console> | <console> | ||
# ##i##touch /etc/postfix/gmail_passwd | # ##i##touch /etc/postfix/gmail_passwd | ||
# ##i##echo "smtp.gmail.com:587 my.name@gmail.com:password" >> /etc/postfix/gmail_passwd | # ##i##echo "smtp.gmail.com:587 my.name@gmail.com:password" >> /etc/postfix/gmail_passwd | ||
</console> | </console> | ||
Where <my.name> is gmail account and passwd is account password. | Where <my.name> is a gmail account and passwd is the account password. | ||
Convert <tt>gmail_passwd</tt> into Berkeley DB format, secure the file and | Convert <tt>gmail_passwd</tt> into Berkeley DB format, secure the file, and restart the postfix daemon: | ||
<console> | <console> | ||
# ##i##postmap /etc/postfix/gmail_passwd | # ##i##postmap /etc/postfix/gmail_passwd | ||
Line 393: | Line 415: | ||
[[Category:HOWTO]] | [[Category:HOWTO]] | ||
[[Category: | [[Category:First Steps]] |
Revision as of 13:15, June 25, 2014
Mutt is a popular mail reader for Linux systems. This page is being created as a good place for people to place their mutt configurations to share with others. These configuration settings go in the user's ~/.muttrc file.
Essential Mutt
set pager_stop
This turns off the default behavior of mutt where hitting space to scroll will automatically move to the next message when the end of the current message is reached. This is very annoying when scrolling in long emails like cron jobs, and the line above sets this behavior to off.
angry_vincent's .muttrc:
# General config # --------------- set folder=~/Mail # mail folder set alias_file=~/.mail_aliases # alises file set arrow_cursor # cursor is '->' set attribution="%d, %n wrote:" # beginning of mail answer set copy=yes # save mail copies set edit_headers # edit mail header set editor="vim" # editor set folder_format="%t%N %-30.30f %8s" # folder list look set index_format="%4C %Z %{%b %d} %-31.31F %N (%4c) %s" # mail list look set mailcap_path="~/.mailcap" # path to .mailcap set menu_scroll # scroll list by one line set mail_check=5 # mail check interval set pager_stop # at the end of mail do not move to next message set postponed=+drafts # postponed mails set print=ask-yes # ask before print set print_command=lpr # print command set record=+sent # where to save sent mails set signature="~/.signature" # signature file set visual=vim # editor caled by ~v # mail sort set sort=threads set sort_aux=reverse-date-received set sort_browser=reverse-date ignore * # ignore headers so the mail body is not overloaded unignore from: subject to cc mail-followup-to \ date x-mailer x-url user-agent reply-to # fieids i like to see in mail body # Colors color index brightcyan black ~N color index brightyellow black ~F color index black green ~T color index brightred black ~D mono index bold ~N mono index bold ~F mono index bold ~T mono index bold ~D # Highlights inside the body of a message. # URLs color body brightgreen black "(http|ftp|news|telnet|finger)://[^ \"\t\r\n]*" color body brightgreen black "mailto:[-a-z_0-9.]+@[-a-z_0-9.]+" mono body bold "(http|ftp|news|telnet|finger)://[^ \"\t\r\n]*" mono body bold "mailto:[-a-z_0-9.]+@[-a-z_0-9.]+" # email addresses color body brightgreen black "[-a-z_0-9.%$]+@[-a-z_0-9.]+\\.[-a-z][-a-z]+" mono body bold "[-a-z_0-9.%$]+@[-a-z_0-9.]+\\.[-a-z][-a-z]+" # header color header green black "^from:" color header green black "^to:" color header green black "^cc:" color header green black "^date:" color header yellow black "^newsgroups:" color header yellow black "^reply-to:" color header brightcyan black "^subject:" color header red black "^x-spam-rule:" color header green black "^x-mailer:" color header yellow black "^message-id:" color header yellow black "^Organization:" color header yellow black "^Organisation:" color header yellow black "^User-Agent:" color header yellow black "^message-id: .*pine" color header yellow black "^X-Fnord:" color header yellow black "^X-WebTV-Stationery:" color header yellow black "^X-Message-Flag:" color header yellow black "^X-Spam-Status:" color header yellow black "^X-SpamProbe:" color header red black "^X-SpamProbe: SPAM" # Coloring quoted text - coloring the first 7 levels: color quoted cyan black color quoted1 yellow black
Interesting Color Options
golodhrim's mutt config
First I split up my muttconfig in several subfiles under ~/.mutt. The resulting files are:
~/.mutt/account_hooks
~/.mutt/colors
~/.mutt/folder_hooks
~/.mutt/gpg
~/.mutt/lists
~/.mutt/macros
~/.mutt/mutt-alias
~/.mutt/muttrc
~/.mutt/sidebar
~/.secret/.passwd.gpg
account_hooks
Edit ~/.mutt/account_hooks
:
#------------------------------------------------------------------------- # Account Hooks #------------------------------------------------------------------------- account-hook . 'unset imap_user imap_pass' account-hook 'imap://user@imaphost/' "set imap_user=user imap_pass=$my_pass1 "
colors
Edit the file ~/.mutt/colors:
#------------------------------------------------------------------------- # Set colors #------------------------------------------------------------------------- color attachment brightmagenta default color error brightred default color hdrdefault red default color indicator brightyellow red color markers brightcyan default color message brightcyan default color normal default default color quoted brightblue default color search default green color signature red default color status yellow blue color tilde magenta default color tree magenta default
folder_hooks
#-------------------------------------------------------------------------- # Folders, mailboxes and folder hooks #-------------------------------------------------------------------------- # Setup for imap-user in account_hooks set folder="imap://user@imaphost/" mailboxes =INBOX =INBOX/Archives =INBOX/Drafts =INBOX/Sent =INBOX/Trash folder-hook 'imap://user@imaphost/' " \ set folder=imap://user@imaphost/ \ postponed=+INBOX/Drafts \ record=+INBOX/Sent \ smtp_url=smtp://user@smtphost \ smtp_pass=$my_pass1 \ #signature=~/.sig/pr.txt \ from='Name Familyname <name@host> ' \ realname='Realname' \ pgp_sign_as='PGP-signature' \ spoolfile='imap://user@imaphost/' "
~/.mutt/gpg
# vim:syn=muttrc ## set smime_decrypt_use_default_key=yes # Decode application/pgp attachments like so: set pgp_decode_command="/usr/bin/gpg %?p?--passphrase-fd 0? --no-verbose --batch --output - %f" # And use this to verify pgp signatures: set pgp_verify_command="/usr/bin/gpg --no-verbose --batch --output - --verify %s %f" # How to decrypt pgp encrypted messages: set pgp_decrypt_command="/usr/bin/gpg --passphrase-fd 0 --no-verbose --batch --output - %f" # How to pgp sign a message: set pgp_sign_command="/usr/bin/gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --detach-sign --textmode %?a?-u %a? %f" # How to pgp clearsign a message: set pgp_clearsign_command="/usr/bin/gpg --no-verbose --batch --output - --passphrase-fd 0 --armor --textmode --clearsign %?a?-u %a? %f" # Import a pgp key from a message into my public keyring as follows: set pgp_import_command="/usr/bin/gpg --no-verbose --import -v %f" # Use this to export a key from my public keyring: set pgp_export_command="/usr/bin/gpg --no-verbose --export --armor %r" # Verify key information (from the key selection menu): set pgp_verify_key_command="/usr/bin/gpg --verbose --batch --fingerprint --check-sigs %r" # List my public keyring like so: set pgp_list_pubring_command="/usr/bin/gpg --no-verbose --batch --with-colons --list-keys %r" # List my private keyring like so: set pgp_list_secring_command="/usr/bin/gpg --no-verbose --batch --with-colons --list-secret-keys %r" # Automatically sign outgoing messages set pgp_autosign=yes # Timeout (in seconds) for cached passphrases: set pgp_timeout=1800 # Text to show before a good signature: set pgp_good_sign="^gpg: Good signature from"
~/.mutt/lists
#------------------------------------------------------------------------- # Mailinglist Subscriptions #------------------------------------------------------------------------- # Syntax: # subscribe mailinglist@domain.com
~/.mutt/macros
# Macros to toggle the sidebar visibility macro index b '<enter-command>toggle sidebar_visible<enter><refresh>' macro pager b '<enter-command>toggle sidebar_visible<enter><redraw-screen>' # abook query macro index,pager A "<pipe-message>abook --add-email-quiet<return>" "add the sender address to abook" macro generic,index,pager \Cb "abook" "launch abook"
~/.mutt/alias
alias nick Realname <email@host.tld>
~/.mutt/muttrc
# Some minimal Mutt settings, Gentoo-style. These reflect the Gentoo # predilection for maildir folders. # # Please don't add settings to this file to change other user # preferences (such as colors), since those can be hard for a user to # undo if their preference doesn't match yours! For example, it is # *impossible* currently in mutt to remove color settings from objects # other than the index. #------------------------------------------------------------------------- # Process the password file first #------------------------------------------------------------------------- set my_tmp=`gpg -o ~/.secret/.tmp -d ~/.secret/.passwd.gpg` set my_pass1=`awk '/user:/ {print $2}' ~/.secret/.tmp` set my_del=`rm -f ~/.secret/.tmp` #------------------------------------------------------------------------- # Further customisations #------------------------------------------------------------------------- set smart_wrap = yes set sort = 'threads' set sort_aux = 'last-date-received' set imap_check_subscribed ignore "Authentication-Results:" ignore "DoaminKey-Signature:" ignore "DKIM-Signature:" hdr_order Date From To Cc #------------------------------------------------------------------------- # Configuration variables #------------------------------------------------------------------------- set abort_nosubject=yes set abort_unmodified=yes set query_command="abook --mutt-query '%s'" set alias_file="~/.mutt/mutt-alias" set alias_format="%4n %t %a %r" source $alias_file set assumed_charset="utf-8" set attach_charset="utf-8" set charset="utf-8" set date_format="" set edit_headers=yes set editor='vim + -c "set textwidth=72" -c "set wrap" -c "set nocp" -c "?^$" ' set folder="~/.offlineimap" set forward_quote=yes set header_cache=~/.mutt/cache/headers set message_cachedir=~/.mutt/cache/bodies set certificate_file=~/.mutt/certificates set help=yes set imap_idle=yes set imap_peek=yes set imap_servernoise=no set include=yes set mail_check=60 set mbox_type=Maildir set menu_move_off=no set menu_scroll=no set mime_forward=ask-no set pager_context=2 set pager_stop=yes set postponed="~/.mutt/mail/postponed" set realname="Martin 'golodhrim' Scholz" set record="~/.mutt/mail/sent" set reply_regexp="^(re([\[0-9\]+])*|betr):[ \t]*" #set reply_to=yes set tilde=yes #-------------------------------------------------------------------------- # muttprint for printing #-------------------------------------------------------------------------- set print_command="muttprint" #-------------------------------------------------------------------------- # Automatically process html mails #-------------------------------------------------------------------------- auto_view text/html #-------------------------------------------------------------------------- # Other configuration files #-------------------------------------------------------------------------- source ~/.mutt/account_hooks source ~/.mutt/folder_hooks source ~/.mutt/colors source ~/.mutt/sidebar source ~/.mutt/gpg source ~/.mutt/macros source ~/.mutt/lists
~/.mutt/sidebar
#-------------------------------------------------------------------------- # Sidebar configuration #-------------------------------------------------------------------------- set sidebar_width=30 set sidebar_visible=yes set sidebar_delim='|' color sidebar_new yellow default #-------------------------------------------------------------------------- # Sidebar keys #-------------------------------------------------------------------------- bind index \CP sidebar-prev bind index \CN sidebar-next bind index \CO sidebar-open bind pager \CP sidebar-prev bind pager \CN sidebar-next bind pager \CO sidebar-open
~/.secret/.passwd.gpg
For this file follow the next steps:
- Step 1:
Create a folder ~/.secret and inside that directory, create a file called .passwd. Enter the following into it:
user1: passwd1 user2: passwd2
where "user1" and "user2" are identifiers for the accounts you added in the account_hooks and folder_hooks files, as well as at the start of the muttrc.
- Step 2:
Now, encrypt the file with your gpg-key. If you don't have one, execute gpg --gen-key and create one. After that, don't forget to delete your unencrypted password storage:
user $ gpg -r 0x<Your-ID-fingerprint> -o .passwd.gpg --encrypt .passwd user $ rm -f .passwd
Mutt postfix setup
Postfix is another popular and powerful mail transfer agent which is easier to configure than sendmail. Let's start a quick postfix mail transfer setup that will work with mutt. Set the sasl,berkdb USE flags to mail-mta/potsfix and mail-client/mutt in /etc/portage/package.use/:
root # echo "mail-mta/postfix berkdb sasl" >> /etc/portage/package.use/mail root # echo "mail-client/mutt berkdb sasl" >> /etc/portage/package.use/mail root # emerge -uN1 mutt postfix
Edit /etc/postfix/main.cf and add the following lines:
relayhost = smtp.gmail.com:587 smtp_use_tls = yes smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/gmail_passwd smtp_sasl_security_options = noanonymous
Create and edit the aforementioned authorization file: gmail_passwd:
root # touch /etc/postfix/gmail_passwd root # echo "smtp.gmail.com:587 my.name@gmail.com:password" >> /etc/postfix/gmail_passwd
Where <my.name> is a gmail account and passwd is the account password. Convert gmail_passwd into Berkeley DB format, secure the file, and restart the postfix daemon:
root # postmap /etc/postfix/gmail_passwd root # chown root:postfix /etc/postfix/gmail_passwd* root # chmod 0640 /etc/postfix/gmail_passwd* root # /etc/init.d/postfix restart