?
Solved

cfmail to multiple recipients?

Posted on 2003-03-04
20
Medium Priority
?
1,470 Views
Last Modified: 2013-12-24
Hi there..

I was wondering if someone could tell me how to send mail to multiple recipients.  right now i have:  <cfmail from="#FORM.E_mail#" to="Direct-orders@honey.ca" subject="Special Order"> but i'd like to send this to 4 (bob@honey.ca, mary@honey.ca..  etc..) different recipients.  how would i code this?  i have no experience in cold fusion so code examples would really help.  thanks!
0
Comment
Question by:shooby
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 5
  • 2
  • +4
20 Comments
 
LVL 9

Expert Comment

by:HamdyHassan
ID: 8067653
Did you try

<cfset email_list="mailone,mailtwo">


cfmail from="#FORM.E_mail#" to="#email_list#" .....


If this not working try different seprators like
<cfset email_list="mailone;mailtwo">
<cfset email_list="mailone|mailtwo">
<cfset email_list="mailone mailtwo">


If still have problem then you need
<cfmail query=" " ...etc
0
 
LVL 9

Expert Comment

by:HamdyHassan
ID: 8067667
I found the following

<CFMAIL
TO="recipient1@foo.com,recipient2@foo.com"
FROM="sender@foo.com"
CC="recipient3@foo.com"
SUBJECT="Sample form emailer">


so try it and let me know
0
 

Author Comment

by:shooby
ID: 8067791
Hi..  i tried testing that but it didn't work..  separating it like that is suppose to work?  maybe i'm doing something wrong?..  any thoughts?  thanks..
0
Turn your laptop into a mobile console!

The CV211 Laptop USB Console Adapter provides a direct Laptop-to-Computer connection for fast and easy remote desktop access with no software to install.

 
LVL 10

Expert Comment

by:substand
ID: 8068183
you can separate the emails with a comma, or a space, and probably others as well.

just go:

<cfmail from=="#FORM.E_mail#" to="Direct-orders@honey.ca, bob@honey.ca, mary@honey.ca" subject="Special Order">

place the text of the mail here

</cfmail>


are you getting an error?  if so, can you post it?
0
 
LVL 6

Expert Comment

by:dash420
ID: 8069414
<cfset mailto = "bob@honey.ca, mary@honey.ca ,mary@honey.ca">
<cfmail from=="#FORM.E_mail#" to="#mailto#" subject="Special Order">

Mail Text
</cfmail>

0
 
LVL 17

Expert Comment

by:anandkp
ID: 8069660
hi give this a try

<CFMAIL TO="bob<bob@honey.ca>, mary<mary@honey.ca>"
     FROM="Direct<Direct-orders@honey.ca>"
     SUBJECT="Special -Multiple- Order"
     TYPE="HTML">
         
     Checking
</CFMAIL>

let me know

K'Rgds
Anand
0
 
LVL 2

Expert Comment

by:fmedia
ID: 8071874
Tried a loop ?

regards,
idss
0
 
LVL 3

Accepted Solution

by:
cdillon earned 200 total points
ID: 8072190
If you want them all to be in the "to" field when you send them, use the above.  If you want each of them to recieve seperate copies of the email use the following:

<cfset email_list = "email1@dom.com,email2@dom2.com,email3@dom3.com">

<cfset sender = "sender_email@honey.ca"> <!--- replace this with the sender's email address --->

<cfloop index="email_address" list="#email_list#">

<CFMAIL TO="#email_address#" FROM="#sender#" SUBJECT="Special Order" TYPE="HTML">
This is the body of the email (please replace me)
</CFMAIL>


</cfloop>
0
 

Author Comment

by:shooby
ID: 8075306
there is no error, but the recipients are just not recieving the email..  any suggestions?
0
 
LVL 3

Expert Comment

by:cdillon
ID: 8075371
Did you set the mail server in the administrator?  Are you allowed to send mail from that server?

If you didn't set the mail server in the admin you can use the code below:

<cfset email_list = "email1@dom.com,email2@dom2.com,email3@dom3.com">

<cfset sender = "sender_email@honey.ca"> <!--- replace this with the sender's email address --->


<cfset smtp_server = "smtp.domain.com"> <!--- use an smtp server that you know is allowed from the coldfusion server --->

<cfloop index="email_address" list="#email_list#">

<CFMAIL TO="#email_address#" FROM="#sender#" SUBJECT="Special Order" TYPE="HTML" server="#smtp_server#">
This is the body of the email (please replace me)
</CFMAIL>


</cfloop>
0
 

Author Comment

