Click to See Complete Forum and Search --> : Email from Specific @domain


drumbum360
09-15-2009, 12:28 PM
I have created a form but want to add validation that checks to see if the email provided is anythinghere@specificdomain.edu

So far what I have is,

If request("email") = "^(([^<>()[\]\\.,;:\s@""]+(\.[^<>()[\]\\.,;:\s@""]+)*)|("".+""))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$" Then
sendEmail "email@university.edu", request("email"), request("hall") & " Hall RA Form", body
response.redirect("http://www.university.edu/housing")

Else

Response.Write("Please press back and enter the correct email address.")

END IF



I get the else message every time rather than the email sending. I know I don't even have the @specificdomain.edu filtering implemented into this code as I do not know how to do so. Any help you can provide me will be greatly appreciated.

Thank you!

Kuriyama
09-15-2009, 01:29 PM
I don't think VBScript RegEx works like that. Try defining a RegEx object and using the .Test function on that object.

drumbum360
09-15-2009, 02:53 PM
Thank you for your response. I'm confused as to what you mean though. I think my confusion comes from my lack of asp knowledge.

I need to dim regEx first and then assign it like this?


dim regEx
regEx = "^(([^<>()[\]\\.,;:\s@""]+(\.[^<>()[\]\\.,;:\s@""]+)*)|("".+""))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$"

IF request("email") = regEx.Test then
...
the rest of the code
....