<?php
if ($_POST['friends-email']) {
$name = "Sender's Name";
$email = "[email protected]";
$recipient = preg_replace("/[^a-z0-9 !?:;,.\/_\[email protected]#$&\*\(\)]/im", "", $_POST['friends-email']);
$recipient = preg_replace("/(content-type:|bcc:|cc:|to:|from:)/im", "", $recipient);
$mail_body = "Default Description";
$subject = "Default Subject";
$header = "From: " . $name . " <" . $email . ">\r\n";
mail($recipient, $subject, $mail_body, $header);
echo 'Thank you for recommending <br /> us!';
} else {
echo '<form action="" method="post" name="send2friend" id="send2friend">
Friends Email*:
<input name="friends-email" id="friends-email" type="text" />
<input type="submit" value="continue" />
</form>';
}
?>
不确定为什么这样不起作用,我收到“谢谢你的留言”,但是当我使用自己的电子邮件进行测试时,邮件未送达。告诉朋友表格无法正常工作
尝试使用此邮件的样本邮件(“[email protected]”,“hi”,“tstts”,“stst”)发生了什么? – Efazati 2011-04-24 09:13:56