New ColdFusion CFMailParam "Remove" Attribute Makes Deleting Attachments Simple

<!--- Param form values. --->
<cfparam name="FORM.email" type="string" default="" />
<cfparam name="FORM.file" type="string" default="" />
 
<!---
	Check to see if the form has been submitted. For the
	purposes of this very simple demo, we are going to do
	this by seeing if the form data is valid.
--->
<cfif (
	IsValid( "email", FORM.email ) AND
	Len( FORM.file )
	)>
 
 
	<!--- Upload the file to the upload directory. --->
	<cffile
		action="upload"
		filefield="file"
		destination="#ExpandPath( './' )#"
		nameconflict="makeunique"
		/>
 
 
	<!--- Send email. --->
	<cfmail
		to="#FORM.email#"
		from="ben@bennadel.com"
		subject="File Send by #FORM.email#"
		type="html">
 
		<p>
			The following file has been upload and sent from
			the Kinky Solutions CFMailParam Remove Attribute
			demo page. <em>(Please see attached file)</em>.
		</p>
 
		<!---
			Attach the file. When doing this, use the remove
			attribute so that the file is deleted from the
			server after the mail has been sent.
		--->
		<cfmailparam
			file="#CFFILE.ServerDirectory#/#CFFILE.ServerFile#"
			remove="true"
			/>
 
	</cfmail>
 
 
</cfif>
 
 
<cfoutput>
 
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html>
	<head>
		<title>CFMailParam Remove Attribute Demo</title>
	</head>
	<body>
 
		<h1>
			CFMailParam Remove Attribute Demo
		</h1>
 
		<form
			action="#CGI.script_name#"
			method="post"
			enctype="multipart/form-data">
 
			<label>
				Email Address:<br />
				<input type="text" name="email" size="40" />
			</label>
			<br />
			<br />
 
			<input type="file" name="file" size="60" />
			<br />
			<br />
 
			<input type="submit" value="Send File" />
 
		</form>
 
	</body>
	</html>
 
</cfoutput>

For Cut-and-Paste