User Tools

Site Tools


mutt_configuration_and_basic_use

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
mutt_configuration_and_basic_use [2017/07/26 23:55]
D.J.J. Ring Jr. [Configuration]
mutt_configuration_and_basic_use [2019/09/23 10:15] (current)
D.J.J. Ring Jr. Important Step Enable IMAP on Gmail Web Page Settings.
Line 10: Line 10:
 Urlview is recommended to pass links to a browser of your choice, and a well configured command line text editor that you like will be used to write mail. Urlview is recommended to pass links to a browser of your choice, and a well configured command line text editor that you like will be used to write mail.
  
 +==== Activating IMAP in Gmail ====
  
-==== Configuration ==== +To access Gmail account in your email program or mobile device via the IMAP protocolactivate IMAP in Gmail.
-Mutt  is in most if not all Linux repose, and versions are available for most other Unix derivatives, and is installed on high percentage of Linux boxes that you will run across.  +
-This guide is specifically designed to configure Mutt to work directly with GMail,/imap in a convenient and secure manner, but with minor edits it will work with other popular services such as Yahoo. +
-You will be bl to store your gmail password in an encrypted form as well as digitally sign and encrypt your email. Incoming encrypted messages are decrypted automaticallyoutgoing mail is digitally signed in clear text, and if you reply to an encrypted message your reply is encrypted by default. +
-  +
-Two well tested example muttrc files are provided+
  
-----+    Open Gmail in a web browser.
  
 +    Choose Settings (the gear icon).
  
-[[muttrc|example mutt configuration file]]+    Select Settings. 
 +     
 +    Settings menu item in Gear icon for Gmail
  
-[[muttrc.ext|an example mutt configuration file with extra functionality]]+    Select the Forwarding and POP/IMAP tab.
  
-----+    In the IMAP access section, select Enable IMAP. 
 +    Enable IMAP radio button in Gmail settings
  
 +    Leave the other settings on the default selections.
 +
 +    Select Save Changes.
 +
 +
 +
 +==== Configuration ====
 +Mutt  is in most if not all Linux repose, and versions are available for most other Unix derivatives, and is installed on a high percentage of Linux boxes that you will run across. 
 +This guide is specifically designed to configure Mutt to work directly with GMail imap in a convenient and secure manner, but with minor edits it will work with other popular services such as Yahoo.
 +You will be able to store your gmail password in an encrypted form as well as digitally sign and encrypt your email. Incoming encrypted messages are decrypted automatically, outgoing mail is digitally signed in clear text, and if you reply to an encrypted message your reply is encrypted by default.
 + Two well tested example muttrc files are provided. 
 +[[muttrc|example mutt configuration file]]
 +[[muttrc.ext|an example mutt configuration file with extra functionality]]
  
  Please pay attention to the comments and wording of actual settings in the sample muttrc files as they will help you understand behavior and configuration options.  Please pay attention to the comments and wording of actual settings in the sample muttrc files as they will help you understand behavior and configuration options.
-* Important: don't forget to name which ever file you use muttrc, muttrc.ext will not be recognized&used by mutt. +* Important: don't forget to name which ever file you use muttrc, muttrc.ext will not be recognized&used by mutt. Hidden file .muttrc will also be recognized. 
 + 
 +Before final installation you will see a list of possible configurations. Fortunately we don't even have to understand these as for our set-up we can keep the default which is called do not configure, do nothing or something to this effect. You can reconfigure later if you want to set up your own mail server, MDA, or in some way significantly change your email provider.  
 + 
 +The [[muttrc|muttrc]] file can either be put in to your home directory as a hidden file, ~/.muttrc 
 +or if like me you quickly accumulate too many loose files and don't like the clutter put it in your .mutt folder, i.e. ~/.mutt/muttrc where you will put your encrypted password file. I use ~/.mutt/.pass for this which is turned in to ~/.mutt/.pass.gpg when encrypted. 
 + 
 +**STEPS FOR INSTALLATION.** 
 + 
 +**Step 1** Install mutt.
  
 If you do not already have Mutt get it as you would any standard package, e.g.  If you do not already have Mutt get it as you would any standard package, e.g. 
Line 35: Line 57:
 sudo apt-get install mutt sudo apt-get install mutt
 </code> </code>
