Link to home
Start Free TrialLog in
Avatar of javanigus
javanigus

asked on

<CFMAIL in LOOP. Getting error writing mail message to disk. Why?

Hi, I'm mass emailing a bunch of my subscribers a HTML email with a Word document as an attachment but I'm getting a Coldfusion error saying "Unable to write mail message to disk."

The relavant part of the code is:
-------------------------------------------------------
<cfloop query="filteredlist">

<CFMAIL
           from="#form.creator#"
           to="#email#" type="#mailtype#"
           subject="#form.subject#"
           mimeattach="#sourcedir#tools\membershiptools\attachments\#serverFile#">
#form.message#
</CFMAIL>
</cfloop>

Any idea why I'm getting this error?

Thanks,

Abdullah
ASKER CERTIFIED SOLUTION
Avatar of mrichmon
mrichmon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of smaglio81
smaglio81

Nope, I don't know why you are getting that error. I don't really see why CF would be writing the mail message to a disk. But, have you tried more explicit ways of sending the email. For example:


<cfloop query="filteredlist">

<cfmail
           from="#form.creator#"
           to="#filteredlist.email#"
           type="html"
           subject="#form.subject#"
           >
           <cfmailparam file="#sourcedir#tools\membershiptools\attachments\#serverFile#" />
#form.message#
</cfmailL>

</cfloop>

I changed the 'type' attribute to the constant "html"; I don't know if that will help anything. But the use of cfmailparam might reset something in the MIME attachement system of the cfmail processing; I stress the 'might' part.

I guess you already checked the application logs to find the error message; but maybe macromedia might have a support article on that particular error message. When I searched there was a couple of strange pages that popped up, like:

http://www.macromedia.com/support/coldfusion/ts/documents/tn17815.htm, which is a Coldfusion 4.5.1 SP2 update page that listed your error as bug #18459. This bug number lead me to a custom tag in the developers section (http://www.macromedia.com/cfusion/exchange/index.cfm?view=sn131&extID=1001777). The custom tag's description claims to be able to fix the error. But, you never know till you try it, right?

HTH

Steven
You might want to try putting the loop in the cfmail tag:

<cfmail query="filteredlist">
No do NOT put the loop inside the cfmail tag - known problems with cfmail and nested cfloops
Avatar of javanigus

ASKER

Thanks for all your comments but I found out that there is a CFMAIL attribute called "spoolenable" which takes Yes or No and defaults to Yes if not specified / included in the CFMAIL tag. If spoolenable = Yes, CF saves the messages to disk first before sending them out to recipients. If spoolenable = No, CF saves the messages to memory. I didn't have spoolenable included so CF took it as a Yes and therefore was writing my 8000 messages to disk first before sending them out to recipients. I guess somewhere along the line there was a glitch and CF couldn't save a message to disk for some reason and that caused the error.

That's it.

Thanks again though.

Abdullah
mrichmon, haven't had a problem using loops in cfmail. What kind of problems exist with this?

-- Ian
Well, I can't seem to find my link to the post on the Macromedia exchange where I was talking with a Macromedia developer - it is possible then that it has been fixed....  They have fixed a few of the bugs I have worked with the Macromedia developers on...
Was it in 6.1?
It was in MX (6.0)