我正在尝试使用 phpMailer 发送邮件。这是我的代码:
<?php
require_once('phpmailer/class.phpmailer.php');
$mail = new PHPMailer(true);
$mail->PluginDir = "phpmailer/";
$mail->IsSMTP();
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->Username = "xxx@gmail.com";
$mail->Password = "xxxxx";
$mail->SetFrom('yyyya@gmail.com', 'Nasze imie i nazwisko');
$mail->AddAddress("email@anymail.pl"); // ADRESAT
$mail->Subject = 'Test message';
// w zmienną $text_body wpisujemy treść maila
$text_body = "Hello, \n\n";
$text_body .= "Sending succesfully, \n";
$text_body .= "PHPMailer";
$mail->Body = $text_body;
if(!$mail->Send())
echo "There has been a mail error <br>";
echo $mail->ErrorInfo."<br>";
// Clear all addresses and attachments
$mail->ClearAddresses();
$mail->ClearAttachments();
echo "mail sent <br>";
?>
邮件没有发送,在浏览器中我有空白页面,没有消息。这里有什么问题?
最好的问候, 达格纳