这是我所拥有的:`
<?php
require("/Library/WebServer/Documents/phpmailer/PHPMailer_v5.1/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "host"; // specify main and backup server
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "email@email.com"; // SMTP username
$mail->Password = "password"; // SMTP password
$mail->From = "email@email.com";
$mail->FromName = $_POST["name"];
$mail->AddAddress("other@other.com"); // name is optional
$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = $_POST["subject"];
$mail->Body = $_POST["one"];
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
?>`
我试图在电子邮件正文中包含多个 $_POST,因为我想从 HTML 文档中输入表单。
例如,我希望在正文中包含来自“一个”的输入,等等,但是当我尝试在 $mail->Body 之后放置多个 $_POST 时,它不起作用。
任何帮助将不胜感激