我试图让我的php发送一封现在正常工作的电子邮件,但我现在尝试使用已经在服务器上的附件,因此不涉及上传。但是当我运行它时,我得到了这个致命的错误:
Fatal error: Call to undefined function addattachment() in /home3/hutch/public_html/Murphy/EmailerTest.php on line 19
所以我假设我错误地写了addAttachemnt($path);
或$path
。有人能帮我解决这个问题吗?
<?php
require("class.phpmailer.php");
require("class.smtp.php");
$path = "<IMAGES/Logo.jpg>";
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.sulmaxmarketing.com"; // SMTP server
$mail->From = "info@sulmaxmarketing.com";
$mail->FromName = "Murphy's Online Documentation System";
$mail->AddAddress("sulmaxcp@gmail.com");
$mail->Subject = "Senior Managers Site Tour";
$mail->Body = "You've just recieved an document via the Murphy's Senior Managers Site Tour website.\n Your document is in the attachments";
$mail->WordWrap = 50;
AddAttachment($path);
if(!$mail->Send()) {
echo "<font color='#009900' align=centre> ERROR: Something has gone wrong, please contact the site administrator.</font>";
}
else {
echo "<font color='#CC0033' align=centre>SUCCESS: You're Senior Managers Site Tour document has been sent.</font>";
}
?>
答案 0 :(得分:0)
好的所有修复都忘了将$mail->
添加到AddAttachment($path);
,然后最后整理出$path
的位置,现在一切都成了梦。