Gnus for Mail and Newsgroups

A tutorial for using and configuring Gnus in Emacs that can make your inbox a cleaner and much more efficient place.

E-mail has become an integral part of our lives. Many of us spend several hours reading it each day. Adding Netnews newsgroups to the mix only increases the burden. Many tools are available to help us manage and pre-sort e-mail and Netnews. One of the best is Gnus (pronounced guh-NEWS), which is included in the Emacs editor utility.

For some people (such as myself) receiving several hundred e-mail messages a day is not uncommon. Some are from friends and family; some relate to work. Dozens each day are from the several mailing lists I subscribe to, mostly technical one. And let's not forget the daily frying pan full of spam.

Separating the wheat from the chaff is time consuming. More importantly it is mistake prone. What if I miss an important message from an editor or, even worse, my mother?

Netnews Adds to the Flow

The arrival of Netnews in the early eighties was one of the first really useful innovations in the virtual world. The Netnews system allowed thousands, and now millions of people, to form communities of common interest. Whether your interest is antiques, Fortran programming or bizarre sexual practices, you can find a newsgroup. Today, the Netnews system is bigger and more comprehensive than ever. In fact, my server lists over 37,000 different newsgroups.

E-mail and newsgroups can provide us with the most important commodity of our age: information. This quantity of information is too overwhelming to take on without some advanced tools.

Gnus: A Single Powerful Interface for Mail and News

The Gnus mail and news reader provides a single powerful interface to all of the information available out there. As a news reader it is similar to many others, showing the groups and the number of new messages in each. Selecting a group shows the subject lines of the postings. Replies to a posting are shown directly beneath that posting. This is called threading, because it makes it easier to follow the threads of conversation in the cacophony of a newsgroup.

It is as a mail reader that Gnus really shines. It allows you to set up any number of mail groups. Incoming mail messages are automatically categorized according to the rules you've established. From that point onwards, mail is treated like Netnews, and each mail category contains a threaded list of the messages.

So if I get 100 e-mails, I will still be able to spot my Mom's: hers end up in the Family group. Spam, on the other hand (if I manage to detect it) will end up in my Junk group. Mailing list traffic ends up in a Mail group. It's as if the mailing list were a newsgroup.

All these groups are tremendously useful when it comes time to search for some old e-mail message. For instance, finding old messages from friends is easy because their e-mail is all grouped together. I also can keep weeks of mailing list traffic on my computer, and it never gets in the way.

Getting Emacs

Emacs is a freely available text editor originally written by Richard Stallman, geek extraordinaire and founder of the Free Software Foundation. Emacs is one of Stallman's first and best contributions to free software. A programmers' editor, it is a superb tool for producing and working with source code in any computer language.

Many UNIX systems come with Emacs already installed. To check, type Emacs on the command line. If Emacs starts up, note the version, which should be on the start-up screen. (Or select Show Emacs Version from the Help menu). If it is not at least version 20.something, you may want to ask your system administrator to install the latest version. It can be found at www.gnu.org/directory/All_GNU_Packages/emacs.html.

Once you have Emacs running on your system, you can start to configure it to read mail and news. To learn more about using Emacs, consult the Emacs Tutorial in the Help menu.

Configuring Gnus for Newsgroups

Gnus can be configured for just about every possible situation. Below I will describe the configuration for one particular situation: connecting a home machine to an ISP.

Configuring Netnews is simple. Find out the name of your news server, and then insert the following code into the .gnus file (if it doesn't exist, then create it; it's an ASCII file in your home directory.)

