如何获得以下消息以在phpmailer中正确显示

时间:2019-06-27 03:01:34

标签: php

我正在尝试使以下消息正确显示,但在我的电子邮件中看起来很奇怪。我以为斜线或撇号前应该有反斜杠?

您之所以收到此电子邮件,是因为您或自称是您的某人已在PianoCourse101中注册。

您必须先激活您的帐户,然后才能通过单击下面的链接登录。您需要检查“学生的一般信息”部分下的详细信息,以确保它是正确的。
不正确

[在此处输入图片描述] [1]

//如果PHPMailer位于其他位置,请编辑此路径。

//$mail->SMTPDebug = 2;
include_once __DIR__.'/../PHPMailer/Exception.php';
include_once __DIR__.'/../PHPMailer/PHPMailer.php';
include_once __DIR__.'/../PHPMailer/SMTP.php';
$mail = new PHPMailer\PHPMailer\PHPMailer();
//$mail->isSMTP();  enable this for localhost and disable for live host??? 
$mail->isHTML(true);

/*
 * Server Configuration
 */

$mail->Host = 'smtp.gmail.com'; // Which SMTP server to use.
$mail->Port = 587; // Which port to use, 587 is the default port for TLS and 465 for SSL security.
$mail->SMTPSecure = 'tls'; // Which security method to use. TLS is most secure.
$mail->SMTPAuth = true; // Whether you need to login. This is almost always required.
$mail->Username = "pianocourseforkids101@gmail.com"; // Your Gmail address.
$mail->Password = "******"; // Your Gmail login password or App Specific Password.

/*
 * Message Configuration
 */

$mail->setFrom('Admin@pianocourse101.com', 'PianoCourse101 Registration'); // Set the sender of the message.
$mail->addAddress($email, 'PianoCourse101 Registration'); // Set the recipient of the message.
$mail->Subject = 'PianoCourse101 Registration'; // The subject of the message.

/*
 * Message Content - Choose simple text or HTML email
 */

// Choose to send either a simple text email...
$mail->Body = "Dear $first, $last, <br /></br />

You have received this e-mail because either you or someone claiming to be you has registered with PianoCourse101.<br /><br /> You must activate your account before you can login by clicking on the link below and we encourage you to check through your details under the 'Student’\s General Information' section to make sure that it is correct. <br /></br />Any incorrect information an be updated under the 'Student’\s Update Profile' Section. <br /></br />Lessons can be found under the 'Watch Videos\’ section and we also strongly encourage you to utilise the 'Practice Diary' Section to record your practice. <br /></br />More importantly, we would like you to have fun when practising and make sure that you are also doing your homework on a regular basis.<br></br>If you cannot activate your account for any reasons, then you can request a new token for the primer level under the 'Token Request: Primer Level' section and it will send another token that should work.<br /></br />If all else fails, then you could send an e-mail under the 'Contact Us' section and we will assist in activating your e-mail for you.<br /></br />Also please note that it is best to use a G-mail account when registering with us.<br /></br />

To activate your account, click here:

<a href='https://www.pianocourse101.com/includes/activate.php?email=$email&activatetoken=$token4'>Activate your Primer Level here!</a>

Token: '$token4';

From,

PianoCourse101
"; // Set a plain text body.

// ... or send an email with HTML.
//$mail->msgHTML(file_get_contents('contents.html'));
// Optional when using HTML: Set an alternative plain text message for email clients who prefer that.
//$mail->AltBody = 'This is a plain-text message body'; 

// Optional: attach a file
$mail->addAttachment('images/phpmailer_mini.png');

if ($mail->send()) {
    header("Location: ../student_registration.php?id=$userid");

 // echo "<meta http-equiv='refresh' content='0;url=http://www.pianocourse101.com/includes/student_registration.php?id=$userid'";

//   echo "<meta http-equiv='refresh' content='0;url=../student_registration.php')";
                    exit();
} else {
    echo "Mailer Error: " . $mail->ErrorInfo;
}        



  [1]: https://i.stack.imgur.com/eZYkq.png

0 个答案:

没有答案