This is a module containing methods that know how deliver to various kinds of message folder types.
Deliver message to an mbox filename.
The each method on message is used to get each line of the message. If the first line of the message is not an mbox From_ header, a fake one will be generated.
The file named by filename is opened for append, and flock locking is used to prevent other processes from modifying the file during delivery. No ".lock" style locking is performed. If that is desired, it should be performed before calling this method.
Returns the name of the file delivered to, or raises an exception if delivery failed.
Write to an already opened mbox file. This low level function just takes care of escaping From_ lines in the message. See deliver_mbox for a more robust version.
Deliver message to a pipe.
The supplied command is run in a sub process, and message.each is used to get each line of the message and write it to the pipe.
This method captures the Errno::EPIPE and ignores it, since this exception can be generated when the command exits before the entire message is written to it (which may or may not be an error).
The caller can (and should!) examine $? to see the exit status of the pipe command.
Deliver message to a filter and provide the io stream for reading the filtered content to the supplied block.
The supplied command is run in a sub process, and message.each is used to get each line of the message and write it to the filter.
The block passed to the function is run with IO objects for the stdout of the child process.
Returns the exit status of the child process.
Delivery message to a Maildir.
See cr.yp.to/proto/maildir.html for a description of the maildir mailbox format. Its primary advantage is that it requires no locks -- delivery and access to the mailbox can occur at the same time.
The each method on message is used to get each line of the message. If the first line of the message is an mbox From_ line, it is discarded.
The filename of the successfully delivered message is returned. Will raise exceptions on any kind of error.
This method will attempt to create the Maildir if it does not exist.