ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 14th, 2003, 04:42 PM
Brutality Brutality is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 24 Brutality User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Customising cfm mail messages

A simple question (I am hoping). Currently I am in the process of setting up a mailout form for my boss to send surveys, and he wants the ability to be able to specify several email addresses along with their corresponding name. So, in the form I have up to 5 input fields for the name, and another 5 for the appropriate email field. The fields are all matched accordingly - i.e. name1, email1, name2, email2 and so on (this is where my boss is to type the information). Initially I used a simple cfif to check to see the fields were defined before sending 'en mass' so to speak.....

<cfif IsDefined("form.email1") and isDefined("form.email2") and isDefined("form.email3")>
<cfset mailtarget = "#email1# ; #email2# ; #email3#;">
<cfelseif IsDefined("form.email1") and isDefined("form.email2")>
<cfset mailtarget = "#email1# ; #email2# ;">
<cfelse>
<cfset mailtarget = "#email1#">
</cfif>

and then set mailtareget as the TO address.

This works fine, but does not allow me to assign a name to each individual email. I also know this is not the *correct* methodology and would prefer to use cfloop, where I check to see if email 1 is defined, then fetch name 1 and only THEN send, before moving on to the next series in the loop, until there are no more emails defined and the process halts. I also need this to work even if my boss only enters, for instance, 2 email addresses.

Any ideas? All help greatly appreciated.

TIA
adieu
Mark

Reply With Quote
  #2  
Old December 15th, 2003, 11:13 AM
estekguy estekguy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 32 estekguy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 10
Are you sending out 5 seperate e-mails or 1 e-mail to 5 recipients?

Also - not sure what you mean by assigning a mail to each recipient.

My kneejerk (assuming 5 different e-mails) is to suggest having the user enter names 1 at a time and storing the names to a database or a session variable (array)

So your form would be a single name and e-mail, user clicks save, CF saves the info to an array, and forwards back to the entry form.

Once you have the info saved in an array/database, you can CFLOOP or CFQUERY through the list and send them individually.

Added advantage - no longer limited to 5 entries, boss can enter as many names as he likes.

Actually not that much coding, if I'm hitting on the issues let me know and we can play with some examples...

Reply With Quote
  #3  
Old December 15th, 2003, 04:58 PM
Brutality Brutality is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 24 Brutality User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thank you for your reply estekguy. During the process of messing around and investigating cfloop further, I managed to work out an acceptable solution. In short to answer your question, I wanted it to loop thru each email and send them one at a time (to customise). Here's what I've got.......

<cfprocessingdirective suppressWhiteSpace = "Yes">
<cfloop index="i" from="1" to="3">
<cfif isDefined("form.name"&i) and isDefined("form.email"&i)>
<cfset customer_name = '#evaluate("form.name"&i)#'>

<CFMAIL
TO="#evaluate("form.email"&i)#"
SUBJECT="#subject#"
FROM="myemail@cwc.co.nz">
Dear #customer_name#,

email content here

</cfmail>
</cfif>
</cfloop>

Seems to work for me!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Customising cfm mail messages

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap