Just a shot in the dark here, but can you use the iif function? Something
like
<cfmail to="someone" from="someoneelse"
#iif(isDefined("variables.server"),DE('server="#variables.server#"'),DE(''))
#>
body
</cfmail>
-----Original Message-----
From: Stan Winchester [mailto:[EMAIL PROTECTED]
Sent: Monday, August 22, 2005 5:07 PM
To: CF-Talk
Subject: cfmail optional attributes
About a month ago I posted the following and have still not found the best
way to handle this. I have tested this on CF5, CFMX 6.1, & BD 6.2 and if the
optional attribute "server" is specified in a CFMAIL tag and is blank it
will throw an error.
========================
Original Post 7/29/05
========================
What is the best way to handle optional attributes for the cfmail tag? I
have noticed you cannot specify the attribute and then leave it blank,
because the email will be sent to the undeliverable directory.
Here is how we are thinking about doing it:
<cfsavecontent variable="MailMessage">
<cfoutput query="GetCustomer">Dear #FirstName#,
Blah blah blah...
</cfoutput>
</cfsavecontent>
<cfif len(request.emailserver) >
<cfmail to="#Email#"
from="#request.email#"
subject="New #request.storename# Password"
server="#request.emailserver#">#MailMessage#</cfmail>
<cfelse>
<cfmail to="#Email#"
from="#request.email#"
subject="New #request.storename# Password">#MailMessage#</cfmail>
</cfif>
How do others handle this situation? Is there a cleaner way to handle this,
because cfmail has many attributes and some are required and some are not
depending on the server configuration.
Thank you,
Aftershock Web Design, Inc.
by: Stan Winchester
President/Developer
[EMAIL PROTECTED]
http://www.aftershockweb.com/
Phone 503-244-3440
Fax 503-244-3454
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application
http://www.houseoffusion.com/banners/view.cfm?bannerid=48
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:215981
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54