Solved

MailApp Apple script help

Posted on 2004-08-22
3
300 Views
Last Modified: 2013-11-17
I have never written an applescript, and would
very much appreciate any help that anyone could give.

I am trying to find a way to copy the long header information
from all the messages in my junk mail box into a single
document; I then send the information on to our system
manager, who uses it to control spam.

Any suggestions will be appreciated.
0
Comment
Question by:mrocek
  • 2
3 Comments
 
LVL 30

Expert Comment

by:weed
ID: 11866549
Hmmm, not quite sure how you want to go about that one. Writing an applescript would work, but youre going to need more than a basic understanding of applescript to do it. It might just be easier to show the package contents on your Junk mailbox in the ~/library/mail folder. Find the mbox file within it, and send them the file. It's got all the junk with headers. If you wanted to clean it up for them, you could write a grep search/replace in BBEdit which would be easier than applescript.
0
 
LVL 23

Accepted Solution

by:
brettmjohnson earned 500 total points
ID: 11872698
You can run the following command from Terminal.app.
(It is all one line)

awk '/^[Ff]rom / { inhead = 1 }; /^$/ {if (inhead)  { print; inhead = 0; }}; { if (inhead) print; }' ~/Library/Mail/Mailboxes/Junk.mbox  > ~/Desktop/JunkHdrs.txt

0
 
LVL 23

Expert Comment

by:brettmjohnson
ID: 11876818
I just noticed a dumb error in my poste.  We need to parse the mbox file inside the Junk.mbox directory:

awk '/^[Ff]rom / { inhead = 1 }; /^$/ {if (inhead)  { print; inhead = 0; }}; { if (inhead) print; }' ~/Library/Mail/Mailboxes/Junk.mbox/mbox  > ~/Desktop/JunkHdrs.txt

0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Thanks to luck and dedication (hitting refresh every 5 seconds when the pre-orders were going live at midnight on April 10th) I managed to actually receive an Apple Watch on release day, April 24th. Which means I’ve been using it daily for just ov…
In this article we will discuss some EI Capitan Mail app issues and provide some manual process to resolve them.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question