You have been redirected here, which houses content from our former website; this content may or may not be current. Our official website may have more up-to-date information.
UBC Mathematics: MathNet FAQ [Mail Transfer]

UBC Mathematics: MathNet FAQ [Mail Transfer]

Question: How do I export my mailbox to another Email account (like Gmail)?
Author: Joseph Tam
Date: Sept/2019

This FAQ is intended for users who are in the situation where they have to transfer a large amount of Email messages from one Email account to another. By large, I mean over a hundred, and sometimes, several thousands messages, possibly spread out over many mailboxes.


  1. Direct file transfer

    Your MathNet mailboxes are stored in mbox format, which is essentially a text encoding of all your Email, one file per mailbox If the destination mail account uses the same mail storage format, and you have direct file access on the other site, you can simply copy your mail files there.

  2. IMAP copy using a mail reader

    This method requires your MathNet and remote mail accounts to be installed on a common mail reader so that both sets of mailboxes can be accessed simultaneously. Most mail readers (e.g. MacOSX Mail, Thunderbird, Outlook) can be set up this way using IMAP as the remote mail protocol. Messages/mailboxes can then be copied from one mailbox to another via the drag and drop method. If the remote mail service is not available, you can copy message to local folders on your storage device, then copy from there to the remote service when it becomes available.

  3. IMAP copy utility

    A command-line utility is available on public Unix workstations (see this FAQ that can automatically transfer all message to a destination mail account that is IMAP capable.

    After invoking the command, you will be prompted for two passwords: the first is your MathNet password, followed by the remote Email account password. (See section below if your exporting to a Gmail account.) Examples:

    	# Run without arguments to print help message on usage.
    	# Check status of account
    	/usr/local/bin/imapxfer -c
    	# Copy all mail (INBOX and personal mailboxes) to Gmail
    	# account prefixed with label 'UBC/'.
    	/usr/local/bin/imapxfer -pUBC/ INBOX mail
    	# Copy both INBOX and all personal mailboxes to the the remote
    	# mail account (user=zzz, with full
    	# diagnostics and all mailboxes renamed by prefixing with X-.
    	/usr/local/bin/imapxfer -V -pX- INBOX mail
  4. Forwarding

    You can forward messages from your MathNet account to another mail address. A side-effect is that it will change the From header to your MathNet Email address, and you won't see the sender without reading the content of the message. (Pine users: use the bounce command to avoid this.)

    You should not forward too many messages at one time. This could cause the the receiving mail system to get swamped with too many messages. Some mail systems will block incoming mail in this situation. Forward mail in batches of a few dozen messages at a time.

Specific instructions for IMAP access on Gmail

Before you can use IMAP methods, you may have to enable IMAP access to your Gmail account, and as well as enabling "allow less secure apps to access your account":

  1. Log in to your Gmail account.
  2. (Gmail) Settings -> Forwarding and POP/IMAP tab -> Enable IMAP)
  3. (Google Account) Settings -> Security -> (On) Less secure app access
You can revert these settings after you finish importing your Email.

Transfers to Gmail via IMAP is somewhat slow. A large mailbox may take quite a while to fully transfer. If you're using the script utility, add the imapxfer -v flag to show the progress of a transfer.