-Before final installation you will see a list of possible configurations. Fortunately we don't even have to understand these as for our set-up we can keep the default which is called do not configure, do nothing or something to this effect. You can reconfigure later if you want to set up your own mail server, MDA, or in some way significantly change your email provider.  
  
-The [[muttrc|muttrc]] file can either be put in to your home directory as a hidden file, ~/.muttrc +**Step 2** Encrypting Your Gmail Password.
-or if like me you quickly accumulate too many loose files and don't like the clutter put it in your .mutt folder, i.e. ~/.mutt/muttrc +
-where you will put your encrypted password file. I use ~/.mutt/.pass for this which is turned in to ~/.mutt/.pass.gpg when encrypted.+
  
-Encrypting your PW.  +** Step 2.1 ** 
-Make a text file named ~/.mutt.pass and put in  +Make a folder called ~/.mutt in your home directory, we will put the mutt configuration files thereWe will now create ~/.mutt if it doesn't exist and change directory into that folder.
-GMail: "your gmail PW" +
-with out the quotes around your password and note the tab after the GMail:. +
-Save it, encrypt it  and give the encrypted file 700 permissions, and then delete the unencrypted original+
  
-gpg -e ~/.mutt/.pass +<code> 
-  chmod 700 ~/.mutt.pass.gpg +cd 
-  rm ~/.mutt/.pass+mkdir ~/.mutt 
 +cd ~/.mutt 
 +</code> 
 + 
 +** Step 2.2 ** 
 +We will make a text file named ~/.mutt/mutt.pass by editing it with our editor (such as nano) and put in this file, exactly this  Gmail: followed by no spaces, but by the TAB key then by your Gmail password. 
 +GMail: yourgmailpassword for this text file we do not use quotation marks inside the file as we will do in the muttrc file later, note that after "GMail: we insert the TAB character.  The steps to follow to do this are below. The TAB key is put into the code below, so you can copy that and paste it into the mutt.pass file. 
 + 
 +<code> 
 +nano ~/.mutt/mutt.pass 
 +</code> 
 + 
 +Put in this file: 
 +<code>GMail: yourgmailpassword</code> **REMEMBERING that after GMail there is only one TAB key and no spaces at all.** 
 + 
 +Save this file, and exit your editor. 
 + 
 +** Step 2.3 ** 
 +Now  encrypt it by using gpg which will create a new encrypted file named ~/.mutt/mutt.pass.gpg and we use chmod to give this encrypted file 700 permissions, and then delete the unencrypted original file which we created above (~/.mutt/mutt.pass) 
 + 
 +<code> 
 +gpg -e ~/.mutt/mutt.pass 
 +chmod 700 ~/.mutt/mutt.pass.gpg 
 +rm ~/.mutt/mutt.pass 
 +</code>
  
 *(the encrypt command may require more structure for some users) *(the encrypt command may require more structure for some users)
  
