Skip to Main Content

Department of Computer Science

Technical Services and Support

Moving Email from CS Mail Server

Moving Email from CS Mail Server – dragon.rutgers.edu

by Hanz Makmur, Mar 2016.

Note: This is an old document describing how to move email from ‘dragon.rutgers.edu”.  This same instruction can also move email out from your current email system when you graduate from Rutgers, assuming you have IMAP enabled on both systems.  

IMPORTANT: As of Jan 2020,  Google started to enforce oAuth authentication for IMAP. If your account has already been forced to use XOAuth2, this instruction is not applicable.  You can follow Gmail and XOAUTH2-specific instructions.
Otherwise, please follow the instructions on 
Migrating Email Out of Rutgers Connect.


As part of the President’s Strategic Plan for Rutgers University, Computer Science is moving to Rutgers Connect, a Microsoft 365-based Cloud Mail server. Details Information about Rutgers Connect has been posted, and Official Communications on email migration was sent on Feb 8, 2016.

OIT manages the email migration for current users and sends emails to those affected, asking them to respond by Mar 1, 2016. Unfortunately, many CS Mail users who do not have active status must move their email out by the end of 2016.

Please see CS Email Transition To Rutgers Connect to see how you are affected and what steps you must take to avoid losing your email.

This document is written to help users who prefer to move their email themselves or those who do not qualify for OIT-managed email migration.

In this document, you will learn how to move your existing email from the CS mail server to another IMAP-based email server. A manual process may be the easiest to follow if you don’t have many emails. Otherwise, you may need to consider the automatic method.

1. Manual process

Manual processes can be performed on your modern email client (like AppleMail or Thunderbird). It is an easy process to do, but it is the most time-consuming. If you have many emails and email folders, you may want to consider the Automatic process.

Follow the steps below to move your email manually:

  1. Set up your email client to read emails from dragon.rutgers.edu and ScarletMail or Rutgers Connect. Please follow the instructions provided by the respective email system on how to set up your modern mail client with that system.
  2. you must create individual folders on the ScarletMail or Rutgers Connect end if you have email folders.
  3. Drag an email from each dragon.rutger.edu folder to the newly created folder on the ScarletmMail or Rutgers Connect.
  4. Repeat until finished.

2. Automatic Process Using IMAPSync

Migrating all your email can be done in 2 ways using the IMAPSync program. If you still have access to a CS Linux account, you can use CS resources or install the software yourself on your own computer.

The software needed to sync/copy your email is called imapsync. This software is installed on all CS Faculty/Grad/iLab Centos7Machines.
If you are running this on your machine, you need to install the imapsync package for your OS release or install the source from https://github.com/imapsync/

A. Using CS iLab/Grad/Faculty Linux Computer

If you need a temporary CS Linux account – only until December 2016-  please let us know, and we will try to set up a guest account in late August or early September 2016 to help migrate your email.

B. Using Your Computer

On LinuxOS, install imapsync via Yum or apt or whatever package manager you run on that LinuxOS.
On a MacOSX, you can easily install imapsync via Homebrew command: brew install imapsync. Or you can also install it viaFinkProject
On a WindowsOS, you need to download the source, Strawberry Perl, and follow Part B of the instruction
If you do not want to deal with putting it together, you can also purchase a ready-made one at http://imapsync.lamiral.info/
 

Migrating Email Using IMAPSync

Pre-requisites:

If you are synching to RutgersConnect, there is no prerequisite to setup. If you are using ScarletMail (Gmail-based system), You have to:
  1. Enable IMAP on your ScarletMail and create a separate password. Please follow the instructions provided by ScarletMail on how to enable the IMAP protocol.
     
  2. Set a separate password to access ScarletMail/ScarletApps via mobile/IMAP/POP. Please visit the Manage Your ScarletApps Mobile/IMAP/POP Password tool at https://netid.rutgers.edu.
     
  3. Optional: IMAPSync runs on a terminal and takes a long time. You may want to consider using a Linux program knows screen. See a quick how-to-use screen to keep your process running despite a dropped connection.

