GNU Mailutils Manual (split by section):   Section:   Chapter:FastBack: Programs   Up: Programs   FastForward: Libraries   Contents: Table of ContentsIndex: Function Index

3.7 movemail — Moves Mail from the User Maildrop to the Local File

The purpose of movemail, as its name implies, is to move mail from one location to another. For example, the following invocation:

movemail /var/mail/smith INBOX

moves messages from file /var/mail/smith to file INBOX.

The program was initially intended as a replacement for movemail from GNU Emacs. The movemail program is run by Emacs Rmail module. See Rmail in Reading Mail with Rmail, for detailed description of Rmail interface.

Mailutils version of movemail is fully backward-compatible with its Emacs predecessor, so it should run flawlessly with older versions of Emacs. Emacs versions starting from 22.1 contain improved Rmail interface and are able to take advantage of all new features mailutils movemail provides.

Apart from that use, movemail proved to be a useful tool for incorporating mail from remote mailboxes into the local one. See Fetching Mail with Movemail, for a detailed discussion with usage recipes.

3.7.1 Movemail Configuration

The following configuration file statements affect the behavior of movemail:

Movemail Config: preserve bool

If bool is ‘true’, do not remove messages from the source mailbox.

Movemail Config: emacs bool

If bool is ‘true’, output information used by Emacs rmail interface.

Movemail Config: ignore-errors bool

Continue moving messages after errors. By default, mailfromd exits immediately if it cannot copy a message.

Movemail Config: program-id fmt

Set program identifier, i.e. a string which will prefix all diagnostic messages issued by the program. By default, program name is used.

The fmt is a format string that may contain references to the following variables (see Configuration Variables):

progname

The program name.

source

URL of the source mailbox.

source_user

User part of the source mailbox URL.

source_host

Host part of the source mailbox URL.

source_path

Path part of the source mailbox URL.

dest

URL of the destination mailbox

dest_user

User part of the destination mailbox URL.

dest_host

Host part of the destination mailbox URL.

dest_path

Path part of the destination mailbox URL.

Setting program-id may be necessary if several movemail instances are run simultaneously (e.g. invoked from a script) to discern between the instances. For example:

program-id "${progname}: ${source} => ${dest}"
Movemail Config: sync mode

Sets the synchronization mode to use. Synchronization mode defines the algorithm movemail uses to decide whether the given message has already been downloaded. Used together with --keep it allows the user to download only recently delivered messages. See Synchronizatiom Mode, for a detailed description.

Allowed values for mode are all, uidnext, and uidl.

Movemail Config: uidl bool

Same as sync uidl, i.e. avoid copying the message if a message with the same UIDL already exists in the destination mailbox. See Synchronizatiom Mode, for a detailed description.

Movemail Config: verbose level

Set verbosity level.

Movemail Config: mailbox-ownership method-list

Define list of methods for setting ownership of the destination mailbox. The method-list argument can contain the following elements:

copy-id

Copy owner UID and GID from the source mailbox. This method works only with local mailboxes, i.e.: ‘mbox’ (UNIX mailbox), ‘maildir’ and ‘mh’.

copy-name

Get owner name from the source mailbox URL and obtain UID and GID for this user using mailutils authorization methods.

set-id=uid[:gid]

Set supplied uid and gid. If gid is not supplied, it is read from the /etc/passwd record for this UID.

set-name=user

Make destination mailbox owned by user.

Movemail Config: max-messages count

Retrieve no more than count latest messages.

By default, the number of messages is not limited.

Movemail Config: onerror actions

Defines what to do if an error occurs when transferring a message. actions is a list of one or more of the following keywords:

abort

Abort the transfer and terminate the program. This is the default action.

skip

Skip to the next message.

delete

Delete the affected message.

count

Count this message as processed.

Each keyword can be prefixed with ‘no’ to reverse its meaning.

The following standard Mailutils statements are supported:

