我正在尝试通过电子邮件将我的邮件内容作为pdf格式发送给用户。我使用电子邮件功能作为phpmailer和dompdf。我不知道我错在哪里。我没有收到mail.it显示错误,因为没有收到电子邮件ID。
这是我的代码:
<html>
<head>
<title>Email Support</title>
</head>
<body>
<?php
require_once 'dompdf/autoload.inc.php';
use Dompdf\Dompdf;
$dompdf = new Dompdf();
require_once('PHPMailer-master/class.phpmailer.php');
$mail = new PHPMailer(true);
$mail->IsSMTP();
try {
if (isset($_POST['message'])) {
$message = $_POST['message'];
} else {
$message = "";
}
if (isset($_POST['emailid'])) {
$emailid = $_POST['emailid'];
$mail->Host = "";
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->Host = "";
$mail->Port =;
$mail->Username = "";
$mail->Password = "";
$mail->AddReplyTo('', '');
$mail->AddAddress($emailid, ' ');
$mail->SetFrom('', '');
$mail->AddReplyTo('', '');
$mail->Subject = "";
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
$mail->MsgHTML($message);
$dompdf = new Dompdf();
$dompdf->loadHtml($message);
$dompdf->render();
$output = $dompdf->output();
$mail->Send();
echo "Message Sent OK</p>\n";
} else {
echo "No email id received.";
}
} catch (phpmailerException $e) {
echo $e->errorMessage();
} catch (Exception $e) {
echo $e->getMessage();
}
?>
</body>
任何人都可以帮助我吗?
提前致谢。