Back up Foxmail to Gmail

Source: Internet
Author: User
Tags imap one more line email account

Previously, emails were received using Foxmail, And the mailbox size was limited. Due to insufficient space, emails were not backed up on the server. My Foxmail local mail directory already has more than 2 GB, which is too space-consuming. Now I use Gmail to receive emails from my n mailboxes, so it would be nice to back up more than 2 GB old emails in local Foxmail to Gmail. This saves my hard disk space and facilitates searching for emails for unified management.


I found some methods for this purpose. The final solution is as follows:

1. confirm that your Gmail mailbox has enabled IMAP (configuration-> forwarding and POP/IMAP) in the configuration)

2. Upgrade Foxmail to 6.5 (the latest version I can download is 6.5 beta3) Because Foxmail supports IMAP only after this version.

3. Configure your Gmail mailbox in Foxmail. You must set it to IMAP !! You can set "Do not synchronize" for all IMAP folders so that you do not need to download emails from your current Gmail.

4. In Foxmail, select all emails under your old email account, right click-copy to-select a directory under your newly configured Gmail account.

5. OK



---------------- I am a separation line ---------------------------------------------------------------


This process should have been smooth, but my old email has a problem:

There are a lot of emails that can be viewed in the Foxmail directory after you right-click and copy them to the Gmail directory. However, you can see some emails with "no sender or subject" in your browser.


By viewing the original mail information, it is found that the problematic mail has one more line in the header of the original information than other Emails: "+ OK"

It's strange, but as long as I get rid of this line, emails will be displayed normally in Gmail.


I have 2 GB of mail. How can I remove this line in batches?


Foxmail's email storage format is one directory, one directory and one file, which makes it inconvenient for me to write programs.

My method is to export the Foxmail email. eml (select "email"> "file"> "Export"> "OK"), process the EML, re-import Foxmail after processing, and reproduce "Copy to Gmail directory". OK! No problem! :)



------------------- My name is split line ---------------------------------------------------------------------------

Let's talk about the small program I wrote to remove unnecessary content from the. eml file header.

If you use NotePad to open the. eml file, you will find that it is actually a text file, and the content in it is exactly the same as the original mail information.

My problem is that the original information of my mail has one more line in the file header. I only need to write a program to traverse all the files in the directory, determine whether the first line is "+ OK". If yes, delete it. after the EML file is imported to Foxmail, it can be copied to the IMAP directory of Gmail and displayed normally in webmail.


The program is very simple, so there is no comment:

Using system; <br/> using system. collections. generic; <br/> using system. LINQ; <br/> using system. text; <br/> using system. io; <br/> namespace fixemlindirs <br/>{< br/> class Program <br/>{< br/> const int sizebuff = 1024; <br/> static int dircount = 1; <br/> static int filecounter = 0; <br/> static string thesrcdir = @ "G:/foxmail_export /"; <br/> static string thedestdir = @ "G:/foxmail_export_fixed/"; <Br/> static void main (string [] ARGs) <br/>{< br/> program P = new program (); <br/> directoryinfo destdir = new directoryinfo (thedestdir); <br/> If (destdir. exists) <br/> destdir. delete (true); <br/> destdir. create (); <br/> // DO <br/> directoryinfo dir = new directoryinfo (thesrcdir); <br/> P. export eDirectory (DIR); <br/>}< br/> private void export eDirectory (directoryinfo DIR) <br/>{< br/> consol E. writeline ("{0}/N", dir. name); <br/> fileinfo [] filesindir = dir. getfiles (); <br/> foreach (fileinfo file in filesindir) <br/>{< br/> console. writeline ("{0} size: {1} bytes", file. name, file. length); <br/> filecounter ++; <br/> fixeml (File); <br/>}< br/> directoryinfo [] directories = dir. getdirectories (); <br/> foreach (directoryinfo newdir in directories) <br/>{< br/> dircount ++; <br/> lead E Directory (newdir); <br/>}< br/> private void fixeml (fileinfo file) <br/>{< br/> console. writeline ("Fix EML: {0}", file. fullname); <br/> streamreader reader = file. opentext (); <br/> string strdestdir = file. directory. fullname; <br/> strdestdir = strdestdir. replace (thesrcdir, thedestdir); <br/> directoryinfo destdir = new directoryinfo (strdestdir); <br/> If (! Destdir. exists) <br/> destdir. create (); <br/> string stroutputfilename = strdestdir + "//" + file. name; <br/> streamwriter writer = new streamwriter (stroutputfilename, false); <br/> string text; <br/> string head = "+ OK "; <br/> text = reader. readline (); <br/> If (! Text. startswith (head) <br/>{< br/> writer. writeline (text); <br/> // console. writeline (text); <br/>}< br/> DO <br/> {<br/> text = reader. readline (); <br/> writer. writeline (text); <br/>}while (text! = NULL); <br/> reader. close (); <br/> writer. close (); <br/>}< br/>



Gmail that supports IMAP is really cool ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.