I was wondering what language I need to use in order to create a simple form for emailing an email address on a website.
What language do I need to use in order to make this happen, and does it need to be server-side? I would imagine so.
I was wondering what language I need to use in order to create a simple form for emailing an email address on a website.
What language do I need to use in order to make this happen, and does it need to be server-side? I would imagine so.
Yup server side.. I use a combination of PHP and AJAX to achieve this, with a CAPTCHA system integrated in. $_SESSION variables pass through AJAX calls, hence the CAPTCHA works with AJAX.
Here's the most basic form of a PHP mailer...
$to = "[email protected]";
$subject = "Website inquiry from ".$_POST['name'];
$content = "
<html>
<head>
<title></title>
</head>
<body>
<p>
Name: ".$_POST['name']."<br />Phone: ".$_POST['phone'].'<br />Email: '.$_POST['email'].'<br />Referred By: '.$_POST['referred'].'<br /><br />'.nl2br($_POST['message']).
'
</body>
</html>
';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: '.$_POST["email"];
mail($to,$subject,$content,$headers);
echo "<font color=\"#0c0\">Your message has been sent.</font>";
Without using a "mailto:" link, this will need to be server side. The language you use may be restricted by the hosting platform, and what languages are supported, or for which support can be added.