Member of the Internet Link Exchange | Free Home Pages at GeoCities |
Microsoft Internet Mail to Eudora converter
After using Microsoft Internet Mail for a number of months, and suffering through a number of crashes that would lose mail, I finally decided to try something better...Eudora. This, after having already converted a few year's worth of e-mail to MSIE. I did a search in Yahoo to find a converter for MSIM, a found that the suggested method was to forward your mail and read it with the new mail reader. Guess what...MSIM doesn't have the mass forwarding feature that Z-Mail for UNIX had. Each and every one of about 3000 messages would have to be forwarded individually. I used the fixhead utility and started on the smaller mailboxes. By about the 1000th message, many hours later, I got sick of it (patience is a virtue?) and quit.
While checking out the LDAP features of the new MSIM a few months later, I decided to give it another crack at the rest of the messages, and found a new tool was posted, but it only provided the code. I asked Brian Hook for the executable and followed the instructions. About 15 minutes later, I had converted 2000 MSIM messages to Eudora on the first try and was finished with MSIM altogether. Thanks, Brian! Brian did not want to post the executable, but I suggested that given the right disclaimer, and that it worked as well as any other conversion utility, so here it is. Everything below, minus the page I created, is his work...
The instructions
The tool
The code
So long as you follow these instructions *to the letter*, this converter will work for you. It is extremely important that you backup your mail and perform the conversion on the backup copy. E-mail is way too important a resource to risk in any way such as this. *You* are responsible for your own mail and handling it. That understood, continue with the conversion...
Brian Hook:
Alright, instead of waiting for someone else to do this for me, I
went
ahead and wrote a REAL cheezy converter. We're talking two
functions,
complete hack job, etc.
I'm posting the source code. If someone else wants to compile it
and
redistribute the binary, feel free, but I DO NOT WANT TO SUPPORT
THIS
THING!! I would have had it done DAYS ago except it looks like
the PD
program to convert from Eudora->IE Mail (e2m) corrupts data
occasionally, so I had to put in special "corrupt
message" handling
routines that probably don't work some times.
So, this is free, take it for what it's worth.
Anyway, in general, once you get it working this is how you use
it:
1. BACKUP ALL YOUR MAILBOXES!!!!
2. Delete any unwanted messages from IE Mail, then do a
File|Folders|Compact|All. THIS IS VERY IMPORTANT.
3. Copy from "\Program Files\Internet Mail and
News\user\Mail" all your
mbx files to your Eudora director. Note that this WILL overwrite
your
existing Eudora mailboxes!!!! I didn't need any existing Eudora
mailboxes, so I didn't care, but if you do, that's going to
complicate
things for you.
4. Rename C:\EUDORA\*.mbx C:\EUDORA\*.in
5. Now you can use a DOS batch command to bulk convert all your
data
files over:
C:\EUDORA>for %i in (*.in) do m2e %i
This will generate a bunch of MBX files, and spit out any errors
into
m2e.log. Note that M2E.LOG is always appended to, so delete it
before
running the above command.
6. At this point you should have a bunch of Eudora compatible MBX
files, however you won't be able to see them in Eudora just yet.
You
now need to add them to Eudora so that it can see them. Do this
by
creating a directory called something like "tmp.fol"
(you MUST have .fol
extension!), then moving all your MBX files you just created into
it.
Now edit DESCMAP.DCE to tell Eudora that you have a new folder.
Do this
by adding the following line to DESCMAP.DCE using DOS EDIT.
tmp,tmp.fol,F,N
7. Start or restart Eudora. Go into tmp.fol, double click. You
should
see all your converted folders, probably with horribly messed up
long
filenames. Double click each folder, and if it asks you if you
want to
rebuild the TOC or index or whatever, just say yes, and it's
happy. Now
figure out what each folder has, then rename it. Do this for all
folders, then drag them to the appropriate folder you really want
them
to be in.
8. Delete tmp.fol from Eudora (assuming it's empty now since
you've
moved all the mailboxes out of it).
9. Delete M2E.LOG and *.IN from C:\EUDORA
I CAN'T GUARANTEE THAT ALL THIS WORKS! It worked well enough for
me to
get back to Eudora, which is all I want. If someone wants to take
this
source and make a real robust program from it, PLEASE DO.
Brian
--
+-----------------------------------------------------------------+
+ Brian Hook, bwh@wksoftware.com +
+ WK Software, http://www.wksoftware.com +
+ Consultants specializing in 3D graphics hardware and software +
+ ---------------------------------------------------------------
+
+ For a list of publications on 3D graphics programming, +
+ including Direct3D, OpenGL, and book reviews: +
+ http://www.wksoftware.com/publications.html +
+-----------------------------------------------------------------+
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <io.h>
const long IE_COOKIE = 0x7F007F00;
const char eudora_header[] = "From ???@??? Sun Jan 00 00:00:00 0000";
struct IEHeader
{
long cookie;
long msgno;
long msg_plus_header_size;
long true_msg_size;
};
static IEHeader *pIEHeader;
static long fsize;
static char infile[512];
static char outfile[512];
static char *fdata, *fdp, *fend;
int strnstr( const char *s, const char *substring, int n )
{
char *p = ( char * ) malloc( n + 1 );
int found = 0;
if ( p )
{
memcpy( p, s, n );
p[n] = 0;
found = strstr( p, substring ) ? 1 : 0;
free( p );
}
else
{
puts( "M2E: Out of memory" );
exit( 1 );
}
return found;
}
int main( int argc, const char *argv[] )
{
FILE *fpin, *fpout;
int msg = 0, corrupted_msgs = 0;
/*
** determine infile and outfile
*/
if ( argc == 2 )
{
strcpy( infile, argv[1] );
strcpy( outfile, infile );
if ( strchr( outfile, '.' ) )
*strchr( outfile, '.' ) = 0;
strcat( outfile, ".mbx" );
}
else if ( argc == 3 )
{
strcpy( infile, argv[1] );
strcpy( outfile, argv[2] );
}
else
{
puts( "Usage: m2e infile.ext [outfile.ext]" );
puts( " by default outfile = infile.mbx" );
exit( 1 );
}
/*
** make sure files aren't the same
*/
if ( _stricmp( infile, outfile ) == 0 )
{
printf( "Having the same input and output file is NOT a good idea!\n" );
exit( 1 );
}
if ( ( fpin = fopen( infile, "rb" ) ) == 0 )
{
printf( "M2E: could not open '%s'\n", infile );
exit( 1 );
}
if ( ( fpout = fopen( outfile, "wb" ) ) == 0 )
{
fclose( fpin );
printf( "M2E: could not open '%s'\n", outfile );
exit( 1 );
}
/*
** read in the entire file
*/
fsize = _filelength( fileno( fpin ) );
fdata = ( char * ) malloc( fsize );
fdp = fdata;
fend = fdata + fsize;
if ( fread( fdata, fsize, 1, fpin ) != 1 )
{
printf( "M2E: could not read all of '%s'\n", infile );
exit( 1 );
}
fclose( fpin );
/*
** there are 84 bytes of magical binary header that I never bothered
** to decode, so we skip past them
*/
fdp += 84;
while ( fdp < fend )
{
int msgsize;
printf( "processing message %d\r", ++msg );
pIEHeader = ( IEHeader * ) fdp;
fdp += sizeof( IEHeader );
/*
** if we don't find the magic cookie, then we have encountered
** a serious problem and need to quit
*/
if ( pIEHeader->cookie != IE_COOKIE )
{
corrupted_msgs++;
FILE *fp = fopen( "m2e.log", "a+t" );
if ( fp )
{
fprintf( fp, "M2E: file '%s' is corrupted, message %d\n", infile, msg );
fclose( fp );
}
printf( "M2E: file '%s' is corrupted, aborting", infile );
exit( 1 );
}
else
{
msgsize = pIEHeader->msg_plus_header_size - sizeof( IEHeader );
if ( !strnstr( fdp, "From ???@???", msgsize ) )
fprintf( fpout, "%s\n", eudora_header );
fwrite( fdp, msgsize, 1, fpout );
if ( fdp[msgsize-1] != '\n' )
fprintf( fpout, "\n" );
fdp += msgsize;
}
/*
** look for the next header, which should be at fdp
*/
if ( fdp < fend )
{
pIEHeader = ( IEHeader * ) fdp;
if ( pIEHeader->cookie != IE_COOKIE )
{
/*
** corrupted message!!!
*/
fdp -= msgsize;
while ( fdp < fend-sizeof( IE_COOKIE ) )
{
if ( memcmp( fdp, &IE_COOKIE, sizeof( IE_COOKIE ) ) == 0 )
{
break;
}
fdp++;
}
if ( fdp > fend-sizeof( IE_COOKIE ) )
break;
}
}
}
free( fdata );
fclose( fpout );
/*
** print a summary
*/
printf( "\n\nM2E Summary\n" );
printf( "Input: %s\n", infile );
printf( "Output: %s\n", outfile );
printf( "Messages: %d\n", msg );
printf( "Corrupted Messages: %d\n", corrupted_msgs );
return 0;
}