Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 181
  • Last Modified:

Sending only one E-mail through CFMAIL when multiple records have same e-mail address

I would like to remind each person that has posted data to a table through my ColdFusion server to an Access Database each morning to update or remove their posts.  To do this I am using CFSCHEDULE and CFMAIL.  The only problem is I am using CFOUTPUT to run through the lines sending out an e-mail message to each person, but if one person has multiple records then they get multiple e-mails.  How can I send out just one e-mail to each person?  This is what I have so far:

<head>
      <title>Untitled</title>
<CFQUERY NAME="query_name" DATASOURCE="data_source">
    SELECT *
    FROM table
</CFQUERY>
</head>

<body>
<CFOUTPUT query="query_name">
    <CFMAIL TO="#email#"
            FROM="email@email.com"
            CC="anotheremail@email.com"
            SUBJECT="subject"
            SERVER="mail_server"
            PORT="25">

#name#,
This is a reminder that you have posted something somewhere
    </CFMAIL>  

Any ideas would be great.  I don't know why this is kicking my butt, but it is.  Thanks
0
austintre
Asked:
austintre
1 Solution
 
suramsureshbabuCommented:
just try to change the query

use SELECT DISTINCT email FROM table

0
 
kkhippleCommented:
like suram points out .. chg your query


<CFQUERY NAME="query_name" DATASOURCE="data_source">
    SELECT DISTINCT email, name
    FROM table
</CFQUERY>


this will only retrun one email per multiple email addressses
0
 
austintreAuthor Commented:
That was probably the easiest 500 points you ever received!!!  I guess i need to learn more about SQL statements.  Thanks for your help.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now