douwen7516
2016-03-17 16:10 阅读 36
已采纳

电子邮件附件致命错误

I'm trying to get my php to send an email which works fine now but im now attempting it to work with an attachment with it which is already on the server so there is no upload involved. But when I run it I get this fatal error: Fatal error: Call to undefined function addattachment() in /home3/hutch/public_html/Murphy/EmailerTest.php on line 19 So i'm assuming i'm writing the addAttachemnt($path); or $path incorrectly. Could someone clear this up for me?

<?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.
 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>";
}

?>
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    dongxing2015 dongxing2015 2016-03-17 16:28

    Okay all fixed forgot to add $mail-> to AddAttachment($path); then lastly sorted out the location of the $path and it all works a dream now.

    点赞 评论 复制链接分享

相关推荐