Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How do I extract "subject text" from emails inside Netscape 7.1

mydelphimydelphi Member Posts: 62
Hi,

I'm back. Its been a long time since I last asked for some
help here.

In my Netscape 7.1 email, every email I get at the end of the day,
I dump inside a folder, and name it that date,

For example:

feb_1505
feb_1605
feb_1705
.
.

I would love to know how to take all my Netscape 7.1 emails
in each of those folders (goes back all the way to June 2004)
that I have dumped into folders and only extract the SUBJECT
and DATES of everyone in each folder.

The format will probably be a simple one for now, until I
parse everything at once. But, I think all the ELEMENTS that
I need are:

SUBJECT ----- SENDER ----- DATE

I want to create a database (I already have a working db, and its
used in a similar project) for all these emails, so that I can
view every piece that has ever come to me since June 2004 (and
I have thousdands of them (mostly junk spam, but still worth the
fun project) Plus, I was told in a few instances, where people
claimed to have sent me email, but I was sure I did not recieve
such. But, because I did not delete any since 06/2004, I figure
that if they did send me email, I'll find it in the archived
folders for sure. It will prove an interesting quest.

I want to do this in the least painful may. I don't want to cut
and paste each email. That would take a year to do.

Any advice or large steps would be much appreciated.

Thank you all,
-mydelphi

Comments

  • zibadianzibadian Member Posts: 6,349
    : Hi,
    :
    : I'm back. Its been a long time since I last asked for some
    : help here.
    :
    : In my Netscape 7.1 email, every email I get at the end of the day,
    : I dump inside a folder, and name it that date,
    :
    : For example:
    :
    : feb_1505
    : feb_1605
    : feb_1705
    : .
    : .
    :
    : I would love to know how to take all my Netscape 7.1 emails
    : in each of those folders (goes back all the way to June 2004)
    : that I have dumped into folders and only extract the SUBJECT
    : and DATES of everyone in each folder.
    :
    : The format will probably be a simple one for now, until I
    : parse everything at once. But, I think all the ELEMENTS that
    : I need are:
    :
    : SUBJECT ----- SENDER ----- DATE
    :
    : I want to create a database (I already have a working db, and its
    : used in a similar project) for all these emails, so that I can
    : view every piece that has ever come to me since June 2004 (and
    : I have thousdands of them (mostly junk spam, but still worth the
    : fun project) Plus, I was told in a few instances, where people
    : claimed to have sent me email, but I was sure I did not recieve
    : such. But, because I did not delete any since 06/2004, I figure
    : that if they did send me email, I'll find it in the archived
    : folders for sure. It will prove an interesting quest.
    :
    : I want to do this in the least painful may. I don't want to cut
    : and paste each email. That would take a year to do.
    :
    : Any advice or large steps would be much appreciated.
    :
    : Thank you all,
    : -mydelphi
    :
    Start with opening a few of those e-mail files in the notepad. This way you can get a sense of their internal structure. Most e-mail files are text-files with each field of the header per line followed by the body of the mail. Other methods involve delimiters to separate the fields. Unless there is an encryption, this method will show you how the e-mails are stored.
    Once you know this, it is quite easy to write a procedure which can fill a TStrings object with the entire mail or extract the necessary fields. You can then append a new DB-record and fill it with the values of those variables.
    Here is a short pseudo-code to iterate through all the folders and the mails:
    [code]
    procedure SearchDir(BaseFolder: string);
    var
    SR: TSearchRec;
    begin
    if FindFirst(BaseFolder+'*.*', faAnyFile, SR) = 0 then repeat
    if (SR.Attr and faDirectory = faDirectory) and (SR.Name[1] <> '.') then
    // Process a subfolder, but not the '.' and '..' folders
    SearchDir(IncludeTrailingBackSlash(BaseFolder+SR.Name))
    else
    ProcessMail(BaseFolder+SR.Name);
    Application.ProcessMessages;
    // Do not appear to be locked
    until FindNext(SR) <> 0;
    FindClose(SR);
    end;
    [/code]
    You need to write the ProcessMail() procedure yourself. This should process 1 e-mail and takes the filename (including path) as a parameter.
  • mydelphimydelphi Member Posts: 62
    Hello again.

    Thank you for your help.

    I'm not sure if you understood what I was explaining with the
    emails and netscape and the folders.

    When I said that I dump every email I receive in a day into a
    folder, I did not mean a folder on my desktop or pc.
    I ment a folder inside my netscape email.

    My natscape email follows like this pattern:

    -> myProvider.com
    -- Inbox
    -- Drafts
    -- Templates
    -- Sent
    -- Trash
    -- jan_0105
    -- jan_0205
    -- .
    -- .
    -- feb_1505
    -- feb_1605
    -- feb_1705
    -- .
    -- .

    Here, in more detail, the folders:

    -> myProvider.com
    -- Inbox
    -- Drafts
    -- Templates
    -- Sent
    -- Trash
    -- jan_0105
    ---- june_mail_001
    ---- june_mail_002
    ---- june_mail_003
    ---- june_mail_004
    -- jan_0205
    ---- june_mail_001
    ---- june_mail_002
    ---- june_mail_003
    ---- june_mail_004
    -- .
    -- .
    -- feb_1505
    ---- june_mail_001
    ---- june_mail_002
    ---- june_mail_003
    ---- june_mail_004
    -- feb_1605
    ---- june_mail_001
    ---- june_mail_002
    ---- june_mail_003
    ---- june_mail_004
    -- feb_1705
    ---- june_mail_001
    ---- june_mail_002
    ---- june_mail_003
    ---- june_mail_004
    -- .
    -- .

    All this inside my netscape email.

    What I want to do now, is just grab the elements I described
    in my first post here. So for example, lets say I want to
    grab all the elements that are in folder feb_1705, it would
    look something like this, (assuming I can dump text, inside
    a listbox control in column 1, 2 and 3):

    (1) ------ (2) ------- (3)

    SUBJECT ------ SENDER ------ DATE
    june_mail_001 abc@mail.com 02-17-05
    june_mail_002 xyx@mail.com 02-17-05
    june_mail_003 redx@mail.com 02-17-05
    june_mail_004 blue@mail.com 02-17-05

    Thanks again for you help,
    -mydelphi
  • zibadianzibadian Member Posts: 6,349
    : Hello again.
    :
    : Thank you for your help.
    :
    : I'm not sure if you understood what I was explaining with the
    : emails and netscape and the folders.
    :
    : When I said that I dump every email I receive in a day into a
    : folder, I did not mean a folder on my desktop or pc.
    : I ment a folder inside my netscape email.
    :
    : My natscape email follows like this pattern:
    :
    : -> myProvider.com
    : -- Inbox
    : -- Drafts
    : -- Templates
    : -- Sent
    : -- Trash
    : -- jan_0105
    : -- jan_0205
    : -- .
    : -- .
    : -- feb_1505
    : -- feb_1605
    : -- feb_1705
    : -- .
    : -- .
    :
    : Here, in more detail, the folders:
    :
    : -> myProvider.com
    : -- Inbox
    : -- Drafts
    : -- Templates
    : -- Sent
    : -- Trash
    : -- jan_0105
    : ---- june_mail_001
    : ---- june_mail_002
    : ---- june_mail_003
    : ---- june_mail_004
    : -- jan_0205
    : ---- june_mail_001
    : ---- june_mail_002
    : ---- june_mail_003
    : ---- june_mail_004
    : -- .
    : -- .
    : -- feb_1505
    : ---- june_mail_001
    : ---- june_mail_002
    : ---- june_mail_003
    : ---- june_mail_004
    : -- feb_1605
    : ---- june_mail_001
    : ---- june_mail_002
    : ---- june_mail_003
    : ---- june_mail_004
    : -- feb_1705
    : ---- june_mail_001
    : ---- june_mail_002
    : ---- june_mail_003
    : ---- june_mail_004
    : -- .
    : -- .
    :
    : All this inside my netscape email.
    :
    : What I want to do now, is just grab the elements I described
    : in my first post here. So for example, lets say I want to
    : grab all the elements that are in folder feb_1705, it would
    : look something like this, (assuming I can dump text, inside
    : a listbox control in column 1, 2 and 3):
    :
    : (1) ------ (2) ------- (3)
    :
    : SUBJECT ------ SENDER ------ DATE
    : june_mail_001 abc@mail.com 02-17-05
    : june_mail_002 xyx@mail.com 02-17-05
    : june_mail_003 redx@mail.com 02-17-05
    : june_mail_004 blue@mail.com 02-17-05
    :
    : Thanks again for you help,
    : -mydelphi
    :
    This makes it somewhat more difficult to get the data, but if it is stored on your harddisk and not encrypted it is still possible. You need to learn how to read that data. It will however be stored in a binary file, which you can read using either a file of char or an untyped file. The former is easier to code, while the latter is quicker. I'm not familiar with the Netscape mail file format and I'm not using Netscape, so I cannot offer you assistance in reading the mail file.
Sign In or Register to comment.