我的PHP電子郵件腳本似乎並沒有發送,但我看不出爲什麼。我也明白,我的腳本存在某些安全漏洞,任何意見都非常感謝!PHP的HTML電子郵件不發送
謝謝
<?php
include('config.php');
$email1 = $_POST['email1'];
$id = $_POST['id'];
$fname = $_POST['fname'];
$firstname = $_POST['firstname'];
$surname = $_POST['surname'];
$to = '$email1';
$from = "$email";
$subject = "SC - You Have a Reply";
$body = "<html>
<body bgcolor=\"#FFFFFF\">
<center>
<b>Dear $firstname</b> <br>
<font color=\"red\">You have a response, regarding your Ad on StudentClutter!</font> <br>
<p> --------------------------------------------------------- </p>
<b> $fname </b>
<p> --------------------------------------------------------- </p>
<p> ".stripslashes($_POST['body'])." </p>
<br>
<br>
<br>
<p> You can reply to them by email: $emailadd </p>
<br>
<br>
<br>
<p>Thank you for using studentclutter.com </p>
<p> -- The Student Clutter Team </p>
</center>
</body>
</html>";
// To send the HTML mail we need to set the Content-type header.
$headers = "MIME-Version: 1.0rn";
$headers .= "Content-type: text/html; charset=iso-8859-1rn";
$headers .= "From: $from\r\n";
// now lets send the email.
mail($to, $subject, $body, $headers);
echo "Message has been sent!";
?>
您是否得到某種錯誤?這可以幫助我們找出問題所在。 – Stegrex
使用http://swiftmailer.org/和你的問題已經消失... –
@Glavić謝謝你看起來像一個很好的解決方案,任何想法如何使用它? – neeko