Next Previous Contents

4. Getting Mail

4.1. Getting mail from a POP3 or IMAP server?

Date: June 20, 1998
Updated: April 21, 1999

To define a network mailbox for incoming mail, modify the `vm-spool-files' variable to include one or more POP or IMAP specification strings.

The POP specification is "server:port:authtype:username:password". The IMAP specification is similar, "imap:server:port:mailbox:authtype:username:password".

ArgumentDescription
serverHostname of your POP or IMAP server
portTCP port to connect to, usually 110 for POP and 143 for IMAP
mailboxName of the mailbox on the IMAP server, usually "inbox" for default IMAP maildrop
authtypeAuthentication method -- pass, rpop, or apop for POP and preauth or login for IMAP
usernameYour username on the POP or IMAP server
passwordThe password on the POP or IMAP server

Note that it is possible to use * for the password field and have VM prompt you for the password. This is the recommended method as it keeps your password secure.

For example:

(setq vm-spool-files (list
		      (concat "pop.example.com:110:apop:"
			      (getenv "USER") ":*")
		      (concat "imap:imap.example.com:143:inbox:login:"
			      (getenv "USER") ":*")))

If you get mail by POP, and want to use an external mail-filtering package, such as procmail, you can't use VM's POP capability. Please see the section on filtering, below, for more information.

4.2. Getting mail From a local spool directory

Date: June 20, 1998
Updated: February 7, 1999

Set the value of `vm-spool-files' to the location of your mail spool:

(setq vm-spool-files "/var/mail/username")

4.3. VM and Emacs seem to lock up occasionally

From: Bjorn Knutsson
Date: June 20, 1998

If you're fetching mail via the built-in POP or IMAP client, then Emacs will lock up while it is checking for new mail. If you're set up to automatically get mail via the vm-auto-get-new-mail variable, you may expect this, but if it is turned off, this lockup may catch you off guard.

The reason for the lockup is that VM is out checking for new mail. It won't actually fetch it, but it will still check every ten minutes (default). If you're currently online, the lockup caused by this check will be very short.

If, on the other hand, you are not currently connected, the lockup will last until the network connection times out or, if you're using a call on demand, will cause you to try connect to your ISP every ten minutes while you are reading mail.

Set vm-mail-check-interval and vm-auto-get-new-mail to nil to avoid the lockups. This, of course, also means that you will not be notified of new mail, and new mail will not be fetched automatically.

4.4. Why do I get the error message "movemail: Permission denied for lock file" when trying to get my mail?

Date: June 20, 1998

When I wanted to get incoming mail, vm said that it couldn't:

movemail: Permission denied for lock file--see source file lib-src/movemail.c

movemail exited with code 1

VM uses the movemail program to move mail from your spool file to the crash box, and then picks up the mail from the crash box. (This is necessary to reconcile emacs' view of file locking with the mail system's view of file locking.) In order for this to work, movemail must be able to read and write to your spool file, in your mail spool directory.

The error message means movemail could not create the lock file in your mail spool because it lacked sufficient privilege. movemail needs to be installed with permissions similar to those of other programs that do I/O in the mail spool. Typically this means either setuid root or setgid mail. Your system administrator should be able to handle this for you.

4.5. Using VM with qmail-style mail directories

From: Arnaldo Mandel
Date: June 20, 1998
Updated: October 7, 2003

Arnaldo Mandel provided the following suggestion on using VM on a system where the MTA is qmail. More information about using VM with qmail is available in section 7.7.

I have been using maildirs for spool for some time now, with VM, with no glitches. Actually, occasionally I used qail (a wrapped call to Unix Mail), which moves the spool to an mbox file - VM can successfully retrieve mail both from maildir and mboxes.

Below is a recipe I posted some time ago on the qmail list. Perhaps it can (suitably edited) become part of the distribution (or FAQ). Note that this has nothing to do with support of maildirs as folders.


Next Previous Contents