Skip to content

Instantly share code, notes, and snippets.

@rvalitov
Last active April 16, 2023 22:47
Show Gist options
  • Save rvalitov/eb73b6e77f6a7f1a1893318fe675310c to your computer and use it in GitHub Desktop.
Save rvalitov/eb73b6e77f6a7f1a1893318fe675310c to your computer and use it in GitHub Desktop.
IMAP emails sync example from Yandex to Titan email service
# This example shows how to transfer emails from Yandex to Titan using the following:
# - proper use of SINCE and BEFORE keywords to select only some emails
# - proper hosts, ports and SSL configuration
# - skip of empty folders (empty folders are not created on destination)
# - email reports are not saved
# - no folder size calculation (it takes too long for big mailboxes with size of 10 Gb+)
# - correct matching of Yandex folders that have Russian names such as "Отправленные", "Отправленные_0", "Удаленные", etc,
# - skip other folders like "Junk Emails", "Infected Items" or "Исходящие" folder because it's "Outbox" that is missing on Titan.
imapsync \
--host1 imap.yandex.ru \
--user1 [email protected] \
--password1 'source password' \
--port1 993 \
--host2 imap.titan.email \
--user2 [email protected] \
--password2 'destination password' \
--port2 993 \
--ssl1 \
--ssl2 \
--search "SINCE 01-Jan-2023 BEFORE 31-Dec-2023" \
--nofoldersizes \
--nofoldersizesatend \
--include 'INBOX|Sent|Spam|Archive|Trash|Drafts|Junk Email' \
--include '&BB4EQgQ,BEAEMAQyBDsENQQ9BD0ESwQ1\-(_0)?' \
--include '&BCMENAQwBDsENQQ9BD0ESwQ1\-(_0)?' \
--include '&BCcENQRABD0EPgQyBDgEOgQ4\-(_0)?' \
--include '&BCEEPwQwBDw\-(_0)?' \
--include '&BB0ENQQ2BDUEOwQwBEIENQQ7BEwEPQQwBE8\- &BD8EPgRHBEIEMA\-' \
--include '&BBAEQARFBDgEMg\-' \
--f1f2 '&BB4EQgQ,BEAEMAQyBDsENQQ9BD0ESwQ1-=Sent' \
--f1f2 '&BB4EQgQ,BEAEMAQyBDsENQQ9BD0ESwQ1-_0=Sent' \
--f1f2 '&BCMENAQwBDsENQQ9BD0ESwQ1-=Trash' \
--f1f2 '&BCMENAQwBDsENQQ9BD0ESwQ1-_0=Trash' \
--f1f2 '&BCcENQRABD0EPgQyBDgEOgQ4-=Drafts' \
--f1f2 '&BCcENQRABD0EPgQyBDgEOgQ4-_0=Drafts' \
--f1f2 '&BCEEPwQwBDw-=Spam' \
--f1f2 '&BCEEPwQwBDw-_0=Spam' \
--f1f2 '&BB0ENQQ2BDUEOwQwBEIENQQ7BEwEPQQwBE8- &BD8EPgRHBEIEMA-=Spam' \
--f1f2 'Junk Email=Spam' \
--f1f2 '&BBAEQARFBDgEMg-=Archive' \
--noemailreport1 \
--noemailreport2 \
--skipemptyfolders
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment