VM can also use the IMAP protocol to access a mailbox on a remote
host. As with POP, instead of specifying a spool file name in
the vm-spool-files
definition, you would give a string that tells
VM host to access to remote maildrop.
An IMAP maildrop specification has the following format:
``imap:HOST:PORT:MAILBOX:AUTH:USER:PASSWORD''
HOST is the host name of the IMAP server.
PORT is the TCP port number to connect to (should normally be 143).
MAILBOX is the name of the mailbox on the IMAP server. This should
be `"inbox"
', to access your default IMAP maildrop on the
server.
AUTH is the authentication method used to convince the server
you should have access to the maildrop. Acceptable values are
`"preauth"
' and `"login"
'. `"preauth"
' causes VM to skip the
authentication stage of the protocol with the assumption that
the session was authenticated in some way external to VM. The
hook vm-imap-session-preauth-hook
is run, and it is
expected to return a process connected to an authenticated
session. The other value, `"login"
', tells VM to use the IMAP LOGIN
command for authentication.
USER is the user name sent to the server for `"login"
' style
authentication.
PASSWORD is the secret shared by you and the server for
authentication purposes. If the PASSWORD is `*
', VM
will prompt you for the password the first time you try to
retrieve mail from the maildrop. If the password is valid, VM
will not ask you for the password again during this Emacs
session.
By default VM will retrieve all the messages from a IMAP maildrop
before returning control of Emacs to you. If the maildrop is
large, the wait could be considerable. If you set
vm-imap-max-message-size
to a positive numeric value, VM will not
automatically retrieve messages larger than this size. If VM is
retrieving messages because you invoked vm-get-new-mail
interactively, then VM will ask whether it should retrieve the
large message. If VM is retrieving messages automatically
(e.g. vm-auto-get-new-mail
is set non-nil
) then VM will skip the
large message and you can retrieve it later.
The variable vm-imap-messages-per-session
controls how many messages
VM will retrieve from a IMAP maildrop before returning control to
you. Similarly, the variable vm-imap-bytes-per-session
limits the
number of bytes VM will retrieve from a IMAP maildrop before returning
control to you. By default, the value of both variables is nil, which
tells VM to retrieve all the messages in the IMAP maildrop regardless
of how many messages there are and how large the maildrop is.
After VM retrieves messages from the maildrop, the default action
is to delete the messages from there. If you want VM to leave
messages in the remote maildrop until you explicitly request
their removal, set vm-imap-expunge-after-retrieving
to
nil
. Messages will not be removed from the maildrop until you
run vm-expunge-imap-messages
; only those messages that VM has
retrieved into the current folder will be expunged.
The variable vm-imap-auto-expunge-alist
gives you a way to specify
on a per-maildrop basis which IMAP maildrops have message
automatically removed when retrieved and which ones leave the
messages on the IMAP server. The value of
vm-imap-auto-expunge-alist
should be a list of IMAP mailboxes and
values specifying whether messages should be automatically
deleted from the mailbox after retrieval. The format of the list
is:
((MAILBOX . VAL) (MAILBOX . VAL) ...)
MAILBOX should be an IMAP maildrop specification as described
in the documentation for the variable vm-spool-files
. If
you have the IMAP password specified in the vm-spool-files
entry, you do not have to specify it here as well. Use `*
'
instead; VM will still understand that this mailbox is the same as
the one in vm-spool-files
that contains the password.
VAL should be nil
if retrieved messages should be left in the
corresponding IMAP mailbox, t
if retrieved messages should be
removed from the mailbox immediately after retrieval.
Here is an example:
(setq vm-imap-auto-expunge-alist '( ;; leave message on the server ("imap:odin.croc.net:143:inbox:login:kyle:*" . nil) ;; expunge immediately ("imap:hilo.harkie.org:143:inbox:login:kyle:*" . t) ) )