Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save budiantoip/6a9c4d5cb5420a4017907b261fb27c9d to your computer and use it in GitHub Desktop.
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 [email protected] -mailbox true -passwd A-Password

doveadm sync

doveadm sync -u [email protected] remote:target.server.com
doveadm sync -R -u [email protected] remote:source.server.com
doveadm sync -R remote:target.server.com -u [email protected]

doveadm

Authenticate

doveadm auth login [email protected]*admin <password>

Get user details

doveadm user [email protected]

Get user quota

doveadm quota get -u [email protected]

Get mailbox list

doveadm mailbox list -u [email protected] -8
    INBOX
    INBOX.Trash
    INBOX.Archive
    INBOX.Junk
    INBOX.Sent
    INBOX.Drafts

Get mailbox metadata

doveadm mailbox metadata list -u [email protected] INBOX

Test folder access

doveadm fetch -u [email protected] 'uid' mailbox INBOX.Archive

Get mailbox status

doveadm mailbox status -u [email protected] all INBOX

Get mailbox status formatted in a table

doveadm -f table mailbox status -u [email protected] "messages vsize" INBOX*

Subscribe a user to a mailbox

doveadm mailbox subscribe -u [email protected] INBOX.Archive

imapsync References

Imapsync

imapsync --dry \
    --buffersize 8192000 --nosyncacls --subscribe --syncinternaldates \
    --host1 source.server.com --authuser1 admin --user1 "[email protected]" --password1 "dovecot master pwd" \
    --host2 zimbra.example.com.au --authuser2 admin --user2 "[email protected]" --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 [email protected]*admin --password1 <password> \
  --host2 target.server.com --user2 [email protected]*admin --password2 <password> \
  --authmech1 plain --authmech2 plain \
  --syncinternaldates \
  --automap \
  --delete2duplicates \
  --debug \
  --dry

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

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

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