by:shooby
ID: 8075417
i think that the server is already set up..  (i'm not sure) but it was previously sending to one recipient, and i'm suppose to change it to 4 recipients.  because of that, i'm assuming it is already set up?  (or does it need to be set up for multiple recipients?)
0
 

Author Comment

by:shooby
ID: 8075539
hi cdillon..
i tried using the loop you provided and it said that i have to have an end tag?  where would i add that?
0
 
LVL 10

Expert Comment

by:substand
ID: 8075697
show us your code

you might need

</cfmail>

after the mail ends

or </cfloop> after the </cfmail>



0
 

Author Comment

by:shooby
ID: 8075719
below is my code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<cfset email_list= "mary@honey.com,jane@honey.com">
<cfloop index="email_address" list="#email_list#">
<cfmail to="#email_address#" from="#FORM.E_mail#" subject="Special Order">

________________________________________________
Name:
#FORM.Title# #FORM.First_Name# #FORM.Last_Name#
________________________________________________
Company:
#FORM.Company#
________________________________________________
Address:
#FORM.Address1#
#FORM.Address2#
________________________________________________
City:
#FORM.City#
________________________________________________    
Province:
#FORM.Prov#
________________________________________________
Postal Code:
#FORM.Postal#
________________________________________________
Phone:
#FORM.Phone# Ext:#FORM.ext#
________________________________________________
E-Mail:
#FORM.E_mail#
________________________________________________
Referred to Direct by:
#FORM.referred#
________________________________________________


ORDER PRODUCTS

Purchase Order Number:
#FORM.purchase_order_nr#
________________________________________________
Delivery Date Requested (M/D/Y):
#FORM.delivery_date#

Item               Quantity
#item_1#          #qty_1#
#item_2#          #qty_2#
#item_3#          #qty_3#
#item_4#          #qty_4#
#item_5#          #qty_5#
#item_6#          #qty_6#
_______________________________________________
Quotation Requested:
#quotation#


TECHNICAL LITERATURE REQUEST

Product or Form Number:
#FORM.tech_form_nr#
_______________________________________________
Description:
#FORM.description#
_______________________________________________
Comments:
#FORM.Comments#



________________________________________________
</cfmail>

thanks..
0
 

Author Comment

by:shooby
ID: 8075729
there is no info on the server that it's sending it from, does that mean that it's sending from whatever server the site is sitting on?
0
 
LVL 10

Expert Comment

by:substand
ID: 8075744
Try this.  You need to add </cfloop>
______________________________________________________

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<cfset email_list= "mary@honey.com,jane@honey.com">
<cfloop index="email_address" list="#email_list#">
<cfmail to="#email_address#" from="#FORM.E_mail#" subject="Special Order">

________________________________________________
Name:
#FORM.Title# #FORM.First_Name# #FORM.Last_Name#
________________________________________________
Company:
#FORM.Company#
________________________________________________
Address:
#FORM.Address1#
#FORM.Address2#
________________________________________________
City:
#FORM.City#
________________________________________________    
Province:
#FORM.Prov#
________________________________________________
Postal Code:
#FORM.Postal#
________________________________________________
Phone:
#FORM.Phone# Ext:#FORM.ext#
________________________________________________
E-Mail:
#FORM.E_mail#
________________________________________________
Referred to Direct by:
#FORM.referred#
________________________________________________


ORDER PRODUCTS

Purchase Order Number:
#FORM.purchase_order_nr#
________________________________________________
Delivery Date Requested (M/D/Y):
#FORM.delivery_date#

Item               Quantity
#item_1#          #qty_1#
#item_2#          #qty_2#
#item_3#          #qty_3#
#item_4#          #qty_4#
#item_5#          #qty_5#
#item_6#          #qty_6#
_______________________________________________
Quotation Requested:
#quotation#


TECHNICAL LITERATURE REQUEST

Product or Form Number:
#FORM.tech_form_nr#
_______________________________________________
Description:
#FORM.description#
_______________________________________________
Comments:
#FORM.Comments#



________________________________________________
</cfmail>
</cfloop>
0
 
LVL 10

Expert Comment

by:substand
ID: 8075776
and yes, it will be sending from the server its sitting on.

if you want another server, try using:

<cfmail to="tolist" from="fromemail" server="serveryouwanttotry">

mail message

</cfmail>

no guarantees that that will work.  it depends on how the server is set up.

0
 

Author Comment

by:shooby
ID: 8075971
hi there..  i added the close loop tag and it works fine now..  thanks to everyone for all your help..  i used cdillon's coding method and substand really helped me out.  so i'm going to accept cdillon's answer and post an empty question to substand so that he/she gets the points too.
0
 

Author Comment

by:shooby
ID: 8075975
thanks for all your help.  greatly appreciated!
0
 
LVL 10

Expert Comment

by:substand
ID: 8075997
why thank you.

=)

0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

777 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