LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to dump emails to files? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-dump-emails-to-files-633989/)

oskeewow 04-08-2008 02:16 PM

How to dump emails to files?
 
Hello! I'm trying to come up with a script to extract data from emails. I have many servers in different cities emailing stats to a server at home office. Now I need a script to sort each mail by cities and dump data to separate files. My initial approach is to run a script to process /var/mail/mystat. "mystat" being the unique account setup just for this purpose. Using bunch of shell commands in a script, I am trying to generate separate files. What I am wondering is...Is there a more elegant way to do this? Or is this the pretty much the only approach one can take? Thanks for yoru time!

forrestt 04-08-2008 02:22 PM

A better approach is probably to set up a mail alias to a script that will parse each email as it arrives and then does what you want with the data that is parsed.

HTH

Forrest

billymayday 04-08-2008 05:31 PM

You could either use Maildir format in which each message is a separate file, or at lease use a mbox to maildir converter to convert the mbox file into separate files as the first step in your procerssing


All times are GMT -5. The time now is 08:38 PM.