You are syncing your Email from CS Mailserver (dragon.rutgers.edu) to another system.

The imapsync command may need to be repeatedly run until the transfer is completed. It does a one-way sync from the CS mail server to a destination server. It can be used on any IMAP-based server of your choice.

You can start migrating your email now if you already have a new email account somewhere else, and you can repeatedly run this command until all your emails are moved.

Two examples below show you what you need to do to sync to ScarletMail and Rutgers Connect mail servers. Please note that it will take a long time to complete. Due to limitations placed by the destination server, it may terminate after a particular hour, and you will need to re-run to complete your sync. It can take 2-3 or more syncs to transfer 5 GB of email. Please look at your migration.log to see the status of your email migration.

Syncing To ScarletMail

Below is the command for synching email to Scarletmail from CS Mailserver (dragon.rutgers.edu). Please pay attention to the red color line below. You will need to substitute it with your information. For more info seehttps://imapsync.lamiral.info/FAQ.d/FAQ.Gmail.txt for more options.

/usr/bin/imapsync \
--pidfilelocking \
--noreleasecheck \
--maxsize 45000000 \
--maxlinelength 10500 \
--maxbytespersecond 10000 \
--noexpunge \
--disarmreadreceipts \
--addheader \
--regextrans2 "s/[ ]+/_/g"  \
--regextrans2 "s/['\^\"\\\\]/_/g" \
--regexflag 's/\\Flagged//g' \
--logfile migration.log \
--host1 dragon.rutgers.edu \
--timeout1 180 --ssl1 \
--user1  your_netid \
--passfile1  Name_of_file_containing_your_CS_password \
--host2  imap.gmail.com \
--timeout2 180 --ssl2 \
--user2  your_netid@scarletmail.rutgers.edu \
--passfile2  Name_of_file_containing_your_scarletmail_imap_password \
--subfolder2 Name_of_sub_folder_to_store_your_dragon_email_to

Note: If you are using Google 2 steps verification, use your app_specific password for passfile2

Syncing To Rutgers Connect

Below is an example command for synching emails to Rutgers Connect from CS Mailserver (dragon.rutgers.edu). Since Rutgers Connect is essentially your new @cs mailserver, the destination username will your_netid@cs.rutgers.edu . Please pay attention to the red color line below. You will need to substitute it with your information.

Note: –maxmessagespersecond 4 is to prevent you from hitting a limit. This gets you to transfer about 5GB in 24 hours. However, real-life experience shows that your connection to the destination server is likely terminated before 24 hours is reached, requiring you to re-run the command again. The migration.log file will tell you the status of your migration. Don’t forget to read it!
More Options imapsync has lots of other options that you can see by calling it via:
 
/usr/bin/imapsync \
--pidfilelocking \
--noreleasecheck \
--maxsize 45000000 \
--maxlinelength 10500 \
--maxbytespersecond 10000 \
--maxmessagespersecond 4 \
--noexpunge \
--disarmreadreceipts \
--addheader \
--regexflag 's/\\Flagged//g' \
--regextrans2 's/[ ]+/_/g' \
--logfile migration.log \
--host1 dragon.rutgers.edu \
--timeout1 180 --tls1 \
--user1 your_netid \
--passfile1 Name_of_file_containing_your_CS_password \
--host2 outlook.office365.com \
--timeout2 180 --tls2 \
--user2 your_netid@cs.rutgers.edu \
--passfile2 Name_of_file_containing_your_rutgers_netid_password
/usr/bin/imapsync --help
For example, if you like to sync only certain folders, you can add these options to the end of the command above: 
    --folder       str  : Sync this folder. Example:  --folder "Summer2014"
    --folder       str  : and this one, etc to sync more folders

    --folderrec    str  : Sync this folder recursively.
    --folderrec    str  : and this one, etc to sync more folders

    --folderfirst  str  : Sync this folder first. Example:  --folderfirst "Work"
    --folderfirst  str  : then this one, etc to sync more folders

    --folderlast   str  : Sync this folder last. Example: --folderlast  "[Gmail]/All Mail"
    --folderlast   str  : then this one, etc to sync more folders