Current File : //usr/local/apps/dovecot/share/man/man1/doveadm-import.1
.\" Copyright (c) 2010-2018 Dovecot authors, see the included COPYING file
.TH DOVEADM\-IMPORT 1 "2015-08-09" "Dovecot v2.3" "Dovecot"
.SH NAME
doveadm\-import \- Import messages matching given search query
.\"------------------------------------------------------------------------
.SH SYNOPSIS
.BR doveadm " [" \-Dv "] " import " [" \-S
.IR socket_path ]
.RB [ \-U
.IR source_user ]
.RB [ \-s ]
.I source_location dest_parent search_query
.br
.\"-------------------------------------
.BR doveadm " [" \-Dv "] " import " [" \-S
.IR socket_path ]
.RB [ \-U
.IR source_user ]
.RB [ \-s ]
.BI \-A " source_location dest_parent search_query"
.br
.\"-------------------------------------
.BR doveadm " [" \-Dv "] " import " [" \-S
.IR socket_path ]
.RB [ \-s ]
.BI \-F " file source_location dest_parent search_query"
.br
.\"-------------------------------------
.BR doveadm " [" \-Dv "] " import " [" \-S
.IR socket_path ]
.RB [ \-U
.IR source_user ]
.RB [ \-s ]
.BI \-u " user source_location dest_parent search_query"
.\"------------------------------------------------------------------------
.SH DESCRIPTION
This command can be used to import mails from another mail storage specified by
.I source_location
to one or more user\(aqs mailboxes. All the mailboxes are imported under the
given
.I dest_parent
mailbox, or to root level if
.I dest_parent
is empty (\(dq\(dq). The
.I search_query
can be used to restrict which mailboxes or messages are imported. By default
the import is done in destination user's context, you can use \-U to change
this.

In the first form,
.BR doveadm (1)
will executed the
.B import
action with the environment of the logged in system user.
.PP
In the second form, the mails will be imported for all users.
.PP
In the third form, the mails will be imported for all users listed in the
given
.IR file .
.PP
In the fourth form, the mails will be imported only for given
.IR user (s).
.\"------------------------------------------------------------------------
.SH OPTIONS
Global
.BR doveadm (1)
.IR options :
.TP
.B \-D
Enables verbosity and debug messages.
.TP
.BI \-o\  setting = value
Overrides the configuration
.I setting
from
.I /usr/local/apps/dovecot/etc/dovecot/dovecot.conf
and from the userdb with the given
.IR value .
In order to override multiple settings, the
.B \-o
option may be specified multiple times.
.TP
.B \-v
Enables verbosity, including progress counter.
.\" --- command specific options --- "/.
.PP
Command specific
.IR options :
.\"-------------------------------------
.TP
.B \-A
If the
.B \-A
option is present, the
.I command
will be performed for all users.
Using this option in combination with system users from
.B userdb { driver = passwd }
is not recommended, because it contains also users with a lower UID than
the one configured with the
.I first_valid_uid
setting.
.sp
When the SQL userdb module is used make sure that the
.I iterate_query
setting in
.I /usr/local/apps/dovecot/etc/dovecot/dovecot\-sql.conf.ext
matches your database layout.
When using the LDAP userdb module, make sure that the
.IR iterate_attrs " and " iterate_filter
settings in
.I /usr/local/apps/dovecot/etc/dovecot/dovecot-ldap.conf.ext
match your LDAP schema.
Otherwise
.BR doveadm (1)
will be unable to iterate over all users.
.\"-------------------------------------
.TP
.BI \-F\  file
Execute the
.I command
for all the users in the
.IR file .
This is similar to the
.B \-A
option,
but instead of getting the list of users from the userdb,
they are read from the given
.IR file .
The
.I file
contains one username per line.
.\"-------------------------------------
.TP
.BI \-S\  socket_path
The option\(aqs argument is either an absolute path to a local UNIX domain
socket, or a hostname and port
.RI ( hostname : port ),
in order to connect a remote host via a TCP socket.
.sp
This allows an administrator to execute
.BR doveadm (1)
mail commands through the given socket.
.\"-------------------------------------
.TP
.B \-s
When the
.B \-s
option is present,
.I dest_parent
and all new mailboxes under it will be subscribed to.
.\"-------------------------------------
.TP
.BI \-u\  user/mask
Run the
.I command
only for the given
.IR user .
It\(aqs also possible to use
.RB \(aq * \(aq
and
.RB \(aq ? \(aq
wildcards (e.g. \-u *@example.org).
.br
When neither the
.B \-A
option, nor the
.BI \-F\  file
option, nor the
.BI \-u\  user
was specified, the
.I command
will be executed with the environment of the
currently logged in user.
.\"------------------------------------------------------------------------
.TP
.B \-U username
When the
.B \-U
option is present, the source box is opened with given username.
.SH ARGUMENTS
.TP
.I dest_parent
The name of the destination mailbox, under which the mails should be
imported.
.BR doveadm (1)
will create the
.I dest_parent
mailbox if it doesn\(aqt exist.
.TP
.I search_query
Copy messages matching this search query.
See
.BR doveadm\-search\-query (7)
for details.
.TP
.I source_location
This argument specifies the mailbox format and location of the source
location. The syntax is the same as for the
.I mail_location
setting.
For example:
.B maildir:/backup/20101126/jane.doe/Maildir
or
.B mdbox:/srv/mail/john.doe/mdbox:ALT=/nfsmount/john.doe/mdbox
.\"------------------------------------------------------------------------
.SH EXAMPLE
This example imports all mails from a backup under a
.I backup\-20101026
mailbox:
.PP
.nf
.B doveadm import \-u jane.doe@example.org \(rs
.B mdbox:/backup/20101026/jane.doe/mdbox backup\-20101026 all
.fi
.PP
Another example that imports only messages from foo@example.org in the
backup mdbox\(aqs INBOX to jane\(aqs INBOX:
.PP
.nf
.B doveadm import \-u jane.doe@example.org \(rs
.B mdbox:~/mdbox\-backup \(dq\(dq mailbox INBOX from foo@example.org
.fi
.\"------------------------------------------------------------------------
.SH REPORTING BUGS
Report bugs, including
.I doveconf \-n
output, to the Dovecot Mailing List <dovecot@dovecot.org>.
Information about reporting bugs is available at:
http://dovecot.org/bugreport.html
.\"------------------------------------------------------------------------
.SH SEE ALSO
.BR doveadm (1),
.BR doveadm\-fetch (1),
.BR doveadm\-search (1),
.BR doveadm\-search\-query (7)