Solved

MailApp Apple script help

Posted on 2004-08-22
3
294 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
Comment Utility
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
Comment Utility
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
Comment Utility
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 your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article describes in detail how to set up the iPad in the Enterprise using iPCU aka iPhone Configuration Utility.  This could also be used for the iPhone although I have not detailed out any differences. Preparation as an iPad Administrator:…
In this article we have discussed about the OS X EI Capitan and how to fix Wi-Fi issue in OS X El Capitan. We have explained how to delete system level preferences and create a new Wi-Fi location to resolve Wi-Fi issue.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now