Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save budiantoip/6a9c4d5cb5420a4017907b261fb27c9d to your computer and use it in GitHub Desktop.

Select an option

Save budiantoip/6a9c4d5cb5420a4017907b261fb27c9d to your computer and use it in GitHub Desktop.
Email Transfer with doveadm and imapsync

Add a mailbox in Plesk

/usr/local/psa/bin/mail -c someone@somewhere.net -mailbox true -passwd A-Password

doveadm sync

doveadm sync -u super-user@email.com remote:target.server.com
doveadm sync -R -u super-user@email.com remote:source.server.com
doveadm sync -R remote:target.server.com -u super-user@email.com

doveadm

Authenticate

doveadm auth login user@email.com*admin <password>

Get user details

doveadm user user@email.com

Get user quota

doveadm quota get -u user@email.com

Get mailbox list

doveadm mailbox list -u user@email.com -8
    INBOX
    INBOX.Trash
    INBOX.Archive
    INBOX.Junk
    INBOX.Sent
    INBOX.Drafts

Get mailbox metadata

doveadm mailbox metadata list -u user@email.com INBOX

Test folder access

doveadm fetch -u user@email.com 'uid' mailbox INBOX.Archive

Get mailbox status

doveadm mailbox status -u user@email.com all INBOX

Get mailbox status formatted in a table

doveadm -f table mailbox status -u user@email.com "messages vsize" INBOX*

Subscribe a user to a mailbox

doveadm mailbox subscribe -u user@email.com INBOX.Archive

imapsync References

Imapsync

imapsync --dry \
    --buffersize 8192000 --nosyncacls --subscribe --syncinternaldates \
    --host1 source.server.com --authuser1 admin --user1 "super-user@email.com" --password1 "dovecot master pwd" \
    --host2 zimbra.example.com.au --authuser2 admin --user2 "super-user@email.com" --password2 "zimbra admin pass" \
    --authmech1 plain --authmech2 plain --ssl2 --nofoldersizes --skipsize
"username*master" is, imap username of user you are migrating, and master, is the dovcot master userame (default master), and --user2 username, is the destination username for the import.
HTH

imapsync --dry  \
  --host1 mailhost1 --port1 143 --tls1 \
  --user1 "testuser" \
  --authuser1 kopanoadmin --password1 kopanopassword \
  --host2 mailhost2 --port2 143 --tls2 \
  --user2 testuser --password2 testuserpassword \
  --automap \
  --delete2duplicates \
  --logfile "testuser"

imapsync --dry \
    --noauthmd5 \
    --host1 mail.old --user1 userold --password1 passw1 \
    -sep2 / --prefix2 "" \
    --host2 zarafa.new --user2 usernew --password2 passw2
# The option --noauthmd5 forces authentication with plain password, which the Zarafa gateway only supports
# The option --sep2 / is to define the used separator for Zarafa
# The option --prefix2 "" is to define the basic starting folder
# The option --allowsizemismatch is necessary when migrating from google/gmail accounts

imapsync - guaranteed to work

imapsync \
  --host1 source.server.com --user1 super-user@email.com*admin --password1 <password> \
  --host2 target.server.com --user2 super-user@email.com*admin --password2 <password> \
  --authmech1 plain --authmech2 plain \
  --syncinternaldates \
  --automap \
  --delete2duplicates \
  --debug \
  --dry

imapsync \
  --host1 source.server.com --port1 143 --tls1 \
  --user1 "super-user@email.com" \
  --authuser1 admin --password1 <password> \
  --host2 target.server.com --port2 143 --tls2 \
  --user2 "super-user@email.com" \
  --authuser2 admin --password2 <password> \
  --automap \
  --delete2duplicates \
  --debug \
  --dry

imapsync --dry  \
  --host1 source.server.com --port1 143 --tls1 \
  --user1 "super-user@email.com" \
  --password1 <password> \
  --host2 target.server.com --port2 143 --tls2 \
  --user2 "super-user-target@email.com" \
  --authuser2 admin --password2 <password> \
  --automap \
  --delete2duplicates \
  --debug

imapsync --dry  \
  --host1 source.server.com --port1 143 --tls1 \
  --authuser1 --user1 "super-user@email.com" \
  --password1 <password> \
  --host2 target.server.com --port2 143 --tls2 \
  --authuser2 --user2 "super-user-target@email.com" \
  --password2 <password> \
  $extra "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment