C-Command Software Forum

Programmatically sending emails to EagleFiler

I want to write a script that will send some emails to EagleFiler without me having to manually do a capture, so a capture script seems inappropriate. Also, this is unrelated to any existing MUA - my script has emails in memory, but I may not want them as files anywhere on disk (outside of EagleFiler, that is).

After poking around, it seems like this is the best/only way to accomplish this:

  1. write the email thread to an mbox file with a meaningful name in /tmp

tell application “EagleFiler”
import files {POSIX file “/tmp/meaningfulname.mbox”}
end tell

Is that the best way, or is there a way to get EF to import a string as mbox?


There’s no way to get it to import a string as a mbox. You might want to look into writing the e-mail(s) to a .efmaildir folder, like the Entourage/Mailsmith/PowerMail capture scripts do. This could be easier than generating a properly formed mbox file yourself, and it would allow you to set the metadata of the individual messages.

OK, sounds good. mbox is easy enough, but setting metadata would also be nice. Is there a reference for the efmaildir format?

A little poking around in the Mailsmith script and it looks like I have a .efmaildir with one Info.plist that just has the mailbox name, and one mbox-formatted file named n.eml for each message, with a corresponding n.plist that has noteString and tag_# fields.

It looks like the mailsmith script asks for RFC822 and gets mbox - in my quick test,
my writeData(_messagePath, _message’s RFC822 message)
appears to have resulted in a file starting in
From ???@??? Tue Aug 18 14:03:52 2009

So I’ll assume that either mbox or rfc822 is OK…

Also, Are there any other keys I can add to the emlmeta dict in the n.plist files?

Thanks for the quick response!

Sorry, there’s not, but it sounds like you’ve figured it out.