Coldfusion Mail Service Stuck, Spool Folder Growing

I've been dealing with this issue on and off for YEARS, dating back to CF 5 and 6.

Out of the blue, Coldfusion just stops delivering email, and the mail just keeps building up in the queue.

To restart the service I can restart coldfusion OR run the following code:

  <cfset sFactory = CreateObject("java","coldfusion.server.ServiceFactory")>
  <cfset MailSpoolService = sFactory.mailSpoolService>
  <cfset MailSpoolService.start()>

The solution above is a fix noted on stackoverflow: https://stackoverflow.com/questions/94932/coldfusion-mail-queue-stops-processing

My goal would be to find a log or something that would help point me to the cause of the issue.

Is there a log that will tell me what is causing the mailspoolservice to crash? I can't seem to locate any errors in the CF Admin.

I have also tried to regenerate this issue, and I can't.

I'm currently running CF9 latest hotfixes applied, on windows 2008 r2


What version of ColdFusion are you running now and on what platform?

You can add some logging information via the ColdFusion administrator under the mail settings. See the documentation for mail logging on ColdFusion 9 here.

Error Log Severity

From the drop-down list object, select the type of SMTP-related error message to write to a log file. The options are the following:

  • Debug (contains Information, Warning, and Error)

  • Information (contains Warning and Error)

  • Warning (contains Error)

  • Error

ColdFusion writes sent-mail and mail-error logs to the following directories:

  • \coldfusion9\logs (Windows server configuration)

  • /opt/coldfusion9/log (Solaris and Linux server configuration)

  • cf_webapp_root/WEB-INF/cfusion/logs (multiserver and J2EE configurations, all platforms)

The email log files generated are:

  • mailsent.log - Records sent e-mail messages.

  • mail.log - Records general e-mail errors.

What is your mail logging set to now?


On one of our production servers (coldfusion 8 for backward compatibiliy reasons), we encounter this problem as well from time to time, although quite rarely, maybe once in half a year or so. I put this on a tiny scheduled task, running e.g. once an hour, to observe the mail spool folder for stucking and, in case it does, restarting the service (not cf server, but only the spool service):

Mail-Spool-Directory is from coldfusion 8 default dir:

<cfdirectory directory="C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\cfusion\Mail\Spool" name="dirQuery" action="LIST" sort = "datelastmodified ASC">

<cfquery name="oldest" dbtype="query" maxrows="1">
    SELECT dateLastModified  FROM dirQuery ORDER BY dateLastModified 
</cfquery>
<cfif oldest.recordcount GTE 1>
    <cfif DateDiff("h",oldest.dateLastModified ,now()) GTE 2>
        DO RESTART MAILQUEUE SERVICE...
        <cfset sFactory = CreateObject("java","coldfusion.server.ServiceFactory")>
        <cfset MailSpoolService = sFactory.mailSpoolService>
        <cfset MailSpoolService.stop()>
        <cfset MailSpoolService.start()>
        done
    <cfelse>
        files there but younger than 2 h
    </cfif>
<cfelse>
    dir empty
</cfif>