Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MailApp Apple script help

Posted on 2004-08-22
3
Medium Priority
?
318 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 2000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

A professional opinion on which Apple product to buy, and a tidbit about the WWDC.
Article by: Justin
In light of the WannaCry ransomware attack that affected millions of Windows machines, you might wonder if your Mac needs protecting. Yes, it does and here is how to do it.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

971 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