0
我有以下形式:PHP郵件不包括身體
<form action="" method="post" enctype="multipart/form-data">
<input required="required" name="name" type="text" placeholder="Name" /><br /><br />
<input required="required" name="email" type="text" placeholder="Email" /><br /><br />
<input required="required" name="phone" type="text" placeholder="Phone Number" /><br /><br />
<input required="required" name="website" type="text" placeholder="URL to blog/website" /><br /><br />
<input type="file" name="file" /><br /><br />
<textarea name="message" cols="" rows="10" placeholder="Message (optional)"></textarea><br /><br />
<input name="send_form" type="submit" value="Submit" style="float:right; width:200px;" />
</form>
這是我的PHP:
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = "xxxxxx"; // sets the SMTP server
$mail->Username = "xxxxxxx";// SMTP account username
$mail->Password = "xxxx"; // SMTP account password
$mail->From = $_REQUEST['email'];
$mail->FromName = $_REQUEST['name'];
$mail->IsHTML(true);
$mail->Subject = "CV Upload";
$body = 'Name:'.$_REQUEST['name'].'<br /><br />Email:'.$_REQUEST['email'].'<br /><br />Email:'.$_REQUEST['website'].'<br /><br />Message:'.$_REQUEST['message'].'<br /><br />';
$mail->Body = $body;
$mail->AltBody = $text_body;
$mail->AddAddress("[email protected]");
$mail->AddAttachment($_FILES['file']['tmp_name'], $_FILES['file']['name']);
if($mail->Send()){
$success = true;
}else{
$success = false;
}//if($mail->Send()){}
出於某種原因,正文內容是不是在我收到的電子郵件顯示。主題行和其他所有工作。上面有任何問題嗎?
您在哪裏聲明$ body和$ text_body?我只看到一個名爲'message'的文本區域。 – Matheno
$ body基本上都是表單域,如上所述。 – danyo
啊,是的,對不起,沒有注意到。 – Matheno