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".
| Argument | Description |
| server | Hostname of your POP or IMAP server |
| port | TCP port to connect to, usually 110 for POP and 143 for IMAP |
| mailbox | Name of the mailbox on the IMAP server, usually "inbox" for default IMAP maildrop |
| authtype | Authentication method -- pass, rpop, or apop for POP and preauth or login for IMAP |
| username | Your username on the POP or IMAP server |
| password | The 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.
Set the value of `vm-spool-files' to the location of
your mail spool:
(setq vm-spool-files "/var/mail/username")
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.
movemail:
Permission denied for lock file" when trying to get my mail?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.
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.
MAILDIR2MBOX and
MOVEMAIL.
#!/bin/sh # Time-stamp: <97/02/21 16:25:38 am@ime.usp.br [rebutosa]> # # mvmail: maildir2mbox wrapper for compatible invocation as movemail. # If the mailbox is a directory, calls maildir2mbox, otherwise # call movemail. # maildir2mbox reliably offloads a maildir into a mbox file (comes with qmail) MAILDIR2MBOX=/var/qmail/bin/maildir2mbox # movemail reliably moves a mbox file (comes with emacs) MOVEMAIL=/usr/gnu/bin/movemail if [ $# != 2 ] then echo "$0: wrong number of parameters." exit 1 fi if [ -d $1 ] then # The construction of MAILTMP tries to be viable in a short-filenames # environment; otherwise, tacking stuff on the back of $2 would suffice. # Does it matter? export MAILDIR MAIL MAILTMP MAILDIR=$1 MAIL=$2 MAILTMP=`dirname $2`'/@@'`basename $2` exec $MAILDIR2MBOX else exec $MOVEMAIL $1 $2 fi
.vm
file, where xxx should be substituted by a path to the script.
(setq vm-movemail-program "xxx")
(setq vm-spool-files
(list
;; this allows using qail as stopgap
;; reader behind an unreliable connection
(or (getenv "MAIL") "~/Mailbox")
(or (getenv "MAILDIR") "~/Maildir"))
vm-make-spool-file-name 'folder-maildir)
; The mail folders live in a directory, specified in
; `vm-folder-directory'. The maildirs for the several mailing lists I
; subscribe to live in subdirectory Dir of this same directory, and
; have the same name as the corresponding folders.
(defun folder-maildir (folder)
(concat (file-name-directory folder) "Dir/" (file-name-nondirectory folder)))
(defun folder-crash (folder)
(concat folder ".CRASH"))