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

Posted on 2004-11-24
Last Modified: 2013-12-24
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:

<CFQUERY NAME="query_name" DATASOURCE="data_source">
    SELECT *
    FROM table

<CFOUTPUT query="query_name">
    <CFMAIL TO="#email#"

This is a reminder that you have posted something somewhere

Any ideas would be great.  I don't know why this is kicking my butt, but it is.  Thanks
Question by:austintre
    LVL 7

    Accepted Solution

    just try to change the query

    use SELECT DISTINCT email FROM table

    LVL 5

    Expert Comment

    like suram points out .. chg your query

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

    this will only retrun one email per multiple email addressses

    Author Comment

    That was probably the easiest 500 points you ever received!!!  I guess i need to learn more about SQL statements.  Thanks for your help.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
    Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    This video discusses moving either the default database or any database to a new volume.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now