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

emailing mulitple recipients

Participant ,
Apr 18, 2006 Apr 18, 2006

Copy link to clipboard

Copied

Hi all,

I have a page with a query which picks up a list of staff, shown using repeat region, I have then set an email link next to each one, picking up the recipient for the mailto: bit from the recordset, works fine. However, how do I do it if I want one link which allows me to email 'all' of the staff that appear in my results at once?

Many thanks

Views

853

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
LEGEND ,
Apr 18, 2006 Apr 18, 2006

Copy link to clipboard

Copied

Create a list of recipients for your "to" attribute.

Use cfsavecontent to build the body of your email. Do not use a query attribute in your cfmail tag.

Votes

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
New Here ,
Apr 18, 2006 Apr 18, 2006

Copy link to clipboard

Copied

quote:

Originally posted by: Dan Bracuk
Do not use a query attribute in your cfmail tag.


Dan,
Mind if I ask 'why not'?
Thanks!
Ross Valenti

Votes

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
Participant ,
Apr 18, 2006 Apr 18, 2006

Copy link to clipboard

Copied

Thanks for the replies, I can see that adding multiple recipients in the "to" field would work, howvere my problem is that the list is dynamic, every 3 months that list will be different depending on who is in the table I am querying from....??

Votes

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
Community Expert ,
Apr 19, 2006 Apr 19, 2006

Copy link to clipboard

Copied

the list is dynamic, every 3 months that list will be different depending on who is in the table I am querying from
Sounds like a job for a mailing custom tag or function

Votes

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
Participant ,
Apr 19, 2006 Apr 19, 2006

Copy link to clipboard

Copied

Hmm thanks BKBK, but, unfortunatly I have no idea where to even start with that....

Votes

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
LEGEND ,
Apr 19, 2006 Apr 19, 2006

Copy link to clipboard

Copied

quote:

Originally posted by: UpstateRoadie
quote:

Originally posted by: Dan Bracuk
Do not use a query attribute in your cfmail tag.

Dan,
Mind if I ask 'why not'?
Thanks!
Ross Valenti


Because if he does, he will send an email for every record in the query. He only wants to send one.

Votes

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
Participant ,
Apr 19, 2006 Apr 19, 2006

Copy link to clipboard

Copied

Dan, would you mind looking at this thread for me please?? i'm banging my head against the wall!!

http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=3&threadid=1144502&enterthre...

Votes

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
Community Expert ,
Apr 18, 2006 Apr 18, 2006

Copy link to clipboard

Copied

I think cfmail sends one e-mail at a time. The only way to send mail to multiple recipients, by executing the cfmail tag once, is to put multiple addresses in the "to", "cc" and "bcc" fields.

What you require sounds like a job for a custom tag or function. You can easily write one whose basic functionality is the cfmail tag. Then you only have to pass it address(es), subject, message, etc




Votes

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
Community Expert ,
Apr 19, 2006 Apr 19, 2006

Copy link to clipboard

Copied

Where you now have cfmail, just do a custom tag or function instead.

old
====
<cfmail to="abc@def.com" ...>

new
====
<!--- The variables recipient, sender, subject_line and message have been dynamically generated --->
<cfset mailJob("#recipient#","#sender#","#subject_line#","#message#")>
<cffunction name="mailJob">
<cfargument name="mailto" type="string" required="Yes">
<cfargument name="mailfrom" type="string" default="myDefaultAddress@mydomain.com">
<cfargument name="subject" type="string" required="Yes">
<cfargument name="messageBody" type="string" required="Yes">
<cfmail to = "#Arguments.mailto#" from = "#Arguments.mailFrom#" subject = "#Arguments.subject#">
#Arguments.messageBody#
</cfmail
</cffunction>

Votes

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
Participant ,
Apr 19, 2006 Apr 19, 2006

Copy link to clipboard

Copied

BKBK, thanks for that info on mailto, so I would just need to use that code, and base it on the application it is running from, so mailto would be #staffmember# for example?

Votes

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
Community Expert ,
Apr 19, 2006 Apr 19, 2006

Copy link to clipboard

Copied

so I would just need to use that code, and base it on the application it is running from, so mailto would be #staffmember# for example
Umhum. So long as staffmember is an e-mail address or list of e-mail addresses.

Votes

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
Participant ,
Apr 19, 2006 Apr 19, 2006

Copy link to clipboard

Copied

LATEST
Not sure I understand all of the code,

so my app "formsNotSent" retrieves all offices that have not sent a particular form, by comparing the table to a table with all offices in it. so i'm not sure where in your code, I would relate to that query to create the list of email addresses..?

Votes

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
Resources
Documentation