?
Solved

Validate an e-mail address while looping

Posted on 2003-11-05
3
Medium Priority
?
160 Views
Last Modified: 2013-12-24
OK, it's me again.

Description of issue:
I am looping through a QUERY and I have a value #Domain#

Now these values have been pulled from a database where clients have entered a domain.  What I need to do is append the word "webmaster@" to the domain and send an e-mail.

The problem is sometimes they enter www.abc.com/default.php or redhat.com%20, etc. you get the point.

Now I have it all figured out (see below) except how to validate the "potential" e-mail to make sure it is correct so that I do not get an error.

I would like something like the "on error resume next" capabilities in .asp, to allow the code to continue, I would even except an exception statement.

As I stated before, these are already in a database, so there is no cleaning up that code.

Thanks,
-I remain

*****************************************
<CFQUERY name="DBRead" DATASOURCE="DBRead">
    SELECT Domain FROM DB
</CFQUERY>

<CFMAIL QUERY="DBREAD"

-----------------------
TO="Webmaster@#TRIM(Domain)#"
--RIGHT HERE I NEED TO MAKE SURE IT IS IN A VALID FORMAT.
-----------------------
FROM="ME@me.com"
SUBJECT="Request Info">
Dear Webmaster at #Domain#:

blah, blah, blah...
</CFMAIL>
*****************************************

0
Comment
Question by:turbosig
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
hart earned 500 total points
ID: 9686328
if u want to send emails to people who have entered
domains like redhat.com, hotmail.com etc.. only

then the following code will do the check

<CFQUERY name="DBRead" DATASOURCE="DBRead">
    SELECT Domain FROM DB
</CFQUERY>

<cfloop query="DBRead">
<cfif ListLen(trim(domain),'.') EQ 2 And ListFindNoCase(trim(domain),'com','.') neq 0>
    <cfmail from="me@me.com" to="webmaster@#trim(domain)#" subject="something" type="html">
         blah....
    </cfmail>
</cfif>
</cfloop>

but the above code will only work for someaddress.com

regards
Hart
0
 
LVL 2

Author Comment

by:turbosig
ID: 9686360
Thanks.
0
 
LVL 11

Expert Comment

by:hart
ID: 9686380
u r welcome :-)

Regards
Hart
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
What You Need to Know when Searching for a Webhost Provider
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question