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




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:215977
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to