Re: Gnus as a mailer
ME? <firstname.lastname@example.org> writes:
> I've been using mh for a while now, and even though it's super functional,
> I'd like to try something else. Soooo.... I look at the headers on this list
> and lots of people seem to be using Gnus as a mailer. Is there a page
> detailing how to do this? There is breif mention in the info pages, but not
> enough to get me going.
Ask and ye shall receive :>
[I have sent this out to several people, feel free to send
corrections/suggestions if you have any. Much of this may actuaally
be covered by the GNUS FAQ, but I haven't looked yet. It's intended
to cover some things like mail group levels that might catch the
Feel free to ask if you have any questions. Some of this was oriented
toward someone who was interested in compatibility with mh.
Gnus supports a number of backends for mail. It can handle RMAIL, mh,
etc, but I would recommend that you switch to using the nnml back end.
It's much faster since it generates NOV overview databases (the same
ones used by news servers) for all the mail folders. Other than that
it stores mail just like mh, one message per file. Makes scripting
over messages easy, but it can be hard on the inodes :>
I think that nnml is compatible with mh, but only if you don't use
both at the same time. I think that gnus won't notice changes made by
mh with this method until restart and vice versa.
I'f you're already using mh, you don't have to do anything special to
use nnml other than tell gnus to use it. It will then run over your
mh heirarchy and automatically generate the databases. That's what I
did. All my code assumes you are using nnml, but that should only be
an issue in a couple of places where I set up the mail group servers.
I'm going to assume for now that you don't want to use the bleeding
edge release, and that the one that came with your emacs is OK. Is it
at least emacs-19.31.1? If not, you may need the newer version of
Gnus (or emacs). I have info below about how to upgrade to the
bleeding edge if you're interested. I'm using Red-Gnus (sgnus)
0.70 to write this and it works great.
The primary distinction Gnus draws between mail and news groups is
relates to how it handles deleted (or read) messages. News articles
(as you probably know) usually automatically expire at some point on
the upstream news server. This is fine for news, but not good for
your personal email. So the normal rule in Gnus is: "if it's a mail
group, never delete anything unless specifically told to, and then
only after the expiration period."
You expire mail articles with "E" in the summary buffer. The default
expire period is two weeks. If any article is two weeks old and has
been expired, then it is deleted. This is kind of nice if you later
(within two weeks) decide you really did need some old message. Also,
expired articles (until their deletion) still show up in threading
You should also look in the info pages (gnus' are quite complete, Lars
is insanely prolific) at the section on "Topics". This allows you to
organize your groups in collapsible outline form.
With respect to file system layout, I have my groups set up like this:
~/Mail/Incoming/inbox (incoming mail that doesn't go anywhere else)
~/Mail/Incoming/debian-bugs (debian bug list)
~/Mail/Incoming/debian-user (debian user list)
~/Mail/Incoming/... (other assorted mail groups)
and for outgoing stuff:
this used to be the default in gnus, but in the latest version, it
saves no outgoing mail by default, so I explicitly enable this in my
.emacs (segment shown below).
For news (don't forget to check out the info pages on persistent
articles and asynchronous fetching -- too cool):
~/News/... (all Gnus related stuff for *incoming* news goes here)
Note that it might make more semantic sense for misc-news (outgoing
news i.e. posts) to go under ~/News, but it turns out that would be
pretty awkward to manage with the way Gnus wants to handle things
right now. I don't think you could do it without more hassle than
it's worth. One of the advantages to the way I have it now is that
all personal writings are in one subdir.
A couple of other things of note. If you just want to read mail,
without going through the time consuming (at 28.8) process of
contacting the news server and getting the current news group status,
you just use M-x gnus-no-server instead of M-x gnus to launch gnus.
One caveat, you might notice that all of the mail groups vanish along
with the news groups when you do this (i.e. when you run
gnus-no-server). That's just because groups have levels of
"activeness", and gnus-no-server only shows groups of level 2 or
lower. Unfortunately all groups, including mail groups, are created
at level 3 by default, so they vanish with gnus-no-server. To see
them again, you just need to launch gnus the old fashioned way (M-x
gnus) and then use the set level command to set the level of all your
mail groups to 2. You can set the levels via "S l" with the cursor on
the relevant group in the Group buffer.
In order to actually get your mail, you might be able to use pop
directly from gnus (I think that's supported now, but I'm not sure).
However, I just use popclient to grab my mail from all the relevant
machines and drop it popclient's default location (my normail system
mail box), and then let gnus suck up the mail from there, which it
will do by default. This has the advantage of initially dropping your
mail in the location where all mail programs will look for incoming
mail by default, so that shells and alert programs don't have to be
customized to know that your mail comes to a weird location in order
to be able to alert you. Not a big deal, but somewhat nice if you
automate popclient to run periodically in the background.
Gnus automatically gets your new mail when you launch it, but if you
want to incorporate all the new mail that has accumulated since
launching gnus, you can use "g" from the group buffer which updates
all the mail and news groups, or "2 g" which only does groups level 2
or higher, i.e. the mail groups. (There are other commands too, see
M-g, for example, which works from a mail summary buffer).
Incoming mail is split into sub-groups (if you want) via
gnus-nnmail-split-methods. There's an example below. It will
automatically create a new group when it needs one according to the
rules and the content of the incoming mail.
Gnus can also recognize most duplicates in incoming mail. It does
this by keeping a cache of article numbers. It can be told to delete
them, but I have it shunt them to a separate group instead using the
I hope I anticipated all your problems, but if not, feel free to ask
me any questions. I would, of course, recommend first backing up your
mail setup just in case.
Here's the Gnus relevant bits from my .emacs. Note that there are a
couple of places where I have either "osiris" or my name. You'll need
to change all those. Make sure you do this *before* the first time
you run gnus. Some of the things it does are hard to undo without
starting over with an empty .newsrc.eld
Also, be warned, this is not necessarily organized in any particular
fashion, except that I moved most of the stuff that I could find that
you *must* change to the beginning.
=== Begin gnus .emacs stuff
;; I like these, and they affect gnus too.
(setq-default tab-width 2)
;;; Gnus setup
;; You have to change these:
;; Your primary server
(setq gnus-select-method '(nntp "newshost.cc.utexas.edu"))
;; So the server will accept me
(setq gnus-local-domain "cs.utexas.edu")
;; So the from field will be reasonable.
(setq gnus-user-from-line "Rob Browning <email@example.com>")
(setq user-mail-address "firstname.lastname@example.org")
(setq gnus-local-organization "The University of Texas at Austin")
;; Change the name osiris below to whatever you like. As far as gnus
;; is concerned, it's the name of the mail server as seen in the group
;; "server" for all incoming mail
;; "server" for all outgoing mail and news
;; Change this to be whatever you like, but make sure that the last
;; item in the list has an empty regex. That's where all the
;; unmatched mail goes. If you don't, gnus will happily trash the
;; mail that doesn't match a regex.
("debian-bugs" "^Subject: Bug#[0-9]+:")
("debian-bugs" "^Subject: Re: Bug#[0-9]+:")
("debian-bugs" "^X-Mailing-List: <email@example.com>")
;("debian-bugs" "^Subject: \\(Re: \\)?Bug#[0-9]+:")
("debian-private" "^X-Mailing-List: <firstname.lastname@example.org>")
("debian-user" "^X-Mailing-List: <email@example.com>")
("debian-changes" "^X-Mailing-List: <firstname.lastname@example.org>")
("debian-devel" "^X-Mailing-List: <email@example.com>")
("debian-devel" "^X-Mailing-List: <firstname.lastname@example.org>")
("executor" "^Sender: email@example.com")
("guile" "^Sender: firstname.lastname@example.org")
("pioneer-users" "^Sender: email@example.com")
;; This is *only* if you want to use the latest gnus, and you build it
;; in the directory mentioned. (also see the footnote*** at the end.)
;; (cons (expand-file-name
;; This is stuff that you probably want, but don't have to change.
;; Very nice...
(setq gnus-asynchronous t)
;; Make all new groups zombies. You can peruse them at your leisure
;; (with "A z" from the group buffer) and either subscribe (with "u",
;; from the group buffer. It's a toggle) or kill them (C-k) as
(setq gnus-subscribe-newsgroup-method 'gnus-subscribe-zombies)
;; All kinds of good config stuff. I think you can leave this alone
;; until/unless you feel like figuring it out.
(setq gnus-check-new-newsgroups 'ask-server)
(setq gnus-save-newsrc-file nil)
(setq gnus-extract-address-components 'mail-extract-address-components)
(setq gnus-auto-select-next t)
(setq gnus-auto-select-same t)
(setq gnus-use-cross-reference 'all)
(setq gnus-auto-select-newsgroup nil)
(setq gnus-summary-check-current t)
(setq gnus-fetch-old-headers 'some)
(setq gnus-thread-hide-subtree t)
(setq gnus-thread-indent-level 2)
(add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
(setq gnus-use-cache 'passive)
(setq gnus-permanently-visible-groups "^nnml+")
(setq gnus-build-sparse-threads 'some)
(setq gnus-keep-backlog 50)
;; Tell gnus where to put outgoing copies
;;; Score file stuff
(setq gnus-kill-killed t) ;; so you can re-kill a set of articles
;; Change this as indicated in the info pages if you actually want
;; gnus to delete the duplicates.
(setq nnmail-delete-duplicates 'warn)
;; Good for 8-bit displays.
'("\\.\\(jpe?g\\|gif\\|tiff?\\|p[pgb]m\\|xwd\\|xbm\\|pcx\\)$" "xv -8")))
=== End gnus .emacs stuff
*** If you do want the bleeding edge gnus, you need to uncomment the
relevant bit in the .emacs code above, build the latest version in the
directory mentioned, and add the following to your .bashrc:
so you get the right info pages. Note that you can't just add to your
because the environment variable is not normally set at all. Info has
defaults that it uses if there's no INFOPATH.
Hope this helps
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-REQUEST@lists.debian.org . Trouble? e-mail to Bruce@Pixar.com