
December 14th, 2003, 04:42 PM
|
|
Registered User
|
|
Join Date: Jul 2003
Posts: 24
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
|