<?php
if ($_POST['friends-email']) {
$name = "Sender's Name";
$email = "sender@domain.com";
$recipient = preg_replace("/[^a-z0-9 !?:;,.\/_\-=+@#$&\*\(\)]/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>';
}
?>
不知道为什么这不起作用,我收到“谢谢您的消息”,但是当我使用自己的电子邮件进行测试时,电子邮件没有送达。