16.5. The Full Flow

 <  Day Day Up  >  

The design example presented in this chapter separated responsibilities into a SendingMailServer and ReceivingMailServer . In some mail systems (such as the sendmail program), SendingMailServer and ReceivingMailServer functionality is handled by the same program. Other systems (such as qmail ) break the functionality into multiple programs. For example, the qmail-smptd program acts as a ReceivingMailServer , the qmail-lspawn / qmail-local program handles delivery to the user , and the qmail-rspawn /qmail-remote program acts as a SendingMailServer .

To see how the responsibilities for a full mail system can be separated into multiple processes ("Do a Little Job Well and You May Be Called Upon Often"), look at Figure 16-4, which is an outline for a design for a complete system. [*]

[*] An additional process ”a relay ”can be part of the flow. A relay acts as a ReceivingMailServer and a SendingMailServer . Relaying mail, except from trusted SendingMailServer s, is strongly discouraged by antispam guidelines.

Figure 16-4. Processes for delivering mail

Each process plays a role in delivering mail ("Separate of Concerns to Make Smaller Concerns"):



SendingUserAgent

This user agent (e.g., Outlook, Eudora, etc.) creates mail and sends it to a SendingMailInputServer . [*]

[*] The SendingMailInputServer might require the same SMTP port (port 25) as a ReceivingMailServer to receive mail from SendingUserAgent s. Only one process on a host can listen on a particular port. If both processes require the SMTP port, placing each server on a different host avoids this conflict.



SendingMailInputServer

The server is responsible for verifying that SendingUserAgent has permission to send mail to it and that the sending_user in the Envelope represents an EmailAddress for which the SendingUserAgent has permission to send mail.

The server transforms the mail into a MailDTO . It calls MailExaminers to check for spam. If the message is determined to be spam, it can refuse to deliver the message and notify the SendingUserAgent of this decision along with the MailReport . Alternatively, it can send the message, but notify the sender with a message that includes the MailReport . Messages to be sent are placed on a SendingMailQueue along with an Envelope .



MailExaminers

In addition to the checks performed for ReceivingMailServer s, specific MailExaminers could also:

  • Check for mail limitations by the user

  • Check for mail for conformity to header requirements

  • Check that the "From:" header comes from a domain for which the host is a SendingMailServer



SendingMailServer

  • Takes the messages in the SendingMailQueue and contacts the ReceivingMailServer for each recipient's domain.

  • Transfers the message using SMTP, as described earlier in this chapter.

  • If the ReceivingMailServer refuses to accept responsibility for delivery (transient or permanent failure), it sends back a message to the SendingUser .



ReceivingMailServer

  • Contacted by the SendingMailServer to receive messages for one or more domains, as shown in this chapter.

  • If a mail message has been accepted for one or more recipients, it places the message in the ReceivingMailQueue along with the Envelope and the MailReport .



ReceivingMailOutputServer

  • Reads the ReceivingMailQueue and delivers each message to the recipient's mailboxes.

  • Alters the recipients in the Envelope based on address aliases.

  • Distributes to individual identity mailboxes according to the Envelope .

  • Checks individual user configurations to see what form is desired for delivery of the MailReport (e.g., appended to the end of the message, added as header lines, or ignored).



ReceivingUserAgent

  • This user agent (e.g., Outlook, Eudora, etc.) retrieves mail from a mailbox and displays it to the user.

 <  Day Day Up  >  


Prefactoring
Prefactoring: Extreme Abstraction, Extreme Separation, Extreme Readability
ISBN: 0596008740
EAN: 2147483647
Year: 2005
Pages: 175
Authors: Ken Pugh

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net