0
我使用PHPMailer自动发送订单确认作为HTML格式的电子邮件。除了确认格式不正确之外,所有内容都按预期工作。我在我的样式表中加入了一个'AddAttachment'这一行,它似乎固定了确认表单的标题,但是表单的其余部分仍然不正确。有没有人遇到过这种情况,并知道我需要做什么来解决它?我编辑的程序代码如下,以防万一它会帮助!PHPMailer和样式表格式化
<?php
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->SMTPDebug = 0;
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPAuth = true;
$mail->Port = 25; // set the SMTP port
$mail->Host = "<<smtp server>>"; // SMTP server
$mail->Username = "<<username>>";
$mail->Password = "<<password>>";
$mail->From = "<<email address>>";
$mail->FromName = "<<name>>";
$mail->AddAddress("<<email address>>");
$mail->Subject = "Acknowledgement Form";
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
$mail->IsHTML(true);
$mail->Body = file_get_contents('<<acknowledgement form page>>');
$mail->AddAttachment('printer.css'); // attach style sheet
if(!$mail->Send()) {
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent.';
}
?>