You would be better off checking the validity of the address before it
reaches cfmail. Though a function does not check if the domain exist or if
the address is valid it does check that the addess is well formed.

It can be taken another step by invoking a web service to ping the address
and wait for a reply, it is all a matter of how far you wish to take it.

<cfscript>
        function iswellformedemail(email) {
                if
(refindnocase("^['_a-z0-9-]+(\.[_a-z0-9-]+)[EMAIL PROTECTED](\.[a-z0-9-]+)*\.([a-
z]{2,})$",arguments[1])) {
                        return true;
                } else {
                        return false;
                }
        }
</cfscript> 


Cheers

trent




Trent Shepherd
SeaSpray technology & design
cell: 0412 245 212 
phone:4285 8793
email: [EMAIL PROTECTED]
web: www.seaspray.net
 


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Knott, Brian
Sent: Friday, 12 December 2003 4:44 PM
To: CFAussie Mailing List
Subject: [cfaussie] Invalid email addressed


Does any one know if I can stop cfmail through an error if the email address
is invalid.  I'm trying to use <cftry> but I still get an error.  I have
posted my code below.  Not to address is blank to cause error.

<cftry>

        <cfmail to="" subject="Education News - April 2003 Edition"
type="html" from="[EMAIL PROTECTED]">
        #html_source#
        </cfmail>

<cfcatch type="application">
Email Error
</cfcatch>


</cftry>

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To
unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004


---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to