Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

iHateMacs

macrumors 6502a
Original poster
Aug 13, 2008
654
24
Coventry, UK
Can someone point me in the right direction here.

Is what I am asking below possible to do in Automator or Applescript? (whichever is simplest)

I have hundreds of emails (EDIT 5000 !). Each one contains an XML representation of an order placed through our website.

Later on I want to parse the XML and get customer data from it, but first I need to save all these emails as individual files.

So all I need to automate is the saving of the contents of each email into a file. The file can be named anything, it doesn't matter. A sequential number would be ideal, but doesn't matter.

Can this saving of emails be done with automator/applescript or is there a better way? Anything is better than cutting and pasting each one.
 
Last edited:

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
If you are using Apple Mail then, most likely, the messages are already some where in ~Library/Mail in .emlx format. For example, for me, in ~Library/Mail/Mac-robbieduncan/Forums/MacRumors.imapbox I currently have 19844 .emlx files, one for each mail in that mailbox.

The .emlx format is plain text and looks OK to extract the contents from...
 

iHateMacs

macrumors 6502a
Original poster
Aug 13, 2008
654
24
Coventry, UK
Thanks for that. I didn't know.

I don't understand the hierarchy, but as all my data is XML I should be able to look through all the files and grab what I need.

At least they are all in one account so that will reduce the number of files.

Thanks again.
 

iHateMacs

macrumors 6502a
Original poster
Aug 13, 2008
654
24
Coventry, UK
After all that I have found an even simpler way DOH!

Select the emails in large groups (1000 at a time seems to work ok) then choose FORWARD. When the new email opens up copy and paste into a text file.

I only had to do that 5 times.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
After all that I have found an even simpler way DOH!

Select the emails in large groups (1000 at a time seems to work ok) then choose FORWARD. When the new email opens up copy and paste into a text file.

I only had to do that 5 times.

Even better :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.