This is a Simple Email Which is Selected for the Validation
<cfform method="post" action="send_pic.cfm">
<cfinput type="hidden" name="ID" value="#URL.ID#">
<table align="center" width="100%">
<tr>
<td colspan="2"><div align="center"></div></td>
</tr>
<tr>
<td width="26%">Send To: </td>
<td width="74%">
<cfinput type="text" name="picto" required="yes" message="The Email address of the Person whom to send" size="25" validate="email" validateat="onsubmit,onserver">
<input type="hidden" name="picto_required" />
</td>
</tr>
<tr>
<td>Send From: </td>
<td>
<cfinput type="text" validate="email" required="yes" message="Your Email address" name="picfrom" size="25" validateat="onsubmit,onserver">
<input type="hidden" name="picfrom_required" />
</td>
</tr>
<tr>
<td>Other Friend's Email: </td>
<td>
<cftextarea cols="25" rows="4" required="no" message="Multiple Email Address" name="email_cc"></cftextarea>
<span class="navLink_small"> * Email address followed by ; sign.. </span>
</td>
</tr>
<tr>
<td colspan="2">
<label>
<input name="emailType" type="radio" value="1" />
Send Using Attachment
<input name="emailType" type="radio" value="2" checked="checked" />
Send Inline Embeded
</label>
</td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Send Mail" /> </td>
</tr>
</table>
</cfform>
This is Another Page which Processes The Information:
<cfprocessingdirective suppresswhitespace="yes">
<cfif IsDefined("Form.ID")>
<cfquery name="Recordset1" datasource="#request.datasource#">
SELECT *
FROM gallery
WHERE ID = #Form.ID#
</cfquery>
<cfset ToField = form.email_cc>
<cfif REFind("[,;]",ToField) gt 0>
<cfloop list="#ToField#" delimiters=",;" index="idx">
<cfif ReFind("[a-zA-Z0-9_-]+@[a-zA-Z0-9\.\-]+\.[a-zA-Z]+",idx) lt 1>
<h3>The Email you Entered Is Invalid In the Textarea Box, <br />
Use , or ; to Sepate Email Addresses</h3>
<a href="javascript:history.back(-1);">Go Back & Correct Problem</a>
<cfabort>
</cfif>
</cfloop>
<cfset ToField = Replace(ToField,";",",","ALL")>
<cfelse>
<cfif ReFind("[a-zA-Z0-9_-]+@[a-zA-Z0-9\.\-]+\.[a-zA-Z]+",ToField) lt 1>
<h3>The Email you Entered Is Invalid In the Textarea Box, <br />
Use , or ; to Sepate Email Addresses</h3>
<a href="javascript:history.back(-1);">Go Back & Correct Problem</a>
<cfabort>
</cfif>
</cfif>
<cfif emailType IS 1>
<cfmail to="#form.picto#" from="#form.picfrom#" cc="#ToField#" server="#Mserver#" username="#w#" password="#p#" subject="Picture File Sent by your Friend" type="html" timeout="120" query="Recordset1">
<br>
The Picture has been Sent by your Friend..
<br>
<br>
<br>Here is the Picture
<hr>
<br>
Check The Image:
<br>
<hr>
www.randhawaz.com
<br>
<cfmailparam file="#Application.file_path#/stuff/#wallpaper_file#" contentid="image1" disposition="attachment">
<img src="cid:imgage1" alt="Image send by your Friend" />
</cfmail>
<cfelseif emailType IS 2>
<cfmail to="#form.picto#" from="#form.picfrom#" bcc="#ToField#" server="#Mserver#" username="#w#" password="#p#" subject="Picture File Sent by your Friend" type="html" timeout="120" query="Recordset1">
<br>
The Picture has been Sent by your Friend..
<br>
<br>
<br>Here is the Picture
<hr>
<br>
Check The Image:
<br>
<hr>
www.randhawaz.com
<br>
<cfmailparam file="#Application.file_path#/stuff/#wallpaper_file#" contentid="image1" disposition="inline">
<img src="cid:image1" alt="Image send by your Friend" />
</cfmail>
<cfelse>
<div align="left">Please Select the Type of Email</div>
<a href="javascript:history.back(-1);">Get Back</a>
</cfif>
<div align="center">You Mail has been Sent, Thanks</div>
<br>
<a href="javascript:self.close(0);">Close Now</a>
</cfif>
</cfprocessingdirective>