嗨,我正在尝试用 php 发送电子邮件,但我一直收到此错误
致命错误:在第 2 行的 C:\wamp\www\Site\php\phpmailer.php 中找不到类 'PHPMailer'
这是我的代码如下:
<?php
$mail = new PHPMailer();
$mail->IsSMTP();
//GMAIL configerations
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->Username = "myaddress@gmail.com";
$mail->Password = "password";
//End Gmail
$mail->From = "address@gmail.com";
$mail->FromName = "Me";
$mail->Subject = "Trial";
$mail->MsgHTML("this is atest message");
$mail->AddAddress("my address@gmail.com","name to");
$mail->IsHTML(true);
if(!$mail->Send()) {//to see if we return a message or a value bolean
echo "Mailer Error: " . $mail->ErrorInfo;
} else{
echo "Message sent!";
}
?>