Reading message size

  • Thread starter Edvard Majakari
  • Start date
E

Edvard Majakari

I'm trying to create an improved front-end for training messages for a
spam filter. I discovered an excellent Python module email - now it's so
easy to support variety of mailbox formats. However, I need to know exact
size of the message (in bytes) and skip the message if it is too large,
before passing the message to filter.

This is easy with MH or Maildir style directories - because each message
is on separate file, it is trivial to get the file size. However, with
mbox or any other format containing several messages in a file, I'm unable
to find out individual message size.

Of course, I could find this out by writing a message to a temp file and
afterwards checking the temp file size, but I think that's awkward and
inelegant. Is it somehow possible with email module?

--
# Edvard Majakari Software Engineer
# PGP PUBLIC KEY available Soli Deo Gloria!

$_ = '456476617264204d616a616b6172692c20612043687269737469616e20'; print
join('',map{chr hex}(split/(\w{2})/)),uc substr(crypt(60281449,'es'),2,4),"\n";
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,279
Latest member
LaRoseDermaBottle

Latest Threads

Top