#!/usr/bin/perl -w # Baptiste Mélès (baptiste.meles@normalesup.org) # 02 March 2011; new version 18 February 2015 ################################################################ # LICENSE ################################################################ # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or (at # your option) any later version. # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . ################################################################ # HOW TO USE THIS PROGRAM ################################################################ # This program allows to save e-mails from a corrupted Microsoft # Entourage database. # In order to do that, you have to: # 0. have Perl installed on your system (if you know someone who uses # Unix or Linux, he might help you for the whole process); # 1. open the Terminal; # 2. go to the directory where the Database file is located, typically # something like: # Disk name/Documents/Microsoft User Data/Office 2001 Identities/Main Identity # 3. write down the command, writing the actual name of the file instead of # "DATABASE": # saventourage DATABASE > Recovered_database.mbox # Then you should have a file named Recovered_database.mbox in the same # directory. # 4. Open Entourage, select "Import", "mbox file", and open the file # Recovered_database.mbox. Even though there may be a lot of garbage, # you may have lost not too many e-mails (actually, you should # typically and hopefully have lost no one). use strict; undef $/; my $entree = $ARGV[0]; my $sortie = $ARGV[1]; print "Démarrage de Saventourage.\n"; open(FICHIER, $entree); if (! -e $entree) { print "$entree n'existe pas !\n"; exit; } else { print ("$entree existe.\n"); } $_ = ; # Quelques débuts de courriel typiques s/Received: from/From:/g; s/Return-Path:/\n\nFrom:/g; # Sauts de ligne Mac s/\015\012|\015|\012/\n/g; # Retirer tous les caractères non-ASCII s/[^!-~\s]//g; # Identifier les débuts de courriel avec une date bidon s/(\n|.)*?From: (.*)\n/From $2 Sat Jan 3 01:05:34 1996\nFrom: $2/m; s/\n\nFrom: (.*)/\n\nFrom $1 Sat Jan 3 01:05:34 1996\nFrom: $1/g; close(FICHIER); open(FICHIER, '>', $sortie); print "Écriture de $sortie.\n"; print FICHIER; close(FICHIER); print("Fichier créé.\n");