-I will leave lines in the sample muttrc file that will allow a user to use their GMail password in plain text, not encrypted, but I do not recommend this unless for some reason you are having trouble with gpg, or just need to get mutt up&running really fast until you have time to finish configuration. +** Step 2.4 ** 
-If you are not interested in encrypting, decrypting or digitally signing any mail you can comment out all the lines in the encryption section. Mutt recognizes the typical "#" numbersign if you prefer, as the comment sign and everything following it on a line is not used by the program.+ 
 +We need to make a subfolder in ~/.mutt called .tmp. 
 + 
 +<code> 
 + 
 +mkdir ~/.mutt/.tmp 
 + 
 +</code> 
 + 
 +** Step 2.5 ** 
 + 
 +Install urlview. 
 + 
 +Most people use urlview which is in standard repos to open links in their email when using mutt.  
 + 
 +<code> 
 +sudo apt-get install urlview 
 +</code> 
 + 
 +** Step 2.5 ** 
 + 
 +Put a mailcap file in your ~/.mutt folder. 
 + 
 +Here is a simple mailcap file, save as mailcap and put in ~/.mutt folder. 
 +**MAILCAP FILE (goes in your ~/.mutt folder)** [[mailcap|a good sample mailcap file]] 
 + 
 +It should  just work in Vinux4. 
 +^b (Control-b) opens up a numbered list of urls. Links are often numbered when reading messages, but the numbering is often not quite in sync with the list in urlview, so, you may need to experiment a bit to see whether this is the case or not in a given message and then  either count or keep track of numbers as in urlview the raw url is shown and that may not have anything to clue you in to what's behind the link. 
 + 
 +I will leave lines in the sample muttrc file that will allow a user to use their GMail password in plain text, not encrypted, but I do not recommend this unless for some reason you are having trouble with gpg, or just need to get mutt up & running really fast until you have time to finish configuration. 
 + 
 +If you are not interested in encrypting, decrypting or digitally signing any mail you can comment out all the lines in the encryption section. Mutt recognizes the typical "#" numbersign as the comment sign and everything following it on a line is not used by the program. 
 There are enough English words to explain more or less what most of the encryption lines do, so you can selectively comment out automatic signing or replying to encrypted mail in kind while leaving pgp functionality available via the pgp menu accessed with p when in the send mail menu where you can edit to and from fields, attach files or change subject lines. There are enough English words to explain more or less what most of the encryption lines do, so you can selectively comment out automatic signing or replying to encrypted mail in kind while leaving pgp functionality available via the pgp menu accessed with p when in the send mail menu where you can edit to and from fields, attach files or change subject lines.
 +
 Conversely you'll need to uncomment a couple lines to use plaintext PW.  Conversely you'll need to uncomment a couple lines to use plaintext PW. 
  
-Notice that I have nano set as my editor, just change this to what ever you like. +Notice that I have nano set as my editor, just change this to whatever you like.  
 * Tip: For best results with speech I have soft wrap turned on in my /etc/nanorc file.  * Tip: For best results with speech I have soft wrap turned on in my /etc/nanorc file. 
  
 * Tip: You must have the 0X prepended to your key_ID in lines that deal with encryption commands,   * Tip: You must have the 0X prepended to your key_ID in lines that deal with encryption commands,  
-in the signing line note that the ID is used alone. There are some keyboard shortcuts to change to standard gmail folders. I seldom use them, because I have a slightly more complex set of folders and labels, but they can be quite  +in the signing line note that the ID is used alone.  
-handy. If you create new mail folders they will be synced by gmail. Just type shift c "C" and either press enter if you like the location mutt offers, (it may need to be created and mutt will ask if you wish to do so), press the "?" questionmark for a list of existing folders in a tree if appropriate, tab once for an expanded list view, or type the name of an existing mailbox or one you + 
 +There are some keyboard shortcuts to change to standard gmail folders. I seldom use them, because I have a slightly more complex set of folders and labels, but they can be quite handy.  
 + 
 +If you create new mail folders they will be synced by gmail. Just type shift c "C" and either press enter if you like the location mutt offers, (it may need to be created and mutt will ask if you wish to do so), press the "?" questionmark for a list of existing folders in a tree if appropriate, tab once for an expanded list view, or type the name of an existing mailbox or one you 
 want to make. want to make.
  
Line 70: Line 147:
  
 Aside from the basic data necessary to inter-operate with GnuPG and automatically decrypt encrypted mail, the encryption section of the sample muttrc  also tells Mutt to automatically digitally sign all outgoing Aside from the basic data necessary to inter-operate with GnuPG and automatically decrypt encrypted mail, the encryption section of the sample muttrc  also tells Mutt to automatically digitally sign all outgoing
