DOVEADM-IMPORT(1)

πŸ’Œ DOVEADM-IMPORT(1) β€” the Dovecot manual, but make it make sense

okay bestie, sit down, hydrate, because we're about to import so many mails. this is doveadm-import, part of the Dovecot fam (manual section 1, obvs). it's giving "moving your whole life into a new mailbox" energy and honestly? iconic. πŸ¦‹


✨ SYNOPSIS ✨

the three forms, verbatim, no notes:

doveadm [GLOBAL OPTIONS] import [-S socket_path] [-U source_user] [-s]
-A source_mail_driver:source_mail_path

doveadm [GLOBAL OPTIONS] import [-S socket_path] [-U source_user] [-s]
-F file source_mail_driver:source_mail_path

doveadm [GLOBAL OPTIONS] import [-S socket_path] [-U source_user] [-s]
-u user source_mail_driver:source_mail_path

🌸 DESCRIPTION 🌸

so here's the tea: this command pulls mails in from another mail storage β€” one you describe with source_mail_driver, source_mail_path, and any extra settings you pass along via -p β€” and drops them into one or more users' mailboxes. lowkey magical. ✨

every mailbox that comes over lands under the dest_parent mailbox you name. if dest_parent is empty (""), they land at root level instead. and search_query? that's your little filter, it decides which mailboxes or messages actually get imported. by default the whole import happens in the destination user's context β€” if you wanna switch that up, that's what -U is for. πŸ’…

now the three forms, one by one:

  1. form one β€” mails get imported for all users. everybody. the whole group chat.
  2. form two β€” mails get imported for all users listed in the given file.
  3. form three β€” mails get imported only for the given user(s). just them. main character.

🌈 GLOBAL OPTIONS 🌈

these are the global doveadm(1) options, shared with the rest of the crew:

  • -D β€” turns on verbosity and debug messages. the "tell me everything" setting. πŸ—£οΈ
  • -O β€” don't read any config file, just use defaults. the dovecot_storage_version setting defaults to the latest version, but you can override it with -o if you're feeling spicy.
  • -k β€” preserves the entire environment for doveadm, not just the import_environment setting. full vibe retention. 🫢
  • -v β€” enables verbosity, progress counter included. watch that number go up, so satisfying.
  • -i instance-name β€” if you're running multiple Dovecot instances, pick which config file to use based on this instance name.

see the instance_name setting for more info.

  • -c config-file β€” read config from the given config-file. by default it reads the config socket first, then falls back to /etc/dovecot/dovecot.conf. you can also point this at the config socket of some instance running a compatible version. compatibility slay. πŸ‘‘
  • -o setting=value β€” overrides a config setting from /etc/dovecot/dovecot.conf and from the userdb with the given value. wanna override multiple settings? just pass -o multiple times, she's flexible. πŸ’–

πŸ’… OPTIONS πŸ’…

  • -A β€” if present, the command runs for all users. but listen: combining this with system users from userdb { driver = passwd } is not recommended, because that userdb also contains users with a lower UID than the one configured with the first_valid_uid setting. mess.

if you're using the SQL userdb module, double-check that the userdb_sql_iterate_query setting setting matches your database layout. yes, "setting setting." it's in the original, don't @ me. πŸ™ˆ

and if you're on the LDAP userdb module, make sure the userdb_fields setting and userdb_ldap_iterate_fields setting settings match your LDAP schema. otherwise doveadm(1) will be unable to iterate over all users. no cap, that's a real blocker. 😭

  • -F file β€” run the command for all the users in file. it's like -A's cooler cousin, except instead of pulling the user list from the userdb, it reads them from the given file. the file contains one username per line. clean, simple, organized. πŸŽ€
  • --no-userdb-lookup β€” skip the userdb lookup entirely. use the USER environment variable to specify the username. DIY era. ✨
  • -S socket_path β€” the argument is either an absolute path to a local UNIX domain socket, or a hostname and port (hostname:port) so you can connect to a remote host over a TCP socket.

this lets an administrator execute doveadm(1) mail commands through the given socket. remote control, but make it mail. πŸ”₯

  • -p setting=value β€” overrides the configuration setting for the source storage. (source! not dest! pay attention bestie.)
  • -s β€” when present, dest_parent and all new mailboxes under it get subscribed to. subscribe, bell icon, all of it. πŸ””
  • -U username β€” when present, the source box is opened with the given username. this is the context switcher I mentioned earlier. πŸ’œ
  • -u user/mask β€” run the command only for the given user. you can also use * and ? wildcards (e.g. -u *@example.org). wildcards are so underrated fr fr.

🧚 ARGUMENTS 🧚

  • dest_parent β€” the name of the destination mailbox, the one the mails get imported under. doveadm(1) will create the dest_parent mailbox if it doesn't exist yet. it's got you. 🫢
  • search_query β€” copy messages matching this search query. see doveadm-search-query(7) for the details, that's where the full menu lives.
  • source_mail_driver:source_mail_path β€” this argument specifies the mail_driver and mail_path settings for the source location. the -p parameter can optionally be used to specify additional settings. for example: maildir:/backup/20101126/jane.doe/Maildir or -p mail_alt_path=/nfsmount/john.doe/mdbox mdbox:/srv/mail/john.doe/mdbox. see how the -p sneaks in there? that's the pattern. ✨

πŸ“ EXAMPLE πŸ“

example one! this imports all mails from a backup under a backup-20101026 mailbox:

doveadm import -u jane.doe@example.org \
  mdbox:/backup/20101026/jane.doe/mdbox backup-20101026 all

example two! this one imports only messages from ⟨foo@example.org⟩ in the backup mdbox's INBOX into jane's INBOX:

doveadm import -u jane.doe@example.org \
  mdbox:~/mdbox-backup "" mailbox INBOX from foo@example.org

notice the ""? that's the empty dest_parent β€” root level, no nesting. she said "put it right at the top." πŸ’…


😭 REPORTING BUGS 😭

found a bug? report it β€” and please include your doveconf -n output β€” to the Dovecot Mailing List ⟨dovecot@dovecot.org⟩. info about reporting bugs lives at: ⟨https://dovecot.org/bugreport.html⟩

do it properly, we love a thorough bug report. 🫢


πŸ‘€ SEE ALSO πŸ‘€

doveadm(1), doveadm-search-query(7)


and that's the whole page, bestie. this version is from source/version f979264, dated April 2026 πŸ’– stay hydrated, back up your maildirs, and go import something. periodt. πŸŒˆπŸ‘‘

πŸ“¦ where this page comes from