How to export emails from Mail into a text format
apple Verified ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
I'd like to export only emails from my Spam folder into a format I can then import into Excel. All I essentially need is the Subject and From fields. Does anyone know how I can do this?
7 replies
Sign in or join Beachball Help to reply.
- 0
SacMac ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Gaging by the lack of responses over the last week I guess you can't do it.
- 0
elmac ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Hi, Open email, then -> File -> Save As (I save to desktop) when it is on the desktop Right click and select say TextEdit -> the email will open as a text doc with everything you need...L
- 0
SacMac ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
I know how to save/export individual messages. What I'm trying to do is export ALL the messages out of a particular box without having to do so individually.
- 0
elmac ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Hi, try this link:-
http://mac.softpedia.com/get/Utilities/Export-Messages.shtml
...LMessage was edited by: elmac
- 0
CJLinst ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
1. Select all messages with Cmd-A
2. File -> Save As
3. Choose a descriptive filename
4. Save as Format: "Raw Message Source"You'll end up with a standard mbox file of all selected messages.
Credit to:
http://www.macosxhints.com/article.php?story=20060706201156481You could then write a perl script to walk through the mbox outputting the headers in CSV or whatever.
- 0
CJLinst ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Or python:
import mailbox
import csv
writer = csv.writer(open("mbox.csv", "wb"))
for message in mailbox.mbox('mailbox.mbox'):
writer.writerow([message['message-id'], message['subject'], message['from']]) - 0
Barney-15E ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
This applescript will work directly into Excel:
tell application "Microsoft Excel"
set theSpamFile to make new workbook
set theSheet to active sheet of theSpamFile
set formula of range "B1" of theSheet to "Subject"
set formula of range "A1" of theSheet to "From"
end tell
tell application "Mail"
set theRow to 2
get mailboxes
set theMessages to messages of junk mailbox
repeat with aMessage in theMessages
my SetFrom(sender of aMessage, theRow, theSheet)
my SetSubject(subject of aMessage, theRow, theSheet)
set theRow to theRow + 1
end repeat
end tell
on SetFrom(theSender, theRow, theSheet)
tell application "Microsoft Excel"
set theRange to "A" & theRow
set formula of (range theRange) of theSheet to theSender
end tell
end SetFrom
on SetSubject(theSubject, theRow, theSheet)
tell application "Microsoft Excel"
set theRange to "B" & theRow
set formula of range theRange of theSheet to theSubject
end tell
end SetSubject