| 1 | <?xml version='1.0' encoding="UTF-8"?> |
1 | <?xml version='1.0' encoding="UTF-8"?> |
| 2 | <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/guide-to-mutt.xml,v 1.19 2006/09/17 16:08:36 neysx Exp $ --> |
2 | <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/guide-to-mutt.xml,v 1.20 2011/08/17 19:49:12 swift Exp $ --> |
| 3 | |
3 | |
| 4 | <!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
4 | <!DOCTYPE guide SYSTEM "http://www.gentoo.org/dtd/guide.dtd"> |
| 5 | |
5 | |
| 6 | <guide link="/doc/en/guide-to-mutt.xml"> |
6 | <guide link="http://www.gentoo.org/doc/en/guide-to-mutt.xml"> |
| 7 | |
7 | |
| 8 | <title>QuickStart Guide to Mutt E-Mail</title> |
8 | <title>QuickStart Guide to Mutt E-Mail</title> |
| 9 | |
9 | |
| 10 | <author title="Author"> |
10 | <author title="Author"> |
| 11 | <mail link="mikpolniak@adelphia.net">Mike Polniak</mail> |
11 | <mail link="grobian@gentoo.org">Fabian Groffen</mail> |
| 12 | </author> |
12 | </author> |
| 13 | <author title="Editor"> |
|
|
| 14 | <mail link="antifa@gentoo.org">Ken Nowack</mail> |
|
|
| 15 | </author> |
|
|
| 16 | <author title="Contributor"> |
|
|
| 17 | <mail link="hitch17@gmail.com">John Hitchings</mail> |
|
|
| 18 | </author> |
|
|
| 19 | |
13 | |
| 20 | <abstract> |
14 | <abstract> |
| 21 | This guide shows you how to begin using the powerful command line tools for |
15 | This guide shows you how to begin using the powerful command line e-mail |
| 22 | e-mail: fetchmail, procmail, mutt, nbsmtp, msmtp. |
16 | client mutt. |
| 23 | </abstract> |
17 | </abstract> |
| 24 | |
18 | |
| 25 | <!-- The content of this document is licensed under the CC-BY-SA license --> |
19 | <!-- The content of this document is licensed under the CC-BY-SA license --> |
| 26 | <!-- See http://creativecommons.org/licenses/by-sa/2.5 --> |
20 | <!-- See http://creativecommons.org/licenses/by-sa/2.5 --> |
| 27 | <license/> |
21 | <license/> |
| 28 | |
22 | |
| 29 | <version>1.7</version> |
23 | <version>2</version> |
| 30 | <date>2006-09-17</date> |
24 | <date>2011-08-17</date> |
| 31 | |
25 | |
| 32 | <chapter> |
26 | <chapter> |
| 33 | <title>Introduction to E-Mail</title> |
27 | <title>The Mutt e-mail client</title> |
| 34 | <section> |
28 | <section> |
| 35 | <body> |
29 | <body> |
| 36 | |
30 | |
| 37 | <p> |
31 | <p> |
| 38 | If you're not a fan of e-mail clients with fancy graphical user interfaces, or |
32 | If you're not a fan of e-mail clients with fancy graphical user interfaces, or |
| 39 | if you would just like to experiment with other mail clients before deciding |
33 | you just like to be able to quickly read some mail over an SSH connection, the |
| 40 | which is best for you, here is the easy way to begin using these powerful |
34 | class of console-based mail clients might be for you. |
| 41 | command line tools: |
|
|
| 42 | </p> |
|
|
| 43 | |
|
|
| 44 | <p> |
35 | </p> |
| 45 | <b>fetchmail, procmail, mutt & smtp</b> |
36 | |
| 46 | </p> |
37 | <p> |
| 47 | |
38 | Mutt is one of the current console-based mail clients that's still under active |
|
|
39 | development and has a vast crowd of active supporters (and users). It is |
|
|
40 | powerful, highly customisable, small and efficient. |
| 48 | <p> |
41 | </p> |
| 49 | These programs are not only powerful and highly customizable but also small and |
42 | |
| 50 | efficient. Once you are up and running with this e-mail system you will be |
|
|
| 51 | amazed at what you can do with it. |
|
|
| 52 | </p> |
43 | <p> |
| 53 | |
44 | While Mutt was originally designed to read mail from the local mbox mail spool |
|
|
45 | (e.g. <path>/var/spool/mail/</path>), nowadays it comes with full support for |
|
|
46 | Maildir stored folders, remote fetching from POP3 servers and complete |
|
|
47 | management of IMAP accounts. For a full description of what Mutt can do, please |
|
|
48 | read the Mutt manual and Mutt website at <uri>http://www.mutt.org/</uri>. |
| 54 | <p> |
49 | </p> |
| 55 | Because this is a quick start guide, we will eliminate the Mail Transfer Agent |
|
|
| 56 | (MTA) such as sendmail, postfix or exim. This means no complex MTA |
|
|
| 57 | configuration. It also eliminates using port 25 for mail service. |
|
|
| 58 | </p> |
|
|
| 59 | |
|
|
| 60 | <p> |
|
|
| 61 | We can do this because fetchmail can force the mail it retrieves directly to a |
|
|
| 62 | Mail Delivery Agent (MDA) rather than forwarding to port 25. And we don't need |
|
|
| 63 | to use a complex MTA for plain old outgoing mail delivery. |
|
|
| 64 | </p> |
|
|
| 65 | |
|
|
| 66 | <p> |
|
|
| 67 | These are the programs you will need to get your e-mail running. |
|
|
| 68 | </p> |
|
|
| 69 | |
|
|
| 70 | <pre caption="Getting needed programs"> |
|
|
| 71 | # <i>emerge fetchmail nbsmtp procmail mutt</i> |
|
|
| 72 | </pre> |
|
|
| 73 | |
|
|
| 74 | <p> |
|
|
| 75 | Then just four quick steps to configure files and you will be up and running a |
|
|
| 76 | brand new e-mail system. |
|
|
| 77 | </p> |
|
|
| 78 | |
|
|
| 79 | <impo> |
|
|
| 80 | After each step you can run a test to make sure the setup is correct. This |
|
|
| 81 | means you will have a complete working e-mail system when you are done. |
|
|
| 82 | </impo> |
|
|
| 83 | |
50 | |
| 84 | </body> |
51 | </body> |
| 85 | </section> |
52 | </section> |
| 86 | </chapter> |
53 | </chapter> |
| 87 | |
54 | |
| 88 | <chapter> |
55 | <chapter> |
| 89 | <title>Fetchmail</title> |
56 | <title>Acquiring Mutt</title> |
| 90 | <section> |
57 | <section> |
| 91 | <body> |
58 | <body> |
| 92 | |
59 | |
| 93 | <p> |
60 | <p> |
| 94 | Fetchmail fetches mail from remote servers and forwards it to your local |
61 | Starting your Mutt adventure simply requires you to emerge it. |
| 95 | machines delivery system. To use it you need to set up a |
62 | Unfortunately, Mutt has a lots of options, which enable or disable certain |
| 96 | <path>.fetchmailrc</path> file in your home directory like this example: |
63 | functionalities of Mutt. We now briefly discuss the most important USE-flags |
|
|
64 | that you may want to enable based on your intended usage of Mutt. Please note |
|
|
65 | that enabling most of them won't harm your Mutt, but may make it do more than an |
|
|
66 | experienced Mutt user would like. |
| 97 | </p> |
67 | </p> |
| 98 | |
68 | |
| 99 | <pre caption="Sample .fetchmailrc"> |
69 | <pre caption="Mutt's USE-flags"> |
| 100 | <i>poll mail.myisp.net protocol pop3 user "myname" password "mypasswd"</i> |
70 | % <i>emerge -pv mutt</i> |
|
|
71 | [ebuild N ] mail-client/mutt-1.5.21-r1 USE="gdbm gpg imap mbox nls nntp \ |
|
|
72 | sidebar smime smtp ssl -berkdb -crypt -debug -doc -gnutls \ |
|
|
73 | -idn -pop -qdbm -sasl -tokyocabinet" |
| 101 | </pre> |
74 | </pre> |
| 102 | |
75 | |
| 103 | <p> |
76 | <p> |
| 104 | Once you have created a <path>.fetchmailrc</path> file, you have to change the |
77 | First off, for newcomers, the <c>imap</c> USE-flag is most probably the most |
| 105 | permissions on the file using the chmod command. The file must be readable only |
78 | important one. Enabling it won't hurt anything, so if you're unsure what |
| 106 | by the file owner. Set the permissions with the following command: |
79 | account you're going to use Mutt with, just enable it. Most email providers, |
| 107 | </p> |
80 | even free ones such as GMail, use IMAP these days, for it is the most convenient |
| 108 | |
81 | way to store email that is accessed from multiple clients at the same time |
| 109 | <pre caption="Changing Permissions"> |
82 | and/or different locations. Because IMAP keeps all mail at the server, Mutt |
| 110 | $ <i>chmod 600 .fetchmailrc</i> |
83 | just downloads the messages that you want to view. |
| 111 | </pre> |
|
|
| 112 | |
|
|
| 113 | <p> |
84 | </p> |
| 114 | To see fetchmail in action, use the verbose mode (-v). To fetch all messages |
85 | |
| 115 | use -a. And you must use the option -m to tell fetchmail to send the mail to |
|
|
| 116 | procmail. |
|
|
| 117 | </p> |
86 | <p> |
| 118 | |
87 | Often you happen to jump through a couple of messages a couple of times shortly |
| 119 | <warn> |
88 | after each other, which would require to download the same message over and |
| 120 | While testing, it's a good idea to tell fetchmail to keep (-k) the mail on the |
89 | over again. Since this simply is a waste, Mutt uses a so-called header cache |
| 121 | remote server in case something goes wrong and you need to fetch it again. |
90 | (hcache) to keep the most important bits of messages that it needs. This |
| 122 | </warn> |
91 | hcache is backed by a db-library, of which four flavours exist: <c>gdbm</c>, |
| 123 | |
92 | <c>berkdb</c>, <c>qdbm</c> and <c>tokyocabinet</c>. If you don't have any |
|
|
93 | preference yourself, pick gdbm or berkdb. Most likely you will have both |
|
|
94 | already installed on your system. Enabling the USE-flags for more than one |
|
|
95 | hcache backend will make Mutt choose one it likes best. It will always use |
|
|
96 | at most one. |
| 124 | <p> |
97 | </p> |
| 125 | Run it now to see fetchmail in action! |
98 | |
| 126 | </p> |
99 | <p> |
| 127 | |
100 | While IMAP is important for reading mail, sending mail requires a mail server. |
| 128 | <pre caption="Fetchmail test #1"> |
101 | Mutt can talk to a mail server that exists on the local system, but often that's |
| 129 | $ <i>fetchmail -akv -m "/usr/bin/procmail -d %T"</i> |
102 | not the case, or simply not a good solution for e.g. laptop users that often |
| 130 | </pre> |
103 | travel around. Mutt comes with SMTP support which gets enabled by the <c>smtp</c> |
| 131 | |
104 | USE-flag. Again, enabling it if you're not sure doesn't harm. Mutt's SMTP |
|
|
105 | support allows you just to send mail over a mail server of your choice; usually |
|
|
106 | the one that you are given by your email provider. |
| 132 | <p> |
107 | </p> |
| 133 | Once you have a working mail system you can set this as a cron job or put it in |
108 | |
| 134 | a monitor like gkrellm. Fetchmail can also run in a daemon mode for which you |
109 | <p> |
| 135 | specify a polling interval in seconds. |
110 | Both IMAP and SMTP mostly go over encrypted channels these days, hence if you |
|
|
111 | enabled any of both, it is wise to also enable either of the <c>ssl</c> or |
|
|
112 | <c>gnutls</c> USE-flags. Both just add the secure variants (imaps and smtps) to |
|
|
113 | Mutt's list of supported protocols using either OpenSSL's or GNUTLS' |
|
|
114 | implementation. If you don't have a strong preference for either, just go for |
|
|
115 | <c>ssl</c>. Most likely this is in your global USE already anyway. |
|
|
116 | </p> |
|
|
117 | |
|
|
118 | <p> |
|
|
119 | Last but not least, there is the <c>sidebar</c> USE-flag. It enables an |
|
|
120 | extension to Mutt that can show a navigation pane of available mailboxes on the |
|
|
121 | left hand side of the screen. While this is not a recommended feature for |
|
|
122 | absolute newcomers (it is nowhere mentioned in any official docs, since it |
|
|
123 | simply isn't official), more experienced users might like its functionality. |
|
|
124 | Luckily, just enabling the USE-flag doesn't make it visible at all, meaning you |
|
|
125 | don't even notice it's enabled. |
| 136 | </p> |
126 | </p> |
| 137 | |
127 | |
| 138 | </body> |
128 | </body> |
| 139 | </section> |
129 | </section> |
| 140 | </chapter> |
130 | </chapter> |
| 141 | |
131 | |
| 142 | <chapter> |
132 | <chapter> |
| 143 | <title>Procmail</title> |
133 | <title>Configuring Mutt</title> |
| 144 | <section> |
134 | <section> |
| 145 | <body> |
135 | <body> |
| 146 | |
136 | |
| 147 | <p> |
137 | <p> |
| 148 | Procmail is the processor that filters the mail that is forwarded to it by |
138 | After you emerged mutt with your USE-flags of choice, the only necessary step is |
| 149 | fetchmail. It also acts as the MDA to deliver mail to your mailboxes where mutt |
139 | to create a <path>.muttrc</path> file in your home directory. Muttrc's are to |
| 150 | (your e-mail client) can read it. |
140 | be found in many places on the web and in Mutt's documentation. In |
| 151 | </p> |
141 | <path>/usr/share/doc/mutt-<version>/samples</path> you can find some |
| 152 | |
142 | muttrc samples that are from the official distribution. We discuss a very |
|
|
143 | minimal <path>.muttrc</path> for an IMAP based account with SMTP mail delivery |
|
|
144 | below. |
| 153 | <p> |
145 | </p> |
| 154 | To use procmail you need to create a <path>.procmailrc</path> file in your home |
146 | |
| 155 | directory. For our quickstart purposes we will use a very simple |
147 | <pre caption="A .muttrc example file"> |
| 156 | <path>.procmailrc</path> that will filter mail from three gentoo mailing lists |
148 | # character set on messages that we send |
| 157 | into these mailboxes:<e>gentoo-dev, gentoo-user</e> and <e>gentoo-announce</e> |
149 | set send_charset="utf-8" |
|
|
150 | # if there is no character set given on incoming messages, it is probably windows |
|
|
151 | set assumed_charset="iso-8859-1" |
|
|
152 | |
|
|
153 | # make sure Vim knows mutt is a mail client and that we compose an UTF-8 encoded message |
|
|
154 | set editor="vim -c 'set syntax=mail ft=mail enc=utf-8'" |
|
|
155 | |
|
|
156 | # just scroll one line instead of full page |
|
|
157 | set menu_scroll=yes |
|
|
158 | |
|
|
159 | # we want to see some MIME types inline, see below this code listing for explanation |
|
|
160 | auto_view application/msword |
|
|
161 | auto_view application/pdf |
|
|
162 | |
|
|
163 | # make default search pattern to search in To, Cc and Subject |
|
|
164 | set simple_search="~f %s | ~C %s | ~s %s" |
|
|
165 | |
|
|
166 | # threading preferences, sort by threads |
|
|
167 | set sort=threads |
|
|
168 | set strict_threads=yes |
|
|
169 | |
|
|
170 | # show spam score (from SpamAssassin only) when reading a message |
|
|
171 | spam "X-Spam-Score: ([0-9\\.]+).*" "SA: %1" |
|
|
172 | set pager_format = " %C - %[%H:%M] %.20v, %s%* %?H? [%H] ?" |
|
|
173 | |
|
|
174 | # do not show all headers, just a few |
|
|
175 | ignore * |
|
|
176 | unignore From To Cc Bcc Date Subject |
|
|
177 | # and in this order |
|
|
178 | unhdr_order * |
|
|
179 | hdr_order From: To: Cc: Bcc: Date: Subject: |
|
|
180 | |
|
|
181 | # brighten up stuff with colours, for more colouring examples see: |
|
|
182 | # http://aperiodic.net/phil/configs/mutt/colors |
|
|
183 | color normal white black |
|
|
184 | color hdrdefault green default |
|
|
185 | color quoted green default |
|
|
186 | color quoted1 yellow default |
|
|
187 | color quoted2 red default |
|
|
188 | color signature cyan default |
|
|
189 | color indicator brightyellow red |
|
|
190 | color error brightred default |
|
|
191 | color status brightwhite blue |
|
|
192 | color tree brightmagenta black |
|
|
193 | color tilde blue default |
|
|
194 | color attachment brightyellow default |
|
|
195 | color markers brightred default |
|
|
196 | color message white black |
|
|
197 | color search brightwhite magenta |
|
|
198 | color bold brightyellow default |
|
|
199 | # if you don't like the black progress bar at the bottom of the screen, |
|
|
200 | # comment out the following line |
|
|
201 | color progress white black |
|
|
202 | |
|
|
203 | # personality settings |
|
|
204 | set realname = "Andrew Dalziel" |
|
|
205 | set from = "andy@mail.server" |
|
|
206 | alternates "andrew@mail.server|andrew.dalziel@mail.server" |
|
|
207 | # this file must exist, and contains your signature, comment it out if |
|
|
208 | # you don't want a signature to be used |
|
|
209 | set signature = ~/.signature |
|
|
210 | |
|
|
211 | # aliases (sort of address book) |
|
|
212 | source ~/.aliases |
|
|
213 | |
|
|
214 | # IMAP connection settings |
|
|
215 | set mail_check=60 |
|
|
216 | set imap_keepalive=300 |
|
|
217 | |
|
|
218 | # IMAP account settings |
|
|
219 | set folder=imaps://andy@imap.mail.server/ |
|
|
220 | set spoolfile=imaps://andy@imap.mail.server/ |
|
|
221 | set record=imaps://andy@imap.mail.server/Sent |
|
|
222 | set postponed=imaps://andy@imap.mail.server/Drafts |
|
|
223 | |
|
|
224 | # use headercache for IMAP (make sure this is a directory for performance!) |
|
|
225 | set header_cache=/var/tmp/.mutt |
|
|
226 | |
|
|
227 | # mailboxes we want to monitor for new mail |
|
|
228 | mailboxes "=" |
|
|
229 | mailboxes "=Lists" |
|
|
230 | |
|
|
231 | # mailing lists we are on (these are regexps!) |
|
|
232 | subscribe "gentoo-.*@gentoo\\.org" |
|
|
233 | |
|
|
234 | # SMTP mailing configuration (for sending mail) |
|
|
235 | set smtp_url=smtp://mail.server/ |
| 158 | </p> |
236 | </pre> |
| 159 | |
237 | |
| 160 | <note> |
238 | <note> |
| 161 | The procmail filter rules are called recipes, and I have also included recipes |
239 | It is good practice to review all settings from the example above. There are |
| 162 | to filter out some spam. |
240 | many more, and some preferences may actually not match yours. Keep that in mind |
|
|
241 | when you feel that Mutt at first doesn't really work the way you like. |
| 163 | </note> |
242 | </note> |
| 164 | |
243 | |
|
|
244 | <p> |
|
|
245 | The example <path>.muttrc</path> above sets up an IMAP account, uses an SMTP |
|
|
246 | server to send mail, stores its cache in <path>/var/tmp/.mutt</path>, reads the |
|
|
247 | known address aliases (think of it as an address book) from |
|
|
248 | <path>~/.aliases</path> and appends the signature from <path>~/.signature</path> |
|
|
249 | when composing new mail. For some IMAP servers it may be necessary to change the |
|
|
250 | spool, record and postponed directories, as the folders <path>Sent</path> and |
|
|
251 | <path>Drafts</path> may be under a folder called <path>INBOX</path>. Simply |
|
|
252 | trying this out with Mutt is the simplest way to figure this out. |
|
|
253 | </p> |
|
|
254 | |
|
|
255 | <p> |
|
|
256 | Once your <path>.muttrc</path> is setup, you are ready to launch Mutt by just |
|
|
257 | running <c>mutt</c>. If you entered a valid IMAP server url, Mutt will prompt |
|
|
258 | you for your password and afterwards load all messages for you. Note that the |
|
|
259 | first time entering your mailbox may take a while if you have quite some |
|
|
260 | messages, since Mutt's header cache is still empty. If this succeeds you're in |
|
|
261 | your IMAP mailbox ready to go. |
|
|
262 | </p> |
|
|
263 | |
|
|
264 | <p> |
|
|
265 | Navigation is intuitive, as is reading messages by just pressing the enter key |
|
|
266 | or space bar. Mutt is quite Vim alike in that it uses key strokes to perform |
|
|
267 | most of its actions. You best read Mutt's manual on the web to get yourself |
|
|
268 | known with all existing functions (or press ? in Mutt) and what key they are |
|
|
269 | bound to, or better, what key you like it to be bound to. Some essential keys |
|
|
270 | are <c>m</c> (for message) to start composing a new message, <c>q</c> for quit, |
|
|
271 | <c>r</c> for reply, <c>s</c> for save and <c>p</c> for print. |
|
|
272 | </p> |
|
|
273 | |
|
|
274 | <p> |
|
|
275 | One of the features that Mutt has that is still not in today's most savvy email |
|
|
276 | clients is the ability to display attachments inline through some viewer. The |
|
|
277 | auto_view directive in the .muttrc file tells Mutt which attachments (based on |
|
|
278 | their MIME-type) it should view inline. To figure out how to do that, Mutt uses |
|
|
279 | mailcap files to lookup how to display a certain MIME-type. Usually the system |
|
|
280 | wide mailcap file isn't sufficient here, so you better start a |
|
|
281 | <path>~/.mailcap</path> file to put items in there for <c>copiousoutput</c> that |
|
|
282 | Mutt can display inline. |
|
|
283 | </p> |
|
|
284 | |
|
|
285 | <p> |
|
|
286 | In the example <path>.muttrc</path> above <c>auto_view</c> is enabled for |
|
|
287 | <c>application/msword</c> and <c>application/pdf</c> files. These two show |
|
|
288 | the extreme usefulness of this capability, because it means meeting notes sent |
|
|
289 | as doc file now are perfectly fine readable without having to save the |
|
|
290 | attachment and open it in OpenOffice. Instead the text just shows up in the |
|
|
291 | message reader, that is, if you have a matching entry in your |
|
|
292 | <path>~/.mailcap</path> file. |
|
|
293 | </p> |
|
|
294 | |
| 165 | <pre caption="Sample .procmailrc"> |
295 | <pre caption="Example .mailcap file"> |
| 166 | MAILDIR=$HOME/MuttMail ##you better make sure it exists |
296 | application/msword; antiword '%s'; copiousoutput; description=Word Document; |
| 167 | LOGFILE=$HOME/.procmaillog |
297 | nametemplate=%s.doc |
| 168 | LOGABSTRACT=no |
298 | application/pdf; pdftotext '%s' -; copiousoutput; description=PDF Document; |
| 169 | #VERBOSE=on...is only used for debugging |
299 | nametemplate=%s.pdf |
| 170 | VERBOSE=off |
|
|
| 171 | FORMAIL=/usr/bin/formail |
|
|
| 172 | NL=" |
|
|
| 173 | " |
|
|
| 174 | ##recipe lines begin with :0 |
|
|
| 175 | ##dont put comments on recipe lines |
|
|
| 176 | ##disable a recipe with the false condition ! |
|
|
| 177 | ##condition lines begin with * and regex is your friend |
|
|
| 178 | ##conditions are anded and everything after * is fed straight into egrep |
|
|
| 179 | ##one action line follows the conditions, in this case it is a mailbox name |
|
|
| 180 | |
|
|
| 181 | #catch duplicates using formail |
|
|
| 182 | :0 Whc: .msgid.lock |
|
|
| 183 | | $FORMAIL -D 16384 .msgid.cache |
|
|
| 184 | |
|
|
| 185 | :0 a |
|
|
| 186 | $MAILDIR/duplicates |
|
|
| 187 | |
|
|
| 188 | #people we always allow mail from |
|
|
| 189 | :0 |
|
|
| 190 | * ^From:.*(craig\@hotmail|renee\@local.com) |
|
|
| 191 | $MAILDIR/friends |
|
|
| 192 | |
|
|
| 193 | #now flush some spam out |
|
|
| 194 | :0 |
|
|
| 195 | * ^Subject:.*(credit|cash|money|debt|sex|sale|loan) |
|
|
| 196 | $MAILDIR/spam |
|
|
| 197 | |
|
|
| 198 | #no more html messages |
|
|
| 199 | :0 |
|
|
| 200 | * ^Content-Type:.*html |
|
|
| 201 | $MAILDIR/junk |
|
|
| 202 | |
|
|
| 203 | #now put my mail lists into mailboxes |
|
|
| 204 | :0 |
|
|
| 205 | * ^List-Id:.*gentoo-user |
|
|
| 206 | gentoo-user |
|
|
| 207 | |
|
|
| 208 | :0 |
|
|
| 209 | * ^List-Id:.*gentoo-dev |
|
|
| 210 | gentoo-dev |
|
|
| 211 | |
|
|
| 212 | :0 |
|
|
| 213 | * ^List-Id:.*gentoo-announce |
|
|
| 214 | gentoo-announce |
|
|
| 215 | |
|
|
| 216 | #catch any other gentoo mail |
|
|
| 217 | :0 |
|
|
| 218 | * ^From:.*gentoo.org |
|
|
| 219 | gentoo |
|
|
| 220 | |
|
|
| 221 | :0 |
|
|
| 222 | * ^From:.*@freshmeat\.net |
|
|
| 223 | freshmeat |
|
|
| 224 | |
|
|
| 225 | ################################ |
|
|
| 226 | # Last rule: mail that gets # |
|
|
| 227 | # this far goes in default box # |
|
|
| 228 | ################################ |
|
|
| 229 | :0 |
|
|
| 230 | * .* |
|
|
| 231 | default |
|
|
| 232 | |
|
|
| 233 | # End of file |
|
|
| 234 | </pre> |
300 | </pre> |
| 235 | |
301 | |
| 236 | <note> |
|
|
| 237 | It is only required to make the MAILDIR <path>$HOME/MuttMail</path> as Procmail |
|
|
| 238 | will create all the mailbox files as needed in this directory using the names |
|
|
| 239 | on the action lines. For some useful links visit |
|
|
| 240 | <uri>http://www.procmail.org/</uri> |
|
|
| 241 | </note> |
|
|
| 242 | |
|
|
| 243 | <p> |
|
|
| 244 | You can now test <path>.procmailrc</path> by re-running the fetchmail command |
|
|
| 245 | we tested in the first step. Remember the -k option to keep all mail on the |
|
|
| 246 | remote server so we have it if we need to rerun it. |
|
|
| 247 | </p> |
302 | <p> |
| 248 | |
303 | The above <path>.mailcap</path> example tells mutt what to do to "view" |
| 249 | |
304 | <c>msword</c> and <c>pdf</c> files. For the former it should run a program |
| 250 | <pre caption="Procmail test #1"> |
305 | called <c>antiword</c> (emerge <c>app-text/antiword</c>), for the latter the |
| 251 | $ <i>fetchmail -akv -m "/usr/bin/procmail -d %T"</i> |
306 | program <c>pdftotext</c> (emerge <c>app-text/poppler</c>). You can go wild with |
| 252 | </pre> |
307 | these to for example display rendered HTML (give <c>app-text/vilistextum</c> a |
| 253 | |
308 | try), render vcards, or show ASCII representation of attached images. All you |
| 254 | <p> |
309 | need to do is define how to call the program in your <path>.mailcap</path>, and |
| 255 | Now that fetchmail and procmail have run, go to <path>$HOME/MuttMail</path> and |
310 | tell Mutt to try to view it inline using the <c>auto_view</c> directive. |
| 256 | read your messages with <c>less</c> or your file manager. |
|
|
| 257 | </p> |
311 | </p> |
| 258 | |
312 | |
| 259 | </body> |
313 | </body> |
| 260 | </section> |
314 | </section> |
| 261 | </chapter> |
315 | </chapter> |
| 262 | |
316 | |
| 263 | <chapter> |
317 | <chapter> |
| 264 | <title>Mutt e-mail client</title> |
318 | <title>Conclusions</title> |
| 265 | <section> |
319 | <section> |
| 266 | <body> |
320 | <body> |
| 267 | |
321 | |
| 268 | <p> |
322 | <p> |
| 269 | Mutt is used to read and compose e-mail. It is powerful and highly customizable |
323 | Mutt is a very versatile console email client. If you like the concept, Mutt |
| 270 | but also small and efficient. |
324 | can be altered to behave in nearly any way through its configuration. Search |
| 271 | </p> |
325 | the web to find others explaining how they did "it", or find one of the many |
| 272 | |
326 | patches that exist to make Mutt do even more. Gentoo applies a couple of very |
| 273 | <p> |
327 | popular patches to Mutt, so make sure to check <c>mutt -v</c> if you want |
| 274 | Mutt supports reading and writing of four different mailbox formats: mbox, |
328 | something more to make sure it is not yet already at your disposal. While |
| 275 | MMDF, MH and Maildir. The mailbox type is autodetected. In our case we are |
329 | learning Mutt is not necessarily easy, once it is in your fingers, it can make |
| 276 | using the mbox format, where all messages of a mailbox are stored in a single |
330 | your mail experience much faster and efficient than with other clients. |
| 277 | file. |
331 | Searching for example is quite powerful if you know how to hit the right flags |
| 278 | </p> |
332 | and know which regular expression narrows your search down. Enjoy Mutting! |
| 279 | |
|
|
| 280 | <p> |
|
|
| 281 | Mutt also has the ability to work with folders located on a remote IMAP server. |
|
|
| 282 | See IMAP Support in section 4.11 of the Mutt manual and the Mutt web site |
|
|
| 283 | <uri>http://www.mutt.org/</uri> |
|
|
| 284 | </p> |
|
|
| 285 | |
|
|
| 286 | <p> |
|
|
| 287 | When you emerged mutt in the first step it installed a configuration file in |
|
|
| 288 | <path>/etc/mutt/Muttrc</path>. You also need to create a <path>.muttrc</path> |
|
|
| 289 | file in your home directory. |
|
|
| 290 | </p> |
|
|
| 291 | |
|
|
| 292 | <pre caption="Sample .muttrc"> |
|
|
| 293 | <comment>(Be sure to read the fine Mutt manual in /usr/share/doc/mutt*) |
|
|
| 294 | (Any settings here override the system settings in /etc/mutt/Muttrc)</comment> |
|
|
| 295 | |
|
|
| 296 | # <i>cp /etc/mutt/Muttrc ~/.muttrc</i> |
|
|
| 297 | # <i>nano -w .muttrc</i> |
|
|
| 298 | set pager_context=1 |
|
|
| 299 | set pager_index_lines=6 #show a mini-index in pager |
|
|
| 300 | set menu_scroll |
|
|
| 301 | set pgp_verify_sig=no #dont show pgp in pager |
|
|
| 302 | set status_on_top #put status line at top |
|
|
| 303 | set sort=threads #sort by message threads in index |
|
|
| 304 | |
|
|
| 305 | set status_format=" %r %b %f %n Del %d Msgs %m %l %> (%P)" |
|
|
| 306 | set pager_format="%-10.10i %[!%a %b %d %R]" |
|
|
| 307 | set date_format="!%H:%M %a %d %b " |
|
|
| 308 | set index_format="%4C %Z %[%b%d] %-15.15F %s" |
|
|
| 309 | set folder_format="%2C %t %8s %d %N %f" |
|
|
| 310 | |
|
|
| 311 | #set sendmail="/usr/bin/nbsmtp -d isp.net -h smtp.isp.net -f yourname@isp.net" |
|
|
| 312 | |
|
|
| 313 | #set from="default-mailaddress" #set to your from address |
|
|
| 314 | #set realname="myname" |
|
|
| 315 | |
|
|
| 316 | set record="$HOME/MuttMail/sent" #sent mail is saved here |
|
|
| 317 | set delete=yes #delete without prompting |
|
|
| 318 | set include=yes #quote msg in reply |
|
|
| 319 | set fast_reply=yes #no prompting on reply |
|
|
| 320 | set beep=no #no noise |
|
|
| 321 | set markers=no #no + on wrapped lines |
|
|
| 322 | set confirmappend=no #no prompt for save to =keep |
|
|
| 323 | set to_chars=" +TCF" #no L for mail_list |
|
|
| 324 | |
|
|
| 325 | set folder = $HOME/MuttMail |
|
|
| 326 | mailboxes =gentoo-user |
|
|
| 327 | mailboxes =gentoo-dev |
|
|
| 328 | mailboxes =gentoo-announce |
|
|
| 329 | mailboxes =gentoo |
|
|
| 330 | mailboxes =freshmeat |
|
|
| 331 | mailboxes =duplicates |
|
|
| 332 | mailboxes =default |
|
|
| 333 | mailboxes =friends |
|
|
| 334 | mailboxes =junk |
|
|
| 335 | mailboxes =spam |
|
|
| 336 | mailboxes =keep |
|
|
| 337 | |
|
|
| 338 | save-hook .* =keep #default mbox to (s)ave mail is =keep |
|
|
| 339 | subscribe gentoo-user gentoo-dev #subscribed to these lists |
|
|
| 340 | |
|
|
| 341 | bind pager h display-toggle-weed #toggle headers with h key |
|
|
| 342 | |
|
|
| 343 | # simulate the old url menu |
|
|
| 344 | macro index \cb |urlview\n 'call urlview to extract URLs out of a message' |
|
|
| 345 | macro pager \cb |urlview\n 'call urlview to extract URLs out of a message' |
|
|
| 346 | |
|
|
| 347 | #run fetchmail by hitting key of G |
|
|
| 348 | macro index G "!fetchmail -a -m 'procmail -d %T'\r" |
|
|
| 349 | macro pager G "!fetchmail -a -m 'procmail -d %T'\r" |
|
|
| 350 | |
|
|
| 351 | #use to edit .muttrc and then source it...no restart necessary |
|
|
| 352 | macro generic ,sm ":source $HOME/.muttrc\r" |
|
|
| 353 | macro generic \cj "!rxvt -bg wheat -e joe $HOME/.muttrc\r" |
|
|
| 354 | |
|
|
| 355 | # default list of header fields to weed out when displaying mail |
|
|
| 356 | #ignore them all and then unignore what you want to see |
|
|
| 357 | ignore * |
|
|
| 358 | unignore Date To From: Subject X-Mailer Organization User-Agent |
|
|
| 359 | hdr_order Date From To Subject X-Mailer User-Agent Organization |
|
|
| 360 | |
|
|
| 361 | ##your Mutt has to have some colors |
|
|
| 362 | ##these are for four levels of quoted text |
|
|
| 363 | ##they override the system settings in /etc/mutt/Muttrc |
|
|
| 364 | |
|
|
| 365 | #color quoted green default |
|
|
| 366 | color quoted1 magenta blue |
|
|
| 367 | #color quoted2 yellow default |
|
|
| 368 | #color quoted3 red default |
|
|
| 369 | #color signature cyan cyan |
|
|
| 370 | |
|
|
| 371 | |
|
|
| 372 | #this color setup is copied from /etc/mutt/Muttrc.color |
|
|
| 373 | #comment it out if you want the default colors in /etc/mutt/Muttrc |
|
|
| 374 | # Je vois la vie en rose :-) |
|
|
| 375 | color hdrdefault brightcyan blue |
|
|
| 376 | color header brightwhite blue "^from:" |
|
|
| 377 | color header brightwhite blue "^subject:" |
|
|
| 378 | |
|
|
| 379 | color quoted brightgreen blue |
|
|
| 380 | color signature brightwhite blue |
|
|
| 381 | |
|
|
| 382 | color indicator blue green |
|
|
| 383 | |
|
|
| 384 | color error red black |
|
|
| 385 | mono error bold |
|
|
| 386 | color status black cyan |
|
|
| 387 | mono status bold |
|
|
| 388 | color tree yellow blue |
|
|
| 389 | |
|
|
| 390 | color tilde brightmagenta blue |
|
|
| 391 | color body brightwhite blue "[-a-z_0-9.]+@[-a-z_0-9.]+" |
|
|
| 392 | mono body bold "[-a-z_0-9.]+@[-a-z_0-9.]+" |
|
|
| 393 | color body brightyellow black "^Good signature" |
|
|
| 394 | mono body bold "^Good signature" |
|
|
| 395 | color body brightwhite red "^Bad signature from.*" |
|
|
| 396 | mono body bold "^Bad signature from.*" |
|
|
| 397 | color normal white blue |
|
|
| 398 | color message green black |
|
|
| 399 | color attachment brightgreen blue |
|
|
| 400 | |
|
|
| 401 | # End of file...but it can go on and on and on....:) |
|
|
| 402 | </pre> |
|
|
| 403 | |
|
|
| 404 | <p> |
|
|
| 405 | For the record, this is just a sample <path>.muttrc</path>. There are many more |
|
|
| 406 | options that you can configure, such as integration with GPG. Have a look at |
|
|
| 407 | <uri>http://www.dotfiles.com/index.php?app_id=27</uri> for more examples and |
|
|
| 408 | help. |
|
|
| 409 | </p> |
|
|
| 410 | |
|
|
| 411 | <p> |
|
|
| 412 | You are now ready to test your <path>.muttrc</path>. |
|
|
| 413 | </p> |
|
|
| 414 | |
|
|
| 415 | <pre caption="Testing .muttrc"> |
|
|
| 416 | $ <i>mutt -y</i> |
|
|
| 417 | </pre> |
|
|
| 418 | |
|
|
| 419 | <p> |
|
|
| 420 | This should open Mutt with a menu showing the Mutt mailboxes that you created |
|
|
| 421 | in Test 2 when you ran the fetchmail command. |
|
|
| 422 | </p> |
|
|
| 423 | |
|
|
| 424 | <p> |
|
|
| 425 | Type the ? for help in navigating the Mutt Mailboxes. |
|
|
| 426 | </p> |
|
|
| 427 | |
|
|
| 428 | </body> |
|
|
| 429 | </section> |
|
|
| 430 | </chapter> |
|
|
| 431 | |
|
|
| 432 | <chapter> |
|
|
| 433 | <title>SMTP</title> |
|
|
| 434 | <section> |
|
|
| 435 | <body> |
|
|
| 436 | |
|
|
| 437 | <p> |
|
|
| 438 | The final step is setting up nbsmtp the 'No-Brainer SMTP' used to send mail to |
|
|
| 439 | your SMTP server. This setup is the easiest of all, as it only requires adding |
|
|
| 440 | an entry in your <path>.muttrc</path> file. |
|
|
| 441 | </p> |
|
|
| 442 | |
|
|
| 443 | <p> |
|
|
| 444 | domain: The domain you want nbsmtp to say it belongs to. This will almost |
|
|
| 445 | invariably be the same as the domain in your e-mail address. |
|
|
| 446 | </p> |
|
|
| 447 | |
|
|
| 448 | <p> |
|
|
| 449 | from@addr: This is the address you want nbsmtp to say the message is from. Note |
|
|
| 450 | that this can be different than the "From:" line in your MUA. |
|
|
| 451 | </p> |
|
|
| 452 | |
|
|
| 453 | <p> |
|
|
| 454 | host: This is the smtp server you are sending to. |
|
|
| 455 | </p> |
|
|
| 456 | |
|
|
| 457 | <pre caption="Adding SMTP support"> |
|
|
| 458 | $ <i>nano -w .muttrc</i> |
|
|
| 459 | set sendmail="/usr/bin/nbsmtp -d isp.net -h smtp.isp.net -f urname@isp.net" |
|
|
| 460 | </pre> |
|
|
| 461 | |
|
|
| 462 | <p> |
|
|
| 463 | You are now ready to send a message. So in the Mutt pager or index hit the |
|
|
| 464 | <c>m</c> key to compose a test message to send to your e-mail address. Mutt |
|
|
| 465 | will use the value of the EDITOR or VISUAL for the composition editor unless |
|
|
| 466 | you set <c>editor=</c> in the <path>.muttrc</path>. When you are done composing |
|
|
| 467 | hit <c>y</c> to send your message. If there are no errors you will see 'sending |
|
|
| 468 | mail' followed by 'Mail sent.' |
|
|
| 469 | </p> |
|
|
| 470 | |
|
|
| 471 | <p> |
|
|
| 472 | Remember in <path>.muttrc</path> we have set where to save sent mail with |
|
|
| 473 | <c>set record="$HOME/MuttMail/sent"</c> |
|
|
| 474 | </p> |
|
|
| 475 | |
|
|
| 476 | <p> |
|
|
| 477 | Now to complete the test, run fetchmail again to get all your mail and verify |
|
|
| 478 | you have received the message you sent to your e-mail address. When you find |
|
|
| 479 | your test message, hit the <c>h</c> key to toggle a view of all the headers and |
|
|
| 480 | see the complete mail transfer path. |
|
|
| 481 | </p> |
|
|
| 482 | |
|
|
| 483 | <note> |
|
|
| 484 | There is one more program you probably want to add called urlview. This |
|
|
| 485 | extracts the urls in message texts and sends them to your browser. |
|
|
| 486 | </note> |
|
|
| 487 | |
|
|
| 488 | <pre caption="Getting urlview"> |
|
|
| 489 | # <i>emerge urlview</i> |
|
|
| 490 | </pre> |
|
|
| 491 | |
|
|
| 492 | <p> |
|
|
| 493 | Then create <path>~/.urlview</path> by copying the configuration file from |
|
|
| 494 | <path>/usr/share/doc/urlview*/</path> and setting your browser command. |
|
|
| 495 | </p> |
|
|
| 496 | |
|
|
| 497 | <p> |
|
|
| 498 | You now have a powerful and highly customizable mail system. To take advantage |
|
|
| 499 | of its flexibility, read all the manuals and docs and find the many user |
|
|
| 500 | configuration files available on the web: search for <path>procmailrc</path> and |
|
|
| 501 | <path>muttrc</path>. |
|
|
| 502 | </p> |
|
|
| 503 | |
|
|
| 504 | </body> |
|
|
| 505 | </section> |
|
|
| 506 | </chapter> |
|
|
| 507 | |
|
|
| 508 | <chapter> |
|
|
| 509 | <title>Authenticated SMTP</title> |
|
|
| 510 | <section> |
|
|
| 511 | <title>Using nbSMTP</title> |
|
|
| 512 | <body> |
|
|
| 513 | |
|
|
| 514 | <p> |
|
|
| 515 | If you need to pass a username and password to your SMTP server, you can edit |
|
|
| 516 | the <c>set sendmail</c> command in your <path>.muttrc</path> to include <c>-U |
|
|
| 517 | <username> -P <password></c>, like this: |
|
|
| 518 | </p> |
|
|
| 519 | |
|
|
| 520 | <pre caption="Setting username and password for SMTP"> |
|
|
| 521 | set sendmail="/usr/bin/nbsmtp -U <i>username</i> -P <i>password</i> -d isp.net -h smtp.isp.net -f urname@isp.net" |
|
|
| 522 | </pre> |
|
|
| 523 | |
|
|
| 524 | <p> |
|
|
| 525 | If you do not want this information to be present in your <path>.muttrc</path> |
|
|
| 526 | file, you can also create a <path>.nbsmtprc</path> file in which you include all |
|
|
| 527 | information: |
|
|
| 528 | </p> |
|
|
| 529 | |
|
|
| 530 | <pre caption="~/.nbsmtprc example"> |
|
|
| 531 | auth_user = <i>username</i> |
|
|
| 532 | auth_pass = <i>password</i> |
|
|
| 533 | </pre> |
|
|
| 534 | |
|
|
| 535 | </body> |
|
|
| 536 | </section> |
|
|
| 537 | <section> |
|
|
| 538 | <title>Alternative: Using msmtp</title> |
|
|
| 539 | <body> |
|
|
| 540 | |
|
|
| 541 | <p> |
|
|
| 542 | <c>msmtp</c> is a simple alternative to <c>nbsmtp</c> with similar |
|
|
| 543 | possibilities. |
|
|
| 544 | </p> |
|
|
| 545 | |
|
|
| 546 | <pre caption="Installing msmtp"> |
|
|
| 547 | # <i>emerge msmtp</i> |
|
|
| 548 | </pre> |
|
|
| 549 | |
|
|
| 550 | <p> |
|
|
| 551 | Now login as a normal user and configure msmtp by creating a |
|
|
| 552 | <path>~/.msmtprc</path> file, filling in your SMTP server's information. |
|
|
| 553 | Remember to set the permissions to a secure value! |
|
|
| 554 | </p> |
|
|
| 555 | |
|
|
| 556 | <pre caption="Configuring msmtp"> |
|
|
| 557 | $ <i>nano -w .msmtprc</i> |
|
|
| 558 | account default |
|
|
| 559 | host <i>smtp.your_provider.net</i> |
|
|
| 560 | from <i>your_username@provider1.net</i> |
|
|
| 561 | <comment>#see man page for more auth options</comment> |
|
|
| 562 | auth login |
|
|
| 563 | user <i>your_username</i> |
|
|
| 564 | password <i>your_password</i> |
|
|
| 565 | <comment>#If your SMTP Server supports TLS encryption, uncomment the next line |
|
|
| 566 | #tls</comment> |
|
|
| 567 | </pre> |
|
|
| 568 | |
|
|
| 569 | <p> |
|
|
| 570 | Now set the permissions of the file to a secure value: |
|
|
| 571 | </p> |
|
|
| 572 | |
|
|
| 573 | <pre caption="Setting the permissions for the configuration file"> |
|
|
| 574 | $ <i>chmod 600 .msmtprc</i> |
|
|
| 575 | </pre> |
|
|
| 576 | |
|
|
| 577 | <p> |
|
|
| 578 | Finally, edit or add the following line to <path>.muttrc</path> |
|
|
| 579 | </p> |
|
|
| 580 | |
|
|
| 581 | <pre caption="Using msmtp with Mutt"> |
|
|
| 582 | $ <i>nano -w .muttrc</i> |
|
|
| 583 | set sendmail="/usr/bin/msmtp" |
|
|
| 584 | </pre> |
|
|
| 585 | |
|
|
| 586 | <p> |
|
|
| 587 | Fire up <c>mutt</c> and send yourself a test email to see if it worked! See |
|
|
| 588 | the msmtp man page for more options and another example. |
|
|
| 589 | </p> |
333 | </p> |
| 590 | |
334 | |
| 591 | </body> |
335 | </body> |
| 592 | </section> |
336 | </section> |
| 593 | </chapter> |
337 | </chapter> |