-messages in clear-text, to encrypt all encrypted mail +messages in clear-text, to encrypt all encrypted mail to me as well (for storage in my 'sent' folder, and to cache my passphrase for five  hours. 
-to me as well (for storage in my 'sent' folder, and to cache my +
-passphrase for five  hours.+
  
-most people use urlview which is in standard repos to open links in their email when using mutt.  
-<code> 
-sudo apt-get install urlview 
-</code> 
-It should  just work in Vinux4. 
-^b opens up a numbered list of urls. Links are often numbered when reading messages, but the numbering is often not quite in sync with the list in urlview, so, you may need to experiment a bit to see whether this is the case or not in a given message and then  either count or keep track of numbers as in urlview the raw url is shown and that may not have anything to clue you in to what's behind the link. 
  
 Mutt lets you create a few types of macros and special commands, enter special characters, and can be configured to work with a wide range of programs to do just about anything you want to do with your mail. Mutt lets you create a few types of macros and special commands, enter special characters, and can be configured to work with a wide range of programs to do just about anything you want to do with your mail.
 You can do a very wide range of customization with your muttrc file, but  You can do a very wide range of customization with your muttrc file, but 
 most mutt defaults are good for me. most mutt defaults are good for me.
 +
 I do add some interesting extras in the muttrc.ext file. It uses a newer much easier to understand encryption system/syntax compared with the method used other sample muttrc here, and in most mutt encryption how-tos. I do add some interesting extras in the muttrc.ext file. It uses a newer much easier to understand encryption system/syntax compared with the method used other sample muttrc here, and in most mutt encryption how-tos.
 +
 Also the muttrc.ext file should work on most other distros with no modification.  Also the muttrc.ext file should work on most other distros with no modification. 
 The older muttrc file may require minor changes to work on distros other than Vinux and Ubuntu spins. The older muttrc file may require minor changes to work on distros other than Vinux and Ubuntu spins.
Line 92: Line 164:
 ==== Basic Usage ==== ==== Basic Usage ====
 The mutt manual is quite extensive. It is mostly quite clear, but some sections may require more study. The mutt manual is quite extensive. It is mostly quite clear, but some sections may require more study.
-In my sample [[muttrc|muttrc]] file I configure f1 to open it in the lynx browser for easy navigation. If you don't have or don't like lynx change to a text-based browser you have and like.+In my sample [[muttrc]] file I configure f1 to open it in the lynx browser for easy navigation. If you don't have or don't like lynx change to a text-based browser you have and like.
 There are  plenty of good, bad and indifferent howtos an tutorials online, so I'll only list the most essential starter keystrokes here.   There are  plenty of good, bad and indifferent howtos an tutorials online, so I'll only list the most essential starter keystrokes here.  
  
Line 102: Line 174:
  
   - The m key is used to start writing a message. You are asked if you want to continue working on an already started message. If you type y you will be put in to a drafts folder. Other wise you are prompted for who to send the message to and the subject, and then your chosen editor opens to write the message body.    - The m key is used to start writing a message. You are asked if you want to continue working on an already started message. If you type y you will be put in to a drafts folder. Other wise you are prompted for who to send the message to and the subject, and then your chosen editor opens to write the message body. 
-When you are finished do what ever you normally do to exit the editor saving messages, and they use y to send. You can also edit header info, add attachments or spell check if you have set that up from here. For example s puts you in the subject field, t to to, and e reopens the msg body in your editor. Use p to open the pgp menu and change encryption and signing options. To send attachments just type a before sending your message and type the path to the file you wish to attach. Completion works here, so you can just type enough letters to not apply to more than one message and tab and the rest is filled in for you, or use the question mark to open the email folders list, and once used local files and sub folders as well. .+When you are finished do what ever you normally do to exit the editor saving messages, and they use y to send. You can also edit header info, add attachments or spell check if you have set that up from here. For example s puts you in the subject field, t to to, and e reopens the msg body in your editor. Use p to open the pgp menu and change encryption and signing options. To send attachments just type a before sending your message and type the path to the file you wish to attach. Completion works here, so you can just type enough letters to not apply to more than one message and tab and the rest is filled in for you, or use the questionmark to open the email folders list, and once used local files and sub folders as well. .
  
 Once your message has been sent you are put back in the message or message index list where you started. Once your message has been sent you are put back in the message or message index list where you started.
-The following keystrokes can be used in either the pager, i.e. when you have a message open to read, or from the index, message list, as can the keystrokes to reply or start new messages. In a few cases behavior may slightly vary depending on whether you are in an open message or not.  +The following keystrokes can be used in either the pager, i.e. when you have a message open to read, or from the index, message list, as can the keystrokes to reply or start new messages. In a few cases behavior may slightly vary depending on whether you are in anopen message or not.  
  
  * To delete an individual message type d, to delete the whole conversation use ^d. If you screw up and want to undelete use u or ^u to undelete a message or conversation respectively.  * To delete an individual message type d, to delete the whole conversation use ^d. If you screw up and want to undelete use u or ^u to undelete a message or conversation respectively.
Line 126: Line 198:
  
 Mutt has an attachments menu where not only are files you normally think of as attachments are listed. Mutt has an attachments menu where not only are files you normally think of as attachments are listed.
-All parts of the email including signature files and the message body itself appear in the list. In some cases three different files contain the main contents of the email, i.e. the body of the email. This is done to accomidate a wide range of email clients that have different capabilities, and may or may not comply with recognized standards. Typically in these cases you will have a multipart/alternative, plain/text, and text/html. +All parts of the email including signiture files and the message body itself appear in the list. In some cases three different files contain the main contents of the email, i.e. the body of the email. This is done to accomidate a wide range of email clients that have different cababilities, and may or may not comply with recognized standards. Typically in these cases you will have a multipart/alternative, plain/text, and text/html. 
 When the message body is displayed by the pager, i.e. when you enter on an email in the message index, the html version is chosen over the plaintext one if you use either of the sample configuration files linked to in this article. This behavior can be changed by uncommenting a clearly labeled line in the muttrc's.  When the message body is displayed by the pager, i.e. when you enter on an email in the message index, the html version is chosen over the plaintext one if you use either of the sample configuration files linked to in this article. This behavior can be changed by uncommenting a clearly labeled line in the muttrc's. 
 Note that even though html is prefered over plain text the pager shows a dump of the text from the html file. Exactly how this will look depends on your browser configuration, e.g. if you have the browser set to number links a number does appear by the link name in the text shown in the pager. You can not just click on the number to open the link however. One way to open links using urlview is mentioned above. Another method is explained in the following subsection. Note that even though html is prefered over plain text the pager shows a dump of the text from the html file. Exactly how this will look depends on your browser configuration, e.g. if you have the browser set to number links a number does appear by the link name in the text shown in the pager. You can not just click on the number to open the link however. One way to open links using urlview is mentioned above. Another method is explained in the following subsection.
Line 157: Line 229:
 [[ http://heather.cs.ucdavis.edu/~matloff/Mutt/NotesMutt.NM.html ]] [[ http://heather.cs.ucdavis.edu/~matloff/Mutt/NotesMutt.NM.html ]]
  
-My first mutt is a very good sight, and is often referenced in mutt related blogs, forum posts and articles.+My first mutt is a very good site, and is often referenced in mutt related blogs, forum posts and articles.
 [[ http://mutt.blackfish.org.uk/ ]] [[ http://mutt.blackfish.org.uk/ ]]
  
 The Woodnotes Guide to the Mutt Email Client has lots of good information presented in a well organized manner. The Woodnotes Guide to the Mutt Email Client has lots of good information presented in a well organized manner.
 [[ http://www.therandymon.com/woodnotes/mutt/using-mutt.html ]] [[ http://www.therandymon.com/woodnotes/mutt/using-mutt.html ]]
 +
 +
 +The Arch Linux Wiki has excellent documentation on mutt, including a minimal muttrc which can be used to get you up and running in minutes.  It stores your Gmail password insecurely in plain text though.
 +
 +[[https://wiki.archlinux.org/index.php/mutt#Summary]]
 +
 +The Arch Linux Wiki documentation on how to add mutt's addressbook, abook.
 +[[https://wiki.archlinux.org/index.php/mutt#Abook]]
  
 === Sample files for download === === Sample files for download ===
-[[muttrc|example mutt configuration file]] +**SIMPLE MUTTRC FILE** [[muttrc|example mutt configuration file]] 
-[[muttrc.ext|a muttrc with more customizations and extra functionality]] + 
-[[mailcap|a good sample mailcap file]] +**ADVANCED MUTTRC FILE WITH CUSTOMIZATIONS AND EXTRA FUNCTIONALITY**[[muttrc.ext| a muttrc with more customizations and extra functionality]] 
-[[sorta|a script to put mutt address aliases in alphabetical order]] + 
 +**MAILCAP FILE (goes in your ~/.mutt folder)** [[mailcap|a good sample mailcap file]] 
 + 
 +**ALIAS SORTING SCRIPT** [[sorta|a script to put mutt address aliases in alphabetical order]] 
  
 Burt Henry 2014/06/06 20:32 Burt Henry 2014/06/06 20:32
mutt_configuration_and_basic_use.txt · Last modified: 2019/09/23 10:15 by D.J.J. Ring Jr.