Mail Sending

The mail sending application allows other applications to send email. This document provides a high-level overview of the capabilities of the application. More detailed documentation is also available:

Statistics

Statistics of this nature have the potential to be misleading, but they may provide some sense of the overall magnitude of the application.

  • Python code (automatic processes): 280 lines
  • SQL code (schema definition and stored procedures): 290 lines

Mail Sending

Other applications interact with the mail sending application via the database. This means that a completed email request will not actually be sent until the associated changes made by the application are also finalized. This ensures that in the event of an error no email will be sent, even if the error is detected after the application has prepared the email (but before the associated changes are committed to the database).

To create an email, an application performs the following steps, all of which are implemented as requests that are made in the database:

  • Create the email; this sets the content and subject and assigns a message ID.
  • Set the recipients; these may include To, Cc, Bcc.
  • Attach any required attachments.
  • Mark the email as ready to send.

Only once the email is marked as ready to send and the database transaction is committed by the application does the email become eligible to be sent.

Upon noticing a completed email request, the mail sending application sends the actual email using the regular email infrastructure. It also Bcc’s the email to a loopback address. When emails are received by the loopback address the corresponding original emails are marked as having been seen. This provides some assurance that the email has really been sent, although it is not feasible to guarantee delivery.