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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFMAIL question

Status
Not open for further replies.

DugzDMan

Programmer
Oct 19, 2000
157
US
Is there a way to use the CFMAIL tag to send multiple rows from a result set to a user?

Here's what I'm trying to do.

I have a time report that runs each Monday. It identifies items that have been added to your time profile that do not match our "standard". When these are identified, it pulls the items and the associated hours and sends this info to the user so they can correct them. This works fine when each person only has one wrong item. If there are more than one, the person receives a seperate email for each one. I would like to have the detail displayed in a table format, so each user only receives one email with all of their information on it.

I have the format and everything working fine. I can also send all the information (all users) to myself just fine.

I'm sure there's an easy way to do this, I'm just not seeing it.

Thanks for the help!
 
Are you executing the query before putting the results into the mail?
You may need to do something similar to this:

<cfquery datasource=&quot;#application.dsn#&quot; name=&quot;x1&quot;>
select *
from email_test
</cfquery>


<cfinclude template=&quot;build_body.cfm&quot;>

<cfmail
to=&quot;#email#&quot;
from=&quot;mail@wherever.com&quot;
subject=&quot;user info&quot;
server=&quot;10.10.10.10&quot;
type=&quot;HTML&quot;
query=&quot;x1&quot;>#body#</cfmail>

And located in the &quot;build_body.cfm&quot; file would be something similar to:
<cfset body='(ALL OF THE DYNAMIC CONTENT, TABLES, FORMATTING, ETC of your information that needs to be mailed)'>

If you have more questions, shoot me an email.
 
Once I added a &quot;Group&quot; item to the CFMAIL tag, it works fine. I group it by the user id and now, I get the expected number of emails. I also put a column in the result set that has my userid, so that I can create the to address on the fly. I'm not sure if that made a difference or not, but it works now.

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top