好吧,我有我的表單(第一段代碼),我試圖用PHPmailer發送它。但是,它發送沒有任何實際表單信息的消息。我很迷茫,如何讓這個工作。PHPmailer:從表單發送
<form action="send_form_email.php" method="post" id="ContactForm">
<fieldset>
<p class="email">magazines/newspapers</p>
<ol>
<li>
<label for=name>Name</label>
<input id="name" name="name" type="text" placeholder="name" required autofocus>
</li>
<li>
<label for=email>Email</label>
<input id="email" name="email" type=email placeholder="[email protected]" required>
</li>
<li>
<label for=telephone>Phone</label>
<input id=telephone name=telephone type=tel placeholder="Eg. 888-555-5555" required>
</li>
<li>
<label for="comments">note</label>
<textarea name=comments type=text placeholder="enter your comments" required></textarea>
</li>
<li>
<label for="file">File</label>
<input id="file" type="file" name="file" />
</li>
</ol>
</fieldset>
<fieldset>
<button type=submit>submit</button>
</fieldset>
</form>
郵件腳本:
require("mail/class.phpmailer.php");
$mail = new PHPMailer();
$mail->Host = "localhost";
$mail->From = "[email protected]";
$mail->FromName = "Your Name";
$mail->AddAddress("[email protected]");
$mail->Subject = "Feedback form results";
$mail->Body = $comments;
$mail->WordWrap = 50;
if(!$mail->Send())
{
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
}
else
{
echo 'Thank you for your feedback.';
}
$email = $_REQUEST['email'] ;
$comments = $_POST['telephone'] ;
$phone = $_REQUEST['comments'] ;
$message = $_REQUEST['message'] ;
O,謝謝..非常愚蠢的問題。但是,我如何發送多個「變量」。現在$評論被設置爲電話。但我確實需要電子郵件,電話,評論,甚至是文件上傳。 – 2010-08-30 20:13:59
您希望得到的電子郵件看起來像給定的電子郵件地址,電話號碼,評論等,看起來像什麼? – ngroot 2010-08-30 20:36:49
名稱 電子郵件 數 評論 文件附件 – 2010-08-30 22:12:48