Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFMAIL varies on form input.

Status
Not open for further replies.

bboehle

Programmer
Aug 22, 2000
24
US
I need to create a form that has a drop down box. Depending on the slection from the drop down box CFMail will interpret a different Subject and To, CC and BCC field for each dropdown selection. Currently I have a form that posts to a cfmail template.

I am having a blockage on how to get the template to read the form data and change this information as it is needed.

Against better judgement I attempted CFIF Statements inside the CFMAIL tag.. and as I knew CFMAIL will not accept them.

If you could please give me a push in the right direction I would greatly appreciate it!

Thanks,
Brandon
 
you could probably do it a couple of ways... but to make it simple... you can do this:

On the form, with the drop down menus of:
<select name=&quot;Options&quot; size=-1>
<option value=&quot;1&quot;>Option 1</option>
<option value=&quot;2&quot;>Option 2</option>
</select>

When submitted to the cfmail template, do this:

<cfif form.options eq 1>
<cfset subject = 'Subject Heading One'>
<cfset recipient = 'joeblow@abc.com'>
<cfelseif form.options eq 2>
<cfset subject = 'Subject Heading Two'>
<cfset recipient = 'another_address@abc.com'>
<cfif>


<cfmail from=&quot;Your_address@your_domain.com&quot;
to=&quot;#recipient#&quot;
subject=&quot;#subject#&quot;>

Your Message


</cfmail>

Hope this helps!
Chad


 
You can even customize the content of the message using the same techniques.
 
Sorry for taking so long to get back.. this was EXCELLENT!

thank you very much!

Branodn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top