结合 first_name 和 last_name 在 PHP Mailer 中给出全名
combining first_name with last_name to give full name in PHP Mailer
我所有的表格都很好用,我唯一想做的就是将 first_name 和 last_name 结合起来,在电子邮件 header 中给出全名。我正在使用 PHPMailer。这是我尝试使用的代码 -
$firstname = $_POST["first_name"];
$lastname = $_POST["last_name"];
$fullname = $firstname . ' ' . $lastname;
$fullname = $_POST["name"];
$mail = new PHPMailer(TRUE);
$mail->From = $_POST["email"]; //Sets the From email address for the
message
$mail->FromName = $_POST["name"]; //Sets the From name of the message
$mail->AddAddress('timmy2872@gmail.com'); //Adds a "To" address
$mail->WordWrap = 50; //Sets word wrapping on the body of the
message to a given number of characters
$mail->IsHTML(true); //Sets message type to HTML
$mail->AddAttachment($path); //Adds an attachment from a path on the
filesystem
$mail->Subject = 'Employer Application Form details'; //Sets the
Subject of the message
$mail->Body = $message; //An HTML or plain text message body
if($mail->Send()) //Send an Email. Return true on success or
false on error
谁能看出我做错了什么??
最终用这个修复了它 -
$full_name = $_POST["first_name"] . ' ' . $_POST["last_name"]
$mail->FromName = $full_name;
感谢蒂姆让我走上正轨
我所有的表格都很好用,我唯一想做的就是将 first_name 和 last_name 结合起来,在电子邮件 header 中给出全名。我正在使用 PHPMailer。这是我尝试使用的代码 -
$firstname = $_POST["first_name"];
$lastname = $_POST["last_name"];
$fullname = $firstname . ' ' . $lastname;
$fullname = $_POST["name"];
$mail = new PHPMailer(TRUE);
$mail->From = $_POST["email"]; //Sets the From email address for the
message
$mail->FromName = $_POST["name"]; //Sets the From name of the message
$mail->AddAddress('timmy2872@gmail.com'); //Adds a "To" address
$mail->WordWrap = 50; //Sets word wrapping on the body of the
message to a given number of characters
$mail->IsHTML(true); //Sets message type to HTML
$mail->AddAttachment($path); //Adds an attachment from a path on the
filesystem
$mail->Subject = 'Employer Application Form details'; //Sets the
Subject of the message
$mail->Body = $message; //An HTML or plain text message body
if($mail->Send()) //Send an Email. Return true on success or
false on error
谁能看出我做错了什么??
最终用这个修复了它 -
$full_name = $_POST["first_name"] . ' ' . $_POST["last_name"]
$mail->FromName = $full_name;
感谢蒂姆让我走上正轨