I need a create a specific type of file in OS X. It needs resources in a specific way. Currently, the only way I can find to do this is in AppleScript with an OSAX. This is slow, about 1 second round trip to run, since the OSAX must open, load, do it's job, and quit. I have explored doing it in C, but that would be a last resort, as there always seems to be issues building apps out to make them work across multiple machines.
I was thinking, perhaps perl, or ideally bash could pull it off, but I am not 100% sure. The specs of what I need to do are as follows:
Create a text file, formatted as an email message (RFC 822/RFC 2822 format).
Text files must have an 'STR ' resource ID 8192 with an email address (will be used as the SMTP MAIL FROM address) and an 'STR#' resource ID 8192 with the recipient addresses (will be used as the SMTP RCPT TO addresses).
The text file should have CRLF as the line endings, and a 'BODY' resource ID 8192 should be added.
The 'BODY' resource should contain a 4 byte value, '822 ' for an unspecified body type, '7BIT' for 7-bit data, '8BIT' for 8-bit data, and 'BINM' for binary data.
Of course, the text file creation parts are simple, but stuffing those 'STR ' resources in has me stumped.