take those queries outside of your cfmail.  then put the query="users" on
the cfmail tag.  and change your cfoutput query="events" to use cfloop
instead.


Duncan Cumming
IT Manager

http://www.alienationdesign.co.uk
mailto:[EMAIL PROTECTED]
Tel: 0141 575 9700
Fax: 0141 575 9600

Creative solutions in a technical world

----------------------------------------------------------------------
Get your domain names online from:
http://www.alienationdomains.co.uk
Reseller options available!
----------------------------------------------------------------------
----------------------------------------------------------------------


                                                                                       
                            
                    "Ian                                                               
                            
                    Westbrook"           To:     "cfug dev list" <[EMAIL PROTECTED]>   
                  
                    <[EMAIL PROTECTED]        cc:                                      
                                 
                    eam.net>             Subject:     [ cf-dev ] cfmail...             
                            
                                                                                       
                            
                    07/08/2003                                                         
                            
                    10:36                                                              
                            
                    Please                                                             
                            
                    respond to                                                         
                            
                    dev                                                                
                            
                                                                                       
                            
                                                                                       
                            



Hi
I haven't used CFMAIL for a while (using CF4.5), so have forgotten some of
its finer points (if, indeed, I ever knew). I'm using the following code
(which I admit probably isn' very efficient anyway) to:
1/ get all the users who want to receive the monthly mailout
2/ find out what artforms they're interested in
3/ pull all the events out of the diary for those artforms and mail 'em out

This is the error I'm getting:

Invalid tag nesting configuration

A query driven CFOUTPUT tag is nested inside a CFMAIL tag that also has a
QUERY= attribute. This is not allowed. Nesting these tags implies that you
want to use grouped processing. However, only the top-level tag can specify
the query that drives the processing.

(er, the CFMAIL doesn't have a QUERY="" attribute, but what the heck...)
and this is the code:

<!-- this is the monthly mailout to users who have requested it of a Diary
of their artform events -->

<!-- because this script isn't calling Application.cfm so today's date
needs to be set -->
<cfset nowdate = CreateODBCDate(Now())>

<cfquery datasource="#dsn#" name="users">
SELECT id, username, password, firstname, testemail
FROM users
WHERE receiveartform = 'yes'
</cfquery>


<CFMAIL
FROM="[EMAIL PROTECTED]"
TO="#users.testemail#"
SUBJECT="Monthly artform listings from ArtSouthEast"
>

<cfquery datasource="#dsn#" name="ids">
SELECT artformid
FROM artformjoin
WHERE userid = #users.id#
</cfquery>

<cfquery datasource="#dsn#" name="events">
SELECT diary.id AS diaryid, diary.directoryid, diary.artform, diary.title,
diary.description, diary.startdate, artforms.id AS artformid,
artforms.artform AS artform, directory.id AS directoryid, directory.town,
towns.id AS townid, towns.town AS town
FROM diary, directory, artforms, towns
WHERE diary.artform = artforms.id
AND diary.directoryid = directory.id
AND directory.town = towns.id
AND
(( diary.startdate >= #nowdate#)
OR
( diary.enddate >= #nowdate#))
AND diary.artform IN (#valuelist(ids.artformid)#)
ORDER BY diary.startdate
</cfquery>

Dear #users.firstname#

As you requested, find below all the events in the ArtSouthEast Diary which
match your artform preferences. Below each is a link back to the
ArtSouthEast Diary for more details.

You can change your artform preferences by logging into ArtSouthEast: go to
the home page - http://test.artsoutheast.co.uk/index.cfm - and use your
login details:

username: #users.username#
password: #users.password#

<cfoutput query="events">
Title: #title#
Artform: #artform#
Startdate: #startdate#
<cfset delimiter = " ">
 <cfset nSentences = ListLen(description, delimiter)>

 <cfif nSentences GTE 25>
 <cfloop index="i" from="1" to="25">
     <cfif ListLen(description, " ") GTE i>#ListGetAt(description, i, " ")#
<cfelse><!--- no more words ---><cfbreak></cfif>
 </cfloop></cfif>...
More details: http://test.artsoutheast.co.uk/diarysingle.cfm?diaryid
=#diaryid#

</cfoutput>

This email has been brought to you by ArtSouthEast, the arts portal for the
south and south east of England. Visit at
http://test.artsoutheast.co.uk/index.cfm

Best regards,

Ian Westbrook, Editor, ArtSouthEast
[EMAIL PROTECTED]


</CFMAIL>

anyone any ideas?

TIA

Ian W



Ian Westbrook,
FutureDream Media Limited,
(W): www.futuredream.net
(E): [EMAIL PROTECTED]
(T): +44 (0) 1303 258 985
(M): 07939 510 812

This message may contain information which is legally privileged and/or
confidential. If you are not the intended recipient, you are hereby
notified that any unauthorised disclosure, copying, distribution or use of
this information is strictly prohibited. Such notification notwithstanding
any comments, opinions, information or conclusions expressed in this
message are those of the originator, not of FutureDream Media Ltd, unless
otherwise explicitly and independently indicated by an authorised
representative of FutureDream Media Ltd.





-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to