coldfusion - cfmail group attribute throws error -
i have query returns multiple results data in 1 column different particular report number. want group results 1 report number , send email 1 person action items. below query
<cfquery name="qrycorrectiveduedate" datasource="#application.config.dsn#"> select fr.report_id, fr.report_number, ir.investigation_id, ca.action_who, ca.action_who_email, ca.action_what, ca.action_when, ca.action_type, ca.action_complete_date xyz_gir.dbo.xyz_flash_report fr, xyz_gir.dbo.xyz_investigation_report ir, xyz_gir.dbo.xyz_corrective_actions ca fr.report_id = ir.report_id , ir.investigation_id = ca.investigation_id , datediff(day,ca.action_when,getdate()) > 1 , ca.action_complete_date null order ir.investigation_id </cfquery> the result set looks this:
report_id report_number investigation_id action_who action_who_email action_what action_when action_type action_complete_date 2 13-0002 2 hans-joerg wolf hans-joerg.wolf@xyz.com action 1 00:00.0 repair null 4 13-0004 3 robert michael robert.michael@xyz.com fghfgh 00:00.0 repair null 5 13-0005 4 masoud aghel masoud.aghel@xyz.com sdfsdfsdf 00:00.0 repair null 5 13-0005 4 masoud aghel masoud.aghel@xyz.com hhjghj 00:00.0 repair null what want send 1 email action_who_email value multiple lines same investigation id. if use cfoutput group attribute output:
hans-joerg.wolf@xyz.com report id: 2 report number: 13-0002 investigation id: 2 action :hans-joerg wolf action what: action 1 action when: 2013-04-26 00:00:00.0 action type:repair action complete date: robert.michael@xyz.com report id: 4 report number: 13-0004 investigation id: 3 action :robert michael action what: fghfgh action when: 2013-05-05 00:00:00.0 action type:repair action complete date: masoud.aghel@xyz.com report id: 5 report number: 13-0005 investigation id: 4 action :masoud aghel action what: sdfsdfsdf action when: 2013-04-29 00:00:00.0 action type:repair action complete date: report id: 5 report number: 13-0005 investigation id: 4 action :masoud aghel action what: hhjghj action when: 2013-04-29 00:00:00.0 action type:repair action complete date: and cfoutput:
<cfoutput query="qrycorrectiveduedate" group="investigation_id"> <b>#action_who_email#</b><br> <cfoutput> report id: #report_id#</br> report number: #report_number#</br> investigation id: #investigation_id#</br> action :#action_who#</br> action what: #action_what#</br> action when: #action_when#</br> action type:#action_type#</br> action complete date: #action_complete_date#</br></br> </cfoutput></br> </cfoutput> but if same thing cfmail on query , group it, throws javax.mail.messagingexception: not connect smtp host: 127.0.0.1, port: 25; error.
my cfmail code below
<cfmail query="qrycorrectiveduedate" from="ehs@jdsu.com" to="#action_who_email#" group="#investigation_id#" subject="xyz"> <p>#action_who#,</p> <p>due dates corrective actions incident #report_number# have lapsed </p> <p>you receiving notification, manager/supervisor implement corrective actions </p> <p>incident no: #report_number# </p> <p>corrective action: #action_what#</p> <p>due date: #action_when#</p> </cfmail> please note running coldfusion locally xampp, , although mails dont delivered, can see them in undelivered folder in coldfusion. same file has other cfmail tags not throw connection exception if cfmail tag commented out. apologize if question generic, either have coldfusion or might have write function treat result set temp table. easier coldfusion believe, if know how make work.
now you've removed hash tags, issue missing cfoutput tag in email. similar group attribute of cfoutput tag, need cfoutput tag loop through grouped records.
tested on cf8 locally.
<cfmail query="q" group="field"> <cfoutput> #field# - #field2# </cfoutput> </cfmail>
Comments
Post a Comment