Solved

MailApp Apple script help

Posted on 2004-08-22
3
304 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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

Apple's line of laptop computers has made significant strides forward in the last few years. The biggest change being the switch to Intel processors in 2005. One thing about Apple hardware, especially that from a few years ago, is the tendency for i…
There is a security feature on iOS devices that is nearly impenetrable when it has been activated.  This article will provide some possible solutions as well as necessary steps to take to ensure you do not end up with a locked device.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

839 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