4

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

2 Answers 2

3

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?

14
  • I just updated my question with in. Running windows 2008r2, CF9 (but have been having this issue since windows 2003 and cf5 - finally sick of dealing with it). My smtp log was on information, moved it up to debug. The Mail log doesnt reflect any errors relating to events at the time of the error. For example error happened at 10am and last entry was 2 days ago. Mail sent doesnt get updated beyond the date/time of last message sent and doesnt include any error. No application errors either. Was hoping there was a java level log.
    – steve
    Apr 1, 2013 at 16:27
  • Am I understanding your issue correctly; the mail files are not being moved to the Undelivr folder, they are stuck in the Spool folder? I'm not really sure how useful the error logging I described above is. I was hoping your setting was off. At the information level you should be getting any errors. Maybe debug will give you something. Could your ColdFusion server be losing it's connection to the mail server?
    – Miguel-F
    Apr 1, 2013 at 16:42
  • The problem that I am having and that other people are having is that the spool manager just quits working. Coldfusion drops the message in the spool folder and the spooler doesnt move it to the SMTP or Undeliverable folder (if that was going to be the case). They just sit until you force- restart the mail spool OR restart coldfusion.
    – steve
    Apr 1, 2013 at 16:46
  • Have you noticed anything common about the mail files that get stuck? Are they small or large in size? Are they to particular addresses? Is your server processing a lot of email? Does any mail go through while this is happening or is ALL mail suspended? Do you have multiple ColdFusion instances on the server or just one? If more than one, do they all point to the same SMTP server? Do they all experience this? At the same time? Sorry, lots of questions and no answers. Just trying to gather more information.
    – Miguel-F
    Apr 1, 2013 at 16:50
  • I can't find anything common. It could get stuck while sending a batch of newsletters or a transactional email. The emails are usually smaller... 4-5kb up to 20kb. The cfmail tag continues to work. I'll get notified from a client that they arent receiving emails they are expecting. When I look at the spool folder it could have anywhere from 25 to 10k messages waiting to go out. I'm only running 1 instance of CF. This problem is in the chain before SMTP would even kick in.
    – steve
    Apr 1, 2013 at 16:55
1

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>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .