Hi guys,

I recently bought a template for a site that has an e-mail alert option. But I can't seem to figure out where I'm supposed to put my e-mail address so that I receive the e-mails. The code below is the only file associated with the e-mail form that came with the template. It calls on a mail.php file; do I need to create that file? If so, how do I do it? Or is there somewhere in this script where I should put my e-mail address?

I'm a total newbie with this stuff (obviously). But I would be sooo grateful for any help.

function isValidEmailAddress(emailAddress) {
var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
return pattern.test(emailAddress);
}



/*FORM validation and div changing*/
$(document).ready(function() { 
/*email validatin*/
  $("#submit").click(function() {
		var email = $("input#email").val();
		if(!isValidEmailAddress(emailAddress)){ 
		$("input#email").focus();
		$("input#email").val('Enter a valid e-mail!');
      return false;
    }
    })

/*form submit*/
$("form#contactForm").submit(function() {
	var email = $("input#email").val();
	$.ajax({
		url:'mail.php',
		type:'post',
		data: "email="+email,
		success: function(msg){
			if (msg==0)
			{			
				$("input#email").focus();
				$("input#email").val('Some trouble on sending!');
			}
			if (msg==1)
			{
				$("input#email").val('Thank you!');
				}
		}
	});
	return false;
});
/*end formsubmit*/
});

Seriously? Nobody knows? Or nobody wants to bother to help the noob?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.