extract bulk emails into a single flat file

Hello

Can someone guide me how to extract bulk emails into a single flat file ?

We receive mails (approx 1K daily ).
I want the contents of the emails for 'current date' to be dumped into one single text file.

Please help.

Email boxes are already in a flat file format.

If you want to spilt the mail into seperate files on a daily base do something like this:

Create a ".forward" file in the home directory of the account which receives the mail.

Notice the DOT in front of forward.

The ".forward" file could look like something like this:

cat .forward
---------------------------------------------
"|<some path>/splitmail.sh"
---------------------------------------------

where <some path> needs to be replaced by the actual path where the script "splitmail.sh" is located.

The ".forward" file will cause the email to be send to the script "splitmail.sh".

The "splitmail.sh" script could look like something like this:

cat splitmail.sh
---------------------------------------------
#!/usr/bin/ksh
DATE=`date +%Y%m%d`

cat - >> <some path>/mail.${DATE}
---------------------------------------------

Replace <some path> by the location where you want the files to be created.

This is just a basic example. As a result all mail will end up in files on a day base. So no mail will be present in the "normal" inbox.

It is possible to have it both, so as well in seperate files as well as still in the inbox.

See the manual pages for "forward".

There are programs/tools out there which allow you to manipulate mail in a far more complex way. One of them is "procmail".