I have written a script which firstly removes the 'from' email address from a .msg file. I inherited this algorithm (well it was handed and told to code it) but it turns out it must search through an MDaemon backup folder containing a large amount of .msg files (100,000 +). The MDaemon set up is crazy and about 5% of the addresses are only needed.
Anyway I use Email::Simple to remove the 'from' address.
Is there a quick way to loop through the .msg files and remove the addresses.
Note : The are large pauses in the execution at the moment at the moment I am using:
# change directory and get list of messages
opendir(EM_DH, $Backup_Path) or die "Cannot find to directory $Backup_Path $!";
@Emails = readdir EM_DH;
close(EM_DH);
# loop through all messages and remove addresses
foreach (@Emails) {
undef $FileString;
if ($_ =~ /msg$/i) {
$CurrEmail = $_;
open(FH, $Backup_Path.$CurrEmail) or die "Cannot open file $!";
while(<FH>) {
$FileString = $FileString.$_;
}
close(FH);
# parse the info
($FromInfo, $Body) = ParseData($FileString);
Anyway I use Email::Simple to remove the 'from' address.
Is there a quick way to loop through the .msg files and remove the addresses.
Note : The are large pauses in the execution at the moment at the moment I am using:
# change directory and get list of messages
opendir(EM_DH, $Backup_Path) or die "Cannot find to directory $Backup_Path $!";
@Emails = readdir EM_DH;
close(EM_DH);
# loop through all messages and remove addresses
foreach (@Emails) {
undef $FileString;
if ($_ =~ /msg$/i) {
$CurrEmail = $_;
open(FH, $Backup_Path.$CurrEmail) or die "Cannot open file $!";
while(<FH>) {
$FileString = $FileString.$_;
}
close(FH);
# parse the info
($FromInfo, $Body) = ParseData($FileString);