If a mailbox is open in Mail.app, appnmail delivers the message into a temporary mbox inside the mailbox, and then signals Mail.app to incorporate the message in the main mbox. If another program (typically another appnmail process) has locked a mailbox which the program tries to access, it will sleep for a couple of seconds and try again until the mailbox has become available.
If appnmail is invoked with the -n option the message will not be incorporated in open mailboxes. However it has been appended to a temporary mbox, so it will be delivered the next time appnmail visits this mailbox.
The -i option forces a check for the existence of this temporary mbox, and incorporates it into the main mailbox if it exists. When this option is given, the message is optional: if appnmail is invoked interactively, the message is not read if stdin is the tty (but it will be read if redirected from a file, or piped in; an empty message is ignored. Therefore the safest way to invoke it from a script is by redirecting /dev/null to stdin.)
By default appended messages are marked as unread. The -r, -d and -f options will cause the message to be marked read, deleted or flagged respectively. The -p option allows the user to override the default priority level of the message. Valid values are 0 for no priority, 1 for highest priority and 2 for second highest priority, and so on.
Adding the option -v causes appnmail to be more verbose about what it does. Multiple -v options increase the level of verbosity.
The -H option displays a summary of the options that appnmail responds to, and -V shows the program's version.
Appnmail works both with NeXTmail and standard Mime- and plain-text mail.
Append a message called `msg' to the Mailboxes OldMail and Outgoing:
appnmail <msg OldMail Outgoing
Typical lines to use in a ~/.procmailrc to append all messages from the MiscKit mailing list to the mailbox misckit. (Before you use this make sure that appnmail is in the path specified at the beginning of the ~/.procmailrc file.):
:0 * ^TOmisckit@yacktman.com | appnmail misckit
Appnmail knows how to handle some European Mime-header encodings (iso-8859-1 and partially iso-8859-2); Japanese encodings are not yet supported. For procmail delivery you can work around this by inserting the following recipe in your ~/.procmailrc, before any rule that invokes appnmail:
:0fh * ^(From|Subject): .*=\?iso-2022-jp\? | nkf -e -m
Nkf is Itaru Ichikawa <ichikawa@flab.fujitsu.co.jp>'s Network Kanji code conversion Filter, and is included in the mailapp-utilities distribution.
If appnmail is used in conjunction with a mail delivery package like procmail, it is worth noting that it should not be used to put mail in the Active mailbox. Most users will keep the Active mailbox opened and locked in Mail.app whenever they are logged in at the console. Though appnmail does its best to incorporate messages in an open mailbox, it circumvents Mail.app's normal mail-detection and -retrieval mechanism, so you won't get the animated icon and sound when new mail arrives. It may even interfere with automatic mail retrieval, possibly resulting in loss of messages. Instead mail intended for the Active mailbox should be put into the mail spool directory as it normally would be done by default.
`Message is not in UNIX mailbox format' if the message on the standard input doesn't begin with the strings `From '. This occurs for example when trying to find raw mh messages to appnmail.
Delivery into open mailboxes may not work with Mail.app versions before 3.2.
The task was made considerably easier by Chris Paris <cap+@cmu.edu> decoding of the Mail.app transmission and storage formats.
Tom Hageman <mailapp-utilities@basil.icce.rug.nl> is the current maintainer.