Skip to main content

33.19 Retrieving Mail from Remote Mailboxes

Some sites use a method called POP3 for accessing users’ inbox data instead of storing the data in inbox files. The Mailutils movemail by default supports POP3 with TLS encryption. Warning: Although the Emacs movemail supports POP3, its use for this is not recommended since it does not support encrypted connections—the Mailutils version does. Both versions of movemail work only with POP3, not with older versions of POP.

You can specify a POP3 inbox by using a POP3 URL (see Movemail). A POP3 URL is of the form ‘pop://username@hostname:port’, where hostname and port are the host name (or IP address) and port number of the remote mail server and username is the user name on that server. Additionally, you may specify the password in the mailbox URL: ‘pop://username:password@hostname:port’. In this case, password takes preference over the one set by rmail-remote-password (see below). This is especially useful if you have several remote mailboxes with different passwords. If using Mailutils movemail, you may wish to use ‘pops’ in place of ‘pop’.

For backward compatibility, Rmail also supports an alternative way of specifying remote POP3 mailboxes. Specifying an inbox name in the form ‘po:username:hostname:port’ is equivalent to ‘pop://username@hostname:port’. If you omit the :hostname part, the MAILHOST environment variable specifies the machine on which to look for the POP3 server.

Another method for accessing remote mailboxes is IMAP. This method is supported only by the Mailutils movemail. To specify an IMAP mailbox in the inbox list, use the following mailbox URL: ‘imap://username[:password]@hostname:port’. The password part is optional, as described above. You may wish to use ‘imaps’ in place of ‘imap’.

Accessing a remote mailbox may require a password. Rmail uses the following algorithm to retrieve it:

  1. If a password is present in the mailbox URL (see above), it is used.
  2. If the variable rmail-remote-password-required is nil, Rmail assumes no password is required.
  3. If the variable rmail-remote-password is non-nil, its value is used.
  4. Otherwise, Rmail will ask you for the password to use.

If you need to pass additional command-line flags to movemail, set the variable rmail-movemail-flags a list of the flags you wish to use. Do not use this variable to pass the ‘-p’ flag to preserve your inbox contents; use rmail-preserve-inbox instead.

The movemail program installed at your site may support Kerberos authentication. If it is supported, it is used by default whenever you attempt to retrieve POP3 mail when rmail-remote-password and rmail-remote-password-required are unset.

Some POP3 servers store messages in reverse order. If your server does this, and you would rather read your mail in the order in which it was received, you can tell movemail to reverse the order of downloaded messages by adding the ‘-r’ flag to rmail-movemail-flags.

Mailutils movemail supports TLS encryption. If you wish to use it, add the ‘--tls’ flag to rmail-movemail-flags.