Skip to content

Instantly share code, notes, and snippets.

@simplyspoke
Created February 4, 2017 06:42
Show Gist options
  • Save simplyspoke/74f99c356ac45dd37961bd6cedc795e3 to your computer and use it in GitHub Desktop.
Save simplyspoke/74f99c356ac45dd37961bd6cedc795e3 to your computer and use it in GitHub Desktop.
IMAP Sync
#!/bin/sh
#Configure User
SERVER1=mail.example.com
UNAME1=someone@example.com
PWORD1='password'
UNAME2=csomeone@example.com
PWORD2='password'
#Blank this out if you want to see folder sizes
HIDE="--nofoldersizes --skipsize"
#imapsync --syncinternaldates --useheader 'Message-Id' \
--host1 ${SERVER1} --user1 ${UNAME1} \
--password1 ${PWORD1} --ssl1 \
--host2 imap.googlemail.com \
--port2 993 --user2 ${UNAME2} \
--password2 ${PWORD2} --ssl2 \
--authmech1 LOGIN --authmech2 LOGIN --split1 200 --split2 200 ${HIDE} \
--exclude 'Drafts|Trash|Spam|Sent'
#TO Sync Special Folders to Gmail
imapsync --syncinternaldates --useheader 'Message-Id' --addheader \
--host1 ${SERVER1} --user1 ${UNAME1} \
--password1 ${PWORD1} --ssl1 \
--host2 imap.googlemail.com \
--port2 993 --user2 ${UNAME2} \
--password2 ${PWORD2} --ssl2 \
--ssl2 --noauthmd5 --split1 200 --split2 200 ${HIDE} \
--folder "Sent" --prefix2 '[Gmail]/' --regextrans2 's/Inbox\/Sent/Sent Mail/' \
--folder "Drafts" --prefix2 '[Gmail]/' --regextrans2 's/Inbox\/Drafts/Drafts/' \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment