squickel
asked on
CFMAIL Sending Intermittent Blank Emails
As part of our application we have a page that sends emails messages to multiple recipients individually. In about 10% - 15% of cases the emails go out to the recipient with a blank message body and no attachment (had there been one specified). As part of this routine we allow the user to specify the number of seconds to delay in between email messages being sent.
Has anyone ever encountered this blank email problem and how did you fix it?
Has anyone ever encountered this blank email problem and how did you fix it?
<CFOUTPUT query="GetInvestors">
<CFMAIL to="#GetInvestors.EMail#"
from="#FromMail#"
subject="#FORM.subject#"
server="mail.xxxxxxxxx.com">
<CFMAILPART type="text" wraptext="74">
#FORM.Message#
</CFMAILPART>
<CFSILENT>
<CFIF FORM.Attachment_1 neq "">
<cfmailparam file="#Attachment_Local_File_1#">
</CFIF>
<CFIF FORM.Attachment_2 neq "">
<cfmailparam file="#Attachment_Local_File_2#">
</CFIF>
<CFIF FORM.Attachment_3 neq "">
<cfmailparam file="#Attachment_Local_File_3#">
</CFIF>
</CFSILENT>
</CFMAIL>
<!--- Delay Interval Between EMail Transmissions --->
<CFIF IsDefined("FORM.Delay") AND FORM.Delay GT 0>
<CFSET MailCounter = MailCounter + 1>
<SCRIPT>
UpdTable('#NumberFormat(MailCounter,"9,9")# of #NumberFormat (GetInvestors.RecordCount,"9,9")#',"#GetInvestors.EMail#",'#DateFormat(Now(),"mmm d, yyyy")# at #TimeFormat(Now(),"h:mm:ss tt")#')
</SCRIPT>
<CFSET StartTime = Now()>
<CFLOOP condition="TRUE">
<CFIF DateDiff("s",StartTime,Now()) GTE #FORM.Delay#>
<CFBREAK>
</CFIF>
</CFLOOP>
<CFFLUSH>
</CFIF>
</CFOUTPUT>
ASKER
I verify that the form content is valid before we get into this loop, so I know the message body is not blank. Duncancumming your second premise is correct 10-15% of messages go out as blank to 100% of that message's recipients.
I was looking at the code again this afternoon and I'm wondering if this could be some kind of timing conflict because I am using <CFFLUSH> to show the counter incerment. One other thing I discovered. The random blank emails occur even we are not attaching any files.
I was looking at the code again this afternoon and I'm wondering if this could be some kind of timing conflict because I am using <CFFLUSH> to show the counter incerment. One other thing I discovered. The random blank emails occur even we are not attaching any files.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
UpdTable just refreshes the values in cells of a table dislayed on the page while this process is running. It is just to let the user know where he/she is in the procss.
We are still using MX7 but will be switching soon. Thanks for the sleep suggestion.
It looks like I am going to hsve to rethink his entire delay process loop.
We are still using MX7 but will be switching soon. Thanks for the sleep suggestion.
It looks like I am going to hsve to rethink his entire delay process loop.
I had the same problem when sending out invoices. Every time there were some recipients who just saw the letterhead, but a blank body. In the end I got fed up and wrote another program to do it. (in Delphi). I had a question on EE, but got no replies.
ASKER
The inclusion of a single CFMAILPART was the cause of the problem. It seems ColdFusion MX7 automatically adds a blank CFMAILPART at the end of a message. This blank CFMAILPART is whatthe users getting the blank messages were seeing.
Can you clarify - do you mean when one message is sent out to multiple recipients, 10-15% of those recipients just get the blank email? Or do 10-15% of messages go out as blank to 100% of that message's recipients?