Module Mail::Deliver
In: /home/matt/rubymail/mail/deliver.rb
This is a module containing methods that know how deliver to various kinds of message folder types.
Methods
deliver_maildir    deliver_mbox    deliver_pipe   
Public Instance methods
deliver_mbox(filename, message)
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.

deliver_pipe(command, message)
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_maildir(dir, message)
Delivery message to a Maildir.

See http://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.