Forum Moderators: open
I keep getting emails from a person using very similar email address to my own (obviously someone I know).
The question is, how can I give them a special Javascript message, if using certain email addresses. Let's assume the email address is:
myemail@here.com
The RegExp I already have in place is:
var emailRegExp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
I know haw to set the message etc, but can't quite seem to get the speacial email to throw the message up..
I thought replacing the a-zA-Z0-9 with myemail would work, but it doesn't.
All help much appreciated.
Not directly, but you can use the server side language of your choice to pass that information to your javascript. For PHP something like this would work:
<script type="text/javascript">
var user_ip = '<?php echo $_SERVER['REMOTE_ADDR']; ?>';
alert(user_ip); // testing only, use this variable in your existing function
</script>
To block certain email addresses, you'd want to do a separate check from the one to validate the format of the email address. If you post a snippet of your code, we should be able to recommend a place to do so.