The vengefulcow site's code is nice, but needs a slight modification if you're messing with newer OSX mail.app versions and imap mailboxes, here's a unified diff:
$ diff -u emlx2mbox/emlx2mbox.rb emlx2mbox-works/emlx2mbox.rb
--- emlx2mbox/emlx2mbox.rb 2006-12-13 12:02:41.000000000 -0500
+++ emlx2mbox-works/emlx2mbox.rb 2014-02-16 01:28:38.775293976 -0500
@@ -56,7 +56,7 @@
# Compile messages in mbox directories.
mbox_dirs = Dir.entries(source_dir).find_all do |entry|
File.directory?("#{source_dir}/#{entry}") and
- (entry[-5..-1] == ".mbox")
+ (entry[-9..-1] == ".imapmbox")
end #find_all
mbox_dirs.each do |dir|
if File.directory?("#{source_dir}/#{dir}/Messages")
@@ -68,7 +68,7 @@
subdirs = Dir.entries(source_dir).find_all do |entry|
File.directory?("#{source_dir}/#{entry}") and
entry[0, 1] != "." and
- entry[-5..-1] != ".mbox"
+ entry[-9..-1] != ".imapmbox"
end #do
subdirs.each do |dir|
self.convert_mailboxes("#{source_dir}/#{dir}", "#{dest_dir}/#{dir}")
I suspect that your answer here will be mail rules, and AppleScript. Rather than relying on parsing out the raw messages, you can create a rule to filter on the bad status messages and then run an AppleScript, and another on the Ok.
To learn about AppleScript and the Mail dictionary: enter Introduction to Scripting Mail
Mail rules are set in Preferences on the Rules tab.
AppleScripts for mail are installed in $HOME/Library/Application Scripts/com.apple.mail/ Helpfully, when you choose AppleScript from the rules dropdown it'll give you the option to open that folder.
You can probably accomplish this with a single script, run when an OK message is received, to check the inbox for bad messages and mark them as read, along with the current message.
Assuming you mean shell scripting by command line, which is comparable to AppleScript - if anything AppleScript is easier, being designed to be English-like and quite readable.
To view the available commands in AS for Mail.app you can open Script Editor (Applications/Utilities), then File->Open Dictionary. Open the Mail dictionary for the command reference guide.
Alternatively, you can try this the *nix way here, but, on a Mac, the Mac way is often easier.
Best Answer
It looks like an Universally Unique Identifier (UUID) is a 128-bit number used to identify information in computer systems.
Anyone can create a UUID and use it to identify something with near certainty that the identifier does not duplicate one that has already been created to identify something else, and will not be duplicated in the future. Information labeled with UUIDs by independent parties can therefore be later combined into a single database, or transmitted on the same channel, without needing to resolve conflicts between identifiers.
In its canonical string representation, the sixteen octets of a UUID are represented as 32 lowercase hexadecimal (base 16) digits, displayed in five groups separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters (32 alphanumeric characters and four hyphens). For example: