473,386 Members | 1,763 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Parsing mailboxes

Problem: Mozilla mailbox is way to big (800MBs).
Solution: Split it up.

#!/usr/bin/perl

############
# Splits Mozilla style Inboxes into smaller ones (max size = maxMailboxSize)
# use: ./splitMozilla <mailbox name>
# output: mailbox0 [mailbox1] [mailbox2] ...
############

$maxMailboxSize = 104857600;
$mailboxNumber = 0;
open OUTPUTFILE, ">mailbox$mailboxNumber";

while(<>) {
if(/^From /) {
if((stat(OUTPUTFILE))[7] > $maxMailboxSize) {
close OUTPUTFILE;
$mailboxNumber ++;
open OUTPUTFILE, ">Inbox$mailboxNumber";
}
}
print OUTPUTFILE $_;
}

Problem: It's not working. It's creating mailbox0, writes about 1.9MBs, then
the system runs out of memory, which shouldn't happen. What I'm basically
trying to do is search for a new message, check if the outputfile is over
100MBs, if it is, create a new one, if it's not, then write the message to
outputfile. Any ideas?

-Chris Mika
cmika@-takethisout-25thandclement.com
Jul 19 '05 #1
1 2761
Have you taken into consideration the summary file?
This is from my netscape knowledge but I assume mozilla is the same.
If you change a mail folder you have to first kill netscape (mozilla)
delete the coresponding .summary file and let netscape (mozilla)
re-create
the summary file when it starts again.
The summary files are hidden use ls -al to see them. (in the unix world)

-s

cmika@-takethisout-25thandclement.com wrote:

Problem: Mozilla mailbox is way to big (800MBs).
Solution: Split it up.

#!/usr/bin/perl

############
# Splits Mozilla style Inboxes into smaller ones (max size = maxMailboxSize)
# use: ./splitMozilla <mailbox name>
# output: mailbox0 [mailbox1] [mailbox2] ...
############

$maxMailboxSize = 104857600;
$mailboxNumber = 0;
open OUTPUTFILE, ">mailbox$mailboxNumber";

while(<>) {
if(/^From /) {
if((stat(OUTPUTFILE))[7] > $maxMailboxSize) {
close OUTPUTFILE;
$mailboxNumber ++;
open OUTPUTFILE, ">Inbox$mailboxNumber";
}
}
print OUTPUTFILE $_;
}

Problem: It's not working. It's creating mailbox0, writes about 1.9MBs, then
the system runs out of memory, which shouldn't happen. What I'm basically
trying to do is search for a new message, check if the outputfile is over
100MBs, if it is, create a new one, if it's not, then write the message to
outputfile. Any ideas?

-Chris Mika
cmika@-takethisout-25thandclement.com

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Jed Parsons | last post by:
What headers to I have to know about to build thread trees from Unix mailboxes? Is it enough to get the In-Reply-To header for each message and build a dictionary of { Message-ID: message }...
1
by: Eric S. Johansson | last post by:
I've been searching around for the equivalent to the mailbox module except with the capability of writing messages as well as reading. If it makes it easier, I only need to write to maildir...
3
by: Laszlo Zsolt Nagy | last post by:
Hi All, I need to create a daemon that sits on a server and forwards some e-mails. (Well not only that, it needs to change header information before forwarding and also insert messages into a...
0
by: skippy | last post by:
I am writing a program in C# that needs to create and modify exchange mailboxes/recipients on our exchange 5.5 server. I had this working a long time ago in VB but I can not find any code in .net...
4
by: Ron Vecchi | last post by:
I a runnning w2k3 pop3 mail server that came with iis6. I would like to write an application that progammtically creates the new mailboxes in an already established mail domain. Does anyone know...
1
by: Gustaf | last post by:
I'm converting a program I made in Python once to C#, and while I'm at it, I want to do some performance improvements. The program takes a set of mailbox files (in readable formats, like Eudora and...
3
by: sandip desale | last post by:
Dear All, I have a python dictionary file. I want to create a map of that dictionary and want to use the same in my Java Program. Can anybody please tell me how to use the same python dictionary...
13
by: Phillip B Oldham | last post by:
Is there a standard library for parsing emails that can cope with the different way email clients quote?
0
by: Maric Michaud | last post by:
Le Monday 18 August 2008 12:43:02 Gabriel Genellina, vous avez écrit : escribió: Three options here : - dealing directly with outlook mailboxes files, I used some open source code to parse...
0
by: Ahmed, Shakir | last post by:
Thanks everyone who tried to help me to parse incoming email from an exchange server: Now, I am getting following error; I am not sure where I am doing wrong. I appreciate any help how to resolve...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.