Latest

Archive

Community news

C++

Communities and Content

Databases

Editorials

Emacs

General

HTML

Java

Notices

PHP

XML

Apache

C++

Database

General

HTML

Java

Javascript

Linux

Object oriented programming

Open source

Perl

PHP

Python

Ruby

SOAP

XML

Suggest a link

Advertise on zez

Contribute

Contact us

About zez


Using Emacs for reading mail - Part 1



Configuring IMAP

Not all of you use POP3 for mail reading mail, some of you, like me, use IMAP. I'll explain how this is done with Emacs.

There's one thing you need to be aware of, and that is that the IMAP handler in Gnus does not use a POP3 server for incoming mail, instead it relies on you having the mail box on the server running IMAP. This means that you have to use external programs for fetching the mail before Gnus handles it, one such program is fetchmail.

To read mail from an IMAP server you need to know the name of the server, your username and your password. Both the username and password will be asked by Gnus each time your restart after adding an IMAP server, however we don't want to answer them each time. Gnus will read the content of the file .authinfo in your home directory to find servers, usernames and their passwords.

For instance let's create this file with some content, we'll pretend we got our mail on a server called imap.mail.server, our username is imap.user and password is secret. The file will then look like this:

machine "imap.mail.server" login "imap.user" password "secret"

Now change the server, user name and password to something that fits you.
I also suggest you change the permissions on the file to avoid any other users on the system to read it, you can do that by issuing the command

chmod 0600 ~/.authinfo

If you're very worried about security you can easily omit the password section in the file, in that case you will need to enter the password on each Gnus session.

The next thing you should do is tell the IMAP program to filter out certain files on the server, usually you have your mail in a file called mbox, sometimes you keep them in a directory called mail. From what I've understand there's no defined standard for this so you just use what fits you. For instance we might configure IMAP to only show the mbox and any files in the mail directory, this leads to:

(setq nnimap-list-pattern
      '("mbox" "mail/*"))

Enter this into your .gnus file and press r to re-read it.

Now we're ready to add our very first IMAP server, first make sure you're in the Gnus group buffer. Press B to browse a foreign buffer. You'll first be asked for a backend, enter mmimap and press enter. Then enter the server name as the address and press enter. If everything works out succesfully you should be left with a list looking something like this:

K      2: mbox

Each line represents a mail group and how many mails it has. To add a mail group to your group list you move the cursor over it and press u which subscribes it, press u once again to unsubscribe. Once you're happy with your choice you press q which returns you to the group listing with your new IMAP groups. To refresh their content press g.

Now for the last touch on IMAP groups, we want to split mails from the incoming mail box to various groups. All your incoming mail is usually put in /var/spool/mail/username where username is your login name on the IMAP server(The very same as used earlier), and we want to move this mail to our groups. We start by specifying were we get the mail:

(setq nnimap-split-inbox '("/var/spool/mail/imap.user"))

If you want to you can specify more than one incoming mail box.
Next we define the splitting rules for the mail, for instance:

(setq nnimap-split-rule
      '(("INBOX.junk" "^Subject: .*bugs")
        ("mbox" ".*")))

This moves all mail with bugs in the subject to a junk group and all the rest to the mbox. As stated in split rules for the POP3 mail the right hand filter portion uses Regular Expressions for matching text which are explained in this article.

Now you're ready for reading mail from both POP3 and IMAP and at the same time filtering out the bad mail.

And remember "No Gnus is bad news".


<< Previous page | 1 | 2 | 3 | < 4 > | Printer-friendly page |

Comment List


There are no comments.


Forgot your password?

Register a new user

Results

Polls