Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cfmail grouping issue

Status
Not open for further replies.

codehoper

Programmer
May 14, 2001
13
0
0
US
I have a automated task that is running currently on cf 4.5 that I am having trouble moving to MX.

First thing I do is run a query to get all of the invoices from the previous day. In the cfmail tag I group them by the invoice number. With in the cfmail tag I generated dynamic information used in both sending the email, listing the line items and content. In MX for some reason is does not like the dynamic information in the cfmail tag. This works fine in 4.5 and it passes the code validator in the MX admin.

Error message: Element SENDCOPY is undefined in VAR.

Code:
<cfquery name="qGetOrder" datasource="cf_WT">
execute usp_getAllInvoices
</cfquery>

<cfset var.copyList = "webmaster@mydomain.com">

<cfmail to="#emailaddr#" from="#myFrom#" bcc="#var.sendCopy#" subject="#var.subject#" type="html" query="qGetOrder" group="invoiceNumber" server="mailserver">
<cfif left(PO, 4) eq "RMA##">
<cfset var.subject = "Return Receipt for Invoice ###invoiceNumber# -- returned on #dateformat(invoiceDate, "mm/dd/yyyy")#">
<cfelse>
<cfset var.subject = "Electronic Receipt for Invoice ###invoiceNumber# -- shipped on #dateformat(invoiceDate, "mm/dd/yyyy")#">
</cfif>

<cfif listfind(finalList, invoiceNumber)>
<cfset var.sendCopy = var.copyList>
<cfelse>
<cfset var.sendCopy = "">
</cfif>

<cfif len(loginname)><cfset myFrom = "#loginname#@mydomain.com"><cfelse><cfset myFrom = "invoice@mydomain.com"></cfif>
<cfoutput>
<cfif cat eq "Y">
<cfset var.banner = " <cfset var.bannerlink = " <cfelse>
<cfset var.banner = " <cfset var.bannerlink = " </cfif>
</cfoutput>

My mail content

</cfmail>
 
In your listfind() statement, where are the finalList and invoiceNumber vars defined?

I'm assuming you're error is coming from:
Code:
<cfif listfind(finalList, invoiceNumber)>
    <cfset var.sendCopy = var.copyList>
<cfelse>
    <cfset var.sendCopy = "">
</cfif>

Or, is the error coming at the first declaration of the sendCopy from the <cfmail bcc> tag?

____________________________________
Just Imagine.
 
The error is coming from the <cfmail bcc> and <cfmail subject>

In 4.5 it would use variables in the mail tag that were defined within the mail tag.

<cfmail to="#myvar#">
<cfset myvar = "me@domain.com">
</cfmail>

Thanks again for help on this.
 
Final list is created above the mail code. What I am doing there is creating a list of invoices then grabing 6 random invoices to be send to me so I can verify that the process is generating correct content.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top