Advanced Sending Options

The ColdFusion implementation of SMTP mail uses a spooled architecture. This means that when a CFMAIL tag is processed in an application page, the messages generated are not sent immediately. Instead, they are spooled to disk and processed in the background. This architecture has two distinct advantages:

  1. End users of your application are not required to wait for SMTP processing to complete before a page returns to them. This is especially useful when a user action causes more than a handful of messages to be sent.
  2. Messages sent using CFMAIL are delivered reliably, even in the presence of unanticipated events like power outages or server crashes.

In most cases, spooled messages are processed immediately by ColdFusion and delivery occurs almost instantly. If, however, ColdFusion is either extremely busy or has a large existing queue of messages, delivery could occur some time after the request is submitted.

Sending mail as HTML

Most newer Internet mail applications are capable of reading and interpreting HTML code in a mail message. The CFMAIL tag allows you to specify the message type as HTML. The TYPE attribute, which only accepts HTML as an argument, informs the receiving email client that the message has embedded HTML tags that need to be processed. This feature is only useful when sending messages to mail clients that understand HTML.

Error logging and undelivered messages

All errors that occur during the processing of SMTP messages are logged to the file errors.log in the ColdFusion log directory. Error log entries contain the date and time of the error as well as diagnostic information on why the error occurred.

All messages not delivered because of an error are written to the \cfusion\mail\undelivr directory. The error log entry corresponding to the undelivered message contains the name of the file written to the undelivr directory.

See Administering ColdFusion Server for more information about the mail logging settings in the ColdFusion Administrator.