2016-03-17 96 views
0

我試圖讓我的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  = "[email protected]"; 
$mail->FromName = "Murphy's Online Documentation System"; 
$mail->AddAddress("[email protected]"); 

$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

PHP是告訴你,函數不存在。 AddAttachment定義在哪裏?您需要編寫該功能並使其執行某些操作。它應該是'$ mail-> AddAttachment()'? – mkaatman

回答

0

好了所有的固定忘記添加$mail->AddAttachment($path);然後最後整理出$path的位置,這一切現在工作的夢想。