; Tell Gnus about the news server.
(setq gnus-select-method '(nntp "newsserver.your-isp.com"))

The .gnus file is interpreted by Emacs as Lisp, a programming language intimately associated with Emacs. The semi-colon is a comment delimiter, indicating that everything following it on the line is a comment.

Also while you are editing the .gnus file, add the following lines, substituting your name and e-mail address for mine.

(setq user-full-name "Ed")
(setq user-mail-address "ed@telestoconsulting.com")

Once you've added that information, fire up your dial-up connection. Select Read Net News from the Tools menu, and Gnus will start. It will connect to your server and download the list of all available newsgroups (this process can take a few minutes.) Then it will subscribe you to one or two by default and display them.

Select Listing -> List Active File from the Groups menu, which tells Gnus to download and display the entire list of groups available. Search for groups of interest by using Ctrl-S (Control+s) and then typing the string you are searching for. Use the return key to end the search. To subscribe to the groups you've selected, put the cursor on the line with the newsgroup and select Toggle subscription from the Group menu.

If you already know the name of the group you want to join, select Subscribe -> Subscribe to a group from the Groups menu. You will be prompted for the name of the group.

Once you've subscribed to a few groups, select Listing -> List unread subscribed groups from the Groups menu. You will see all the groups you subscribed to, with the number of unread message in each.

To read the message headers of a specific group, put the cursor on the group line and use Select from the Group menu. You'll see the name of the poster and the subject line for all the messages in the group. Move the cursor around the Subject buffer, and press the space bar to view an article if it looks interesting.

You can take a look at the Article menu to see the wide varieties of ways in which you can respond to a message. But don't try and send any mail yet--we still have some setup to do before we're ready for that.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Gnus for Mail and Newsgroups - HTML?

Anonymous's picture

Can gnus now display mail with html in it? That one problem I found with using it in the past....

Re: Gnus for Mail and Newsgroups

dsaklad's picture

How would you make it easier for nonprogrammers to set up gnus email ?... What's available on the web currently still requires knowledge that once it's set up that knowledge isn't critical to operating gnus email.

For example, I've set up gnus newsgroups. Now, how do I get gnus email set up?... Step by step instructive comments are needed that can be followed by nonprogrammers unfamiliar with the jargon.

oo__ dsaklad@gnu.org

See also
[ http://groups.google.com/groups?as_q=saklad&safe=off&ie=ISO-8859-1&as_ugroup=gnu.emacs.gnus&lr=&as_scoring=d&hl=en ]

How to make gnus email setup automatic or nearly automatic.

dsaklad's picture

How would you make it easier for nonprogrammers to set up gnus email ?... What's available on the web currently still requires knowledge that once it's set up that knowledge isn't critical to operating gnus email.

For example, I've set up gnus newsgroups. Now, how do I get gnus email set up?... Step by step instructive comments are needed that can be followed by nonprogrammers unfamiliar with the jargon.

oo__ dsaklad@gnu.org

See also
[ http://groups.google.com/groups?as_q=saklad&safe=off&ie=ISO-8859-1&as_ugroup=gnu.emacs.gnus&lr=&as_scoring=d&hl=en ]

Re: Gnus for Mail and Newsgroups

Anonymous's picture

Oops...I posted a reply instead of a new comment. Duh! So...How do you handle spam messages that are uuencoded? We are noticing that the spammers have caught on to the word and phrase based delivery rules which we use to eliminate spam. To thwart the delivery rules, they uuencode their messages. Is there a way to first decode the message then pass it to their delivery rules

Re: Gnus for Mail and Newsgroups

Anonymous's picture

Minor correction about regular expressions: A period (.) means "any character" not "any number of the following character." A star (*) means "any number of the _previous_ character".

Re: Gnus for Mail and Newsgroups

Anonymous's picture

How do you handle spam messages that are uuencoded? We are noticing that the spammers have caught on to the word and phrase based delivery rules which we use to eliminate spam. To thwart the delivery rules, they uuencode their messages. Is there a way to first decode the message then pass it to their delivery rules?

Re: Gnus for Mail and Newsgroups -- great article!

Anonymous's picture

I've been using Gnus for about a year. I thought this article was a good general overview of Gnus. Thanks!

Re: Gnus for Mail and Newsgroups -- great article!

Anonymous's picture

I've been using Gnus since 95/96, and have lately tried to get away from it. You know what? It's impossible! I've yet not found any other mail/news client that gives me the same flexibility as Gnus have. Sure, most of the other are better looking, but they dont have the same feature richness as Gnus.

Re: Gnus for Mail and Newsgroups -- great article!

Anonymous's picture

Sylpheed is catching up though (for those that like a GUI MUA)

Re: Gnus for Mail and Newsgroups -- great article!

Anonymous's picture

Can sylpheed do article expiry as this is a major selling pint for gnus for people subscribed to big lists

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix