使邮件地址可点击:
<a target="popup" onclick="window.open('', 'popup', 'width=580,height=360,scrollbars=no, toolbar=no,status=no,resizable=yes,menubar=no,location=no,directories=no,top=10,left=10')" href="sendMail.php?mail=foo@example.com">foo@example.com</a>
这就是用户来自的网站。
“sendMail.php”看起来像这样:
<?php
if(isset($_GET["mail"] ,$_POST["subject"] ,$_POST["message"] ,$_POST["headers"])) {
// to:
$mail = $_GET["mail"];
// subejct:
$subject = $_POST["subject"];
// message:
$message = $_POST["message"];
// headers ("From:".$from):
$headers = $_POST["headers"];
// sendMail
mail($mail, $subject, $message, $headers);
} elseif(isset($_GET["mail"])) {
$mail = $_GET["mail"];
echo '
<html>
<head>
<title>Mail to <?php echo $mail; ?></title>
</head>
<body>
<form action="sendMail.php" method="post">
// All inputs w/ names
</form>
</body>
</html>';
} else {
echo "Error";
} ?>