• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Sending multiple emails with one cfmail tag based on a list of ID's that was outlets from a query

Community Beginner ,
Oct 28, 2015 Oct 28, 2015

Copy link to clipboard

Copied

i am using Cf9 on Windows 8 platform 64bit

I am writing a page that will automatically send an email that will come as a text message to instructors who did not insert the names of their pupils into the daily attendance log. My code will run through the database each day to see which of the instructor's ID is not listed.

If there is no ID of the instructor in the attendance database, that will mean that the instructor did not enter anything for their daily attendance. Even if no student show up to class, there is a "class cancelled" name that can selected. Some days one ID may come up, other days as much as ten of the instructors ID's number may come up.

The problem I am having is whenever there are multiple IDs that output from the query, I want to send an email to each of these instructors that the ID's match by using one cfmail tag.

Here my code below... Is there something I'm missing?

<!---Grab today's date--->

<cfset missingdate = NOW()>

<!---List all of the teachers ID--->

<cfquery name="squadlt" datasource="master">

select ltid from squadlt

</cfquery>

<!---find out which instructors did not insert their pupils attendance--->

<cfquery name="missingattendance" datasource="master">

SELECT ltid, ltfname as Squad, DATE_FORMAT(meedate, '%m/%d/%Y')

FROM squadlt

LEFT JOIN meeting

ON meesquadlt = ltid

AND  meedate = '#LSDateFormat(missingdate ,'MMMM MM/DD/YYYY')#'

WHERE meesquadlt is null and ltid = '#squadlt.ltid#'

<!---Merge the instructor's phone number and provider extension as an email to send to the instructor who did not enter attendance--->

<cfquery name="combinetextemail" datasource="master">

SELECT ltfname, trim(concat(ltphone,'',ltproviderextention)) AS emailtotext

FROM squadlt where ltid = '#missingattendance.ltid#'

</cfquery>

<!---CF mail--->

<cfmail query="combinetextemail"

to = "#combinetextemail.emailtotext#"

type="html"

from = "#combinetextemail.emailtotext#"

subject = " Missing Attendance for #LSDateFormat(missingdate ,'DDDD MM/DD/YYYY')#"

replyto="teacher@vt.edu"

server = "smtp.gmail.com"

useSSL="yes"

port="465"

username = "username"

password = "password">

 <cfoutput>#combinetextemail.ltfname#</cfoutput>, i need your attendance info for <cfoutput>#LSDateFormat(missingdate ,'DDDD MM/DD/YYYY')#</cfoutput> ASAP. <br><br>www.studentlt.com

</cfmail>

Views

402

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation
Resources
Documentation