|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
How to validate email address before sending mail
Does anyone know a good way to validate an email address prior toIssac Rosa 05/21/04 02:28 P Yes use the followingBryan F. Hogan 05/21/04 02:33 P Thanks, I already do this prior to saving the email in the db. I wantIssac Rosa 05/21/04 02:43 P Good luck.Bryan F. Hogan 05/21/04 02:56 P You can't guarantee that you will get the response you are expecting, forPaul Vernon 05/21/04 03:00 P At 12:26 PM 5/21/2004, you wrote:Scott Weikert 05/21/04 02:34 P Try thisHassan Arteaga Rodriguez 05/21/04 02:37 P Do you want to validate just to make sure it fits the proper format fortechmike 05/21/04 02:38 P Issac Rosa wrote:Rick Root 05/21/04 03:10 P Does anyone know a good way to validate an email address prior to sending out the email? The scenario is that I have a database of customers and want to send an email, but want to capture the email addresses that will bounce prior to sending the email. TIA, Issac Yes use the following <script> function checkForm(theForm) { var emailRegex=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/; if(document.forms[theForm.name].contactEmail.value.length==0||emailRegex.test(document.forms[theForm.name].contactEmail.value)==false) { alert('Please enter the email address!'); return false; } else { return true; } } </script> <form name="myForm" action="..." method="post" onsubmit="return checkForm(this)"> ... </form> Issac Rosa wrote: > Does anyone know a good way to validate an email address prior to > sending out the email? The scenario is that I have a database of > customers and want to send an email, but want to capture the email > addresses that will bounce prior to sending the email. Thanks, I already do this prior to saving the email in the db. I want to test the mailbox to make sure I get a valid response to avoid bounced messages prior to sending the actual email. Yes use the following <script> function checkForm(theForm) { var emailRegex=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/; if(document.forms[theForm.name].contactEmail.value.length==0||emailRegex .test(document.forms[theForm.name].contactEmail.value)==false) { alert('Please enter the email address!'); return false; } else { return true; } } </script> <form name="myForm" action="..." method="post" onsubmit="return checkForm(this)"> ... </form> Issac Rosa wrote: > Does anyone know a good way to validate an email address prior to > sending out the email? The scenario is that I have a database of > customers and want to send an email, but want to capture the email > addresses that will bounce prior to sending the email. _____ Good luck. Issac Rosa wrote: > Thanks, I already do this prior to saving the email in the db. I want > to test the mailbox to make sure I get a valid response to avoid bounced > messages prior to sending the actual email. You can't guarantee that you will get the response you are expecting, for instance MS Exchange 2000 servers and below all respond 250 if the domain is valid and accept the mail, they may well bounce it later but if they manage that domain, they will accept anything sent to it initially. I know Exchange 2003 operates differently if you want it to in that it will only accept mail for the defined mailboxes if you set it up that way. As for other mail servers, I think how this is implemented is totally dependent on how the developers interpreted the relevant RFC documentation. Paul At 12:26 PM 5/21/2004, you wrote: >Does anyone know a good way to validate an email address prior to >sending out the email? The scenario is that I have a database of >customers and want to send an email, but want to capture the email >addresses that will bounce prior to sending the email. I use a custom tag called ValidEmail (off the DevEx) that works pretty well. It's not 100% though. Try this <cfif NOT REFindnocase("^[-_!a-z0-9\.]+@([-_a-z0-9]+\.)+[a-z]{2,6}$", form.email_Field)> Regards __ M.Sc. Hassan Arteaga RodrÃguez Microsoft Certified System Engineer DIGI-Grupo de Desarrollo COPEXTEL, S.A. _____ Sent: Friday, May 21, 2004 1:26 PM To: CF-Talk Subject: How to validate email address before sending mail Does anyone know a good way to validate an email address prior to sending out the email? The scenario is that I have a database of customers and want to send an email, but want to capture the email addresses that will bounce prior to sending the email. TIA, Issac _____ Do you want to validate just to make sure it fits the proper format for email, or to test if the domain and box exist? I know of no way to do the later, but you could use regular expressions to validate the format of the email. Do a google for email validation regex -mike ----- Excess quoted text cut - see Original Post for more ----- Issac Rosa wrote: > Does anyone know a good way to validate an email address prior to > sending out the email? The scenario is that I have a database of > customers and want to send an email, but want to capture the email > addresses that will bounce prior to sending the email. It can't be done reliably. MANY mail servers will accept mail for non-existent accounts, then bounce them. - Rick
|
May 24, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||