StatementReference
debugSee The debug Statement.
tlsSee The tls Statement.
mailboxSee The mailbox Statement.
lockingSee The locking Statement.
pamSee PAM Statement.
sqlSee The sql Statement.
virtdomainSee The virtdomain Statement.
radiusSee The radius Statement.
ldapSee The ldap Statement.
authSee The auth Statement.

3.7.2 Setting Destination Mailbox Ownership

Editor’s note:

The information in this node may be obsolete or otherwise inaccurate. This message will disappear, once this node revised.

3.7.3 Synchronizatiom Mode

When given the --preserve option, movemail retains already downloaded messages in the source inbox. This means that called second time it will download both recently delivered messages and the ones it has already downloaded in the previous run. This makes little sense and a special option is provided to avoid this.

The --sync=mode defines synchronization mode, i.e. the algorithm that helps movemail decide whether a particular message has already been downloaded or not. If it has, movemail will skip that message.

The mode argument can be one of the following:

all

Assume each message is new. This is what movemail does when called without the --sync option.

uidnext
imap

Use the combination of uidvalidity and uidnext parameters of the source mailbox. This mode is mostly useful when the source is a remote mailbox accessed via IMAP4 protocol.

When using this method, movemail stores additional meta-information about each ‘source-destination’ pair of mailboxes in directory .movemail.sync, in the user’s home directory. The location of that directory can be changed using the --sync-dir option.

Example usage:

movemail --preserve --sync=uidnext imap://server mbox
uidl

Use uidl message identifiers. This method is useful if the source is a remote mailbox accessed via POP3 protocol.

3.7.4 Movemail Usage Summary

movemail [option...] inbox destfile [password]

The first argument, inbox, is the url (see Mailbox) of the source mailbox. The second argument, destfile, traditionally means destination file, i.e. the UNIX mailbox to copy messages to. However, mailutils movemail extends the meaning of this parameter. You may actually specify any valid url as destfile parameter.4.

For compatibility with older implementations of movemail, the source argument can also have the form:

po:username[:pop-server]

where pop-server is the IP address or hostname of a POP3 server to connect to and username is the name of the user on that server. The password is then supplied by the third argument.

It is equivalent to the following URL:

pop://username[:password]@pop-server

In fact, whenever source refers to a remote mailbox, the password argument can be used to pass the password. However, the safer ticket method is of course preferred.

Options are one or more of the following:

--emacs

Output information used by Emacs rmail interface.

--ignore-errors

Try to continue after errors.

--max-messages=count

Process at most count messages.

--notify

Enable biff notification.

--onerror=kw[,kw...]

What to do on errors. See onerror statement, for a description of kw.

-P modelist
--owner=modelist

Control mailbox ownership. modelist is a comma-separated list of one or more ownership change methods. See mailbox-ownership-methods, for a description of available methods.

This option is useful only when running movemail as root.

-p
--preserve
--keep-messages

Don’t remove transferred messages from the source mailbox. See also the --sync option, below.

--program-id=fmt

Set program identifier for diagnostics (default: the program name). See movemail-program-id, for a description of its argument.

-s
--sync=mode

Sets the synchronization mode, i.e. algorithm that defines whether a given message has already been downloaded. Used together with --preserve, it allows you to download only recently delivered messages, while not removing messages from the remote mailbox. See Synchronizatiom Mode, for a detailed description.

--sync-dir=dir

Supplies the name of a directory where synchronization metadata are kept. The default is ~/.movemail.sync.

-u
--uidl

Same as --sync=uidl, i.e. use UIDLs to avoid downloading the same message twice.

-v
--verbose

Increase verbosity level.

The common options are also understood (see Options That are Common for All Utilities.).

Footnotes

(4)

Rmail does not use this feature

GNU Mailutils Manual (split by section):   Section:   Chapter:FastBack: Programs   Up: movemail   FastForward: Libraries   Contents: Table of ContentsIndex: Function Index