Giter Club home page Giter Club logo

imap_copy's Introduction

IMAP Copy

This is a very simple tool to copy folders from one IMAP server to another server.

Example:

The example below copies all messages from the INBOX of your other server into the 'OTHER-SERVER/Inbox' folder of Gmail.

python imapcopy.py "imap.otherserver.com.au:993" "username:password" \
"imap.googlemail.com:993" "[email protected]:password" \
"INBOX" "OTHER-SERVER/Inbox" --verbose

Since Gmail terribly throttles uploading and downloading mails over IMAP, you may find the 'skip' and 'limit' options handy. If Gmail disconnected you after copying 123 emails out of your total 1000 emails in the example shown above, you may use the following command to resume copying skipping the first 123 messages.

python imapcopy.py "imap.otherserver.com.au:993" "username:password" \
"imap.googlemail.com:993" "[email protected]:password" \
"INBOX" "OTHER-SERVER/Inbox" --skip 123

Similarly the 'limit' option allows you to copy only the N number of messages excluding the skipped messages. For example, the following command will copy message no. 124 to 223 into Gmail.

python imapcopy.py "imap.otherserver.com.au:993" "username:password" \
"imap.googlemail.com:993" "[email protected]:password" \
"INBOX" "OTHER-SERVER/Inbox" --skip 123 --limit 100

There is also 'recurse' option that copies contents of folders with all of its subfolders. Also if you replace source mailbox with empty string, it will copy all contents of that mailbox:

python imapcopy.py "imap.otherserver.com.au:993" "username:password" \
"imap.googlemail.com:993" "[email protected]:password" \
"" "OTHER-SERVER" --recurse

Usage:

usage: imapcopy.py [-h] [-q] [-v]
               source source-auth destination destination-auth mailboxes
               [mailboxes ...]

positional arguments:
  source            Source host ex. imap.googlemail.com:993
  source-auth       Source host authentication ex. [email protected]:password
  destination       Destination host ex. imap.otherhoster.com:993
  destination-auth  Destination host authentication ex.
                    [email protected]:password
  mailboxes         List of mailboxes alternate between source mailbox and
                    destination mailbox.

optional arguments:
  -h, --help        show this help message and exit
  -c, --create-mailboxes
                    Create the mailboxes on destination
  -r, --recurse     Recurse into submailboxes
  -q, --quiet       ppsssh... be quiet. (no output)
  -v, --verbose     more output please (debug level)
  -s N, --skip N    skip the first N message(s)
  -l N, --limit N   only copy N number of message(s)

Only tested on Python 2.7.

imap_copy's People

Contributors

jarus avatar gsbabil avatar dorancemc avatar

Watchers

James Cloos avatar Alexey Tishchenko avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.