ViewMailAndImap

No matter whether you use local folders or server folders, VM wants you to specify the IMAP server info in this format

      imap:HOST:PORT:MAILBOX:AUTH:USER:PASSWORD

So what are all those code words out there?

imap is server type you are using. If your server administrator wants to you to use “imap over SSL” then you write imap-ssl instead. (“SSL” is the secure sockets layer of Internet communication, which sends data in an encrypted form so that third parties can’t snoop around.)

HOST is the server address such as pop.yahoo.com or pop.gmail.com.

PORT is the port number on which you talk to the server. For imap, it is normally 143. For imap-ssl, it is normally 993. If your server administrator wants you to use some other port number, they should tell you.

MAILBOX is the mailbox or folder that this long-winded phrase is referring to. For the main folder, you use inbox. When you need to talk about the entire IMAP account without referring to any folder in particular, you use *.

AUTH is the “authentication” method, normally login. If your server administrator wants you to use something else, they should tell you. Look up in the VM manual how to implement the other methods. (They are not as straightforward as the login method.)

USER is your user name.

PASSWORD is your password. Normally, you put * here and VM understands that you don’t want to throw around your passwords. It will prompt you to enter it in the minibuffer.

Phew!

Examples

     (setq vm-imap-account-alist
           '(
             ("imap-ssl:mail.foocorp.com:993:*:login:becky:*" "becky")
             ("imap:crickle.lex.ky.us:143:*:login:becky:*" "crickle")
            )
     )

Becky is trying to use two IMAP accounts, one at mail.foocorp.com which is using a secure protocol (imap-ssl). She wants to call this account “becky”. The second account at crickle.lex.ky.us is using an insecure communication protocol. She is calling it “crickle”. Note that the MAILBOX part in both the cases is *. (Becky is naming the entire IMAP accounts, not any particular folders.) She can look at her inbox at her work account by typing:

     M-x vm-visit-imap-folder RET becky:inbox RET

and she can look at her “finances” folder at cricke by typiong:

     M-x vm-visit-imap-folder RET becky:finances RET

If she wants to use her inbox at work account as the main inbox, she can put in her .vm file:

    (setq vm-primary-inbox "imap-ssl:mail.foocorp.com:993:inbox:login:becky:*")

This refers to the inbox folder on foocorp, specifically. We can’t use * as the MAILBOX here. Once this is done, she can just use M-x vm to read her inbox at work.

IMAP as mail spool

If you want to download your mail to a local folder and delete it from the server, you can do so by specifying vm-spool-files. This can be configured using, for example:

    (add-to-list 'vm-spool-files
                 '("~/mail/IMAP-INBOX"
                   "imap-ssl:HOST:PORT:MAILBOX:AUTH:USER:PASSWORD"
                   "~/mail/IMAP-INBOX.CRASH"))

If PASSWORD is given as *, it will be prompted for the first time that mail is retrieved.

To delete the messages from the server after downloading, put this in your .vm file:

    (setq vm-imap-expunge-after-retrieving t)

If you want to control this on per-mailbox basis, you can configure vm-imap-auto-expunge-alist.

Other variables controlling IMAP spool files include:

    vm-imap-bytes-per-session
    vm-imap-max-message-size
    vm-imap-messages-per-session

CategoryViewMail