shooby
asked on
cfmail to multiple recipients?
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!
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
I found the following
<CFMAIL
TO="recipient1@foo.com,rec ipient2@fo o.com"
FROM="sender@foo.com"
CC="recipient3@foo.com"
SUBJECT="Sample form emailer">
so try it and let me know
<CFMAIL
TO="recipient1@foo.com,rec
FROM="sender@foo.com"
CC="recipient3@foo.com"
SUBJECT="Sample form emailer">
so try it and let me know
ASKER
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..
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?
just go:
<cfmail from=="#FORM.E_mail#" to="Direct-orders@honey.ca
place the text of the mail here
</cfmail>
are you getting an error? if so, can you post it?
<cfset mailto = "bob@honey.ca, mary@honey.ca ,mary@honey.ca">
<cfmail from=="#FORM.E_mail#" to="#mailto#" subject="Special Order">
Mail Text
</cfmail>
<cfmail from=="#FORM.E_mail#" to="#mailto#" subject="Special Order">
Mail Text
</cfmail>
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
<CFMAIL TO="bob<bob@honey.ca>, mary<mary@honey.ca>"
FROM="Direct<Direct-orders
SUBJECT="Special -Multiple- Order"
TYPE="HTML">
Checking
</CFMAIL>
let me know
K'Rgds
Anand
Tried a loop ?
regards,
idss
regards,
idss
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
there is no error, but the recipients are just not recieving the email.. any suggestions?
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@dom 2.com,emai l3@dom3.co m">
<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>
If you didn't set the mail server in the admin you can use the code below:
<cfset email_list = "email1@dom.com,email2@dom
<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>
ASKER
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?)
ASKER
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?
i tried using the loop you provided and it said that i have to have an end tag? where would i add that?
show us your code
you might need
</cfmail>
after the mail ends
or </cfloop> after the </cfmail>
you might need
</cfmail>
after the mail ends
or </cfloop> after the </cfmail>
ASKER
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..
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<cfset email_list= "mary@honey.com,jane@honey
<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..
ASKER
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?
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>
__________________________
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<cfset email_list= "mary@honey.com,jane@honey
<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>
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.
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.
ASKER
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.
ASKER
thanks for all your help. greatly appreciated!
why thank you.
=)
=)
<cfset email_list="mailone,mailtw
cfmail from="#FORM.E_mail#" to="#email_list#" .....
If this not working try different seprators like
<cfset email_list="mailone;mailtw
<cfset email_list="mailone|mailtw
<cfset email_list="mailone mailtwo">
If still have problem then you need
<cfmail query=" " ...etc