Dealing with Undeliverable Email
Every now and then, something goes
wrong when ColdFusion attempts to send an email. Problems can range
from a missing email address in the TO
attribute,
to a problem connecting to the SMTP server. Regardless of the cause
of the problem, ColdFusion deals with undeliverable email in a
consistent and simple manner. All undeliverable email messages are
written to temporary files and saved to a folder on the ColdFusion
server called Undelivr
. The
Undelivr
folder is usually located in
c:\cfusion\mail\undelivr\
. The exact location
can be determined by looking at the following value in the system
registry:
HKEY_LOCAL_MACHINE/Software/Allaire/ColdFusion/CurrentVersion/Mail/BaseDirectory
To resend a message that has been moved to the
Undelivr
folder, the temporary file must be
moved back to the Spool
folder, which is usually
located in c:\cfusion\mail\spool
. This can be
done manually or via ColdFusion. Obviously, using ColdFusion to
monitor the Undelivr
directory for undelivered
mail is more convenient than manually checking the directory every
time an email is generated. To do this, you need to create a template
that scans the Undelivr
folder and schedule it
to run at set intervals. Example 13-8 contains a
template you can use to scan your Undelivr
folder and move any files found back to the
Spool
folder so that attempts can be made to resend them. Using the Scheduler within the ColdFusion Administrator, the template can be set to run at predetermined intervals. ...
Get Programming ColdFusion now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.