- I'm using ADDT with ColdFusion 9
- I'm needing to use CFMAIL instead of the built in MX "Send E-Mail Server" behavior (because I need to dynamically make the form contents go out as a PDF "attachment" in the email)
- ps: Is there a way to use the "built-in" MX Send Email wizard to make the email a PDF attachment? (If so, I don't need my CFMAIL code)
Here is what my form page looks like:
Code: Select all
<!--- Only send the Email if submit button has been pressed... --->
<cfif structkeyexists(form, 'KT_Insert1')>
<!--- create the Email from the request: --->
<!--- create a PDF from the request: --->
<cfdocument format="pdf" name="pdfData">
<cfoutput> <h2>Leave Request</h2> </cfoutput>
</cfdocument>
<!--- create the Email from the request: --->
<cfmail to="email@doamin.com" from="email@domain.com" subject="Leave Request" type="html">
Hello,
This is my Leave Request email
<cfmailparam disposition="attachment" file="leave_request.pdf" type="application/pdf" content="#pdfData#" > Leave Request has been filed. See the attached PDF for details.
</cfmail>
<cfheader NAME="refresh" VALUE="0;URL=https://demo.domain.com/crm/CED/lt0b.cfm">
<cfabort>
</cfif>
<form method="post" id="form" action="<cfoutput>#Request.KT_escapeAttribute(Request.KT_getFullUri())#</cfoutput>">
<table cellpadding="2" cellspacing="0" >
<tr>
etc...
<td><input type="button" data-mini="true" value="Cancel" onClick="parent.location='lt0b.cfm'" rel="external"/></td>
<td><input type="submit" name="KT_Insert1" id="KT_Insert1" value="Save/Submit" title="This will Save & Submit your Leave Request by default. Uncheck the Submit checkbox to submit later." rel="external"/></td>
</tr>
</table>
<input type="hidden" name="lqCreated" id="lqCreated" value="<cfoutput>#Request.KT_formatDate(rstblleaverequest.lqCreated)#</cfoutput>" />
</form>
</form>