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 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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 java面向对象程序设计
  • ¥20 Keil uVision5创建project没反应
  • ¥15 mmseqs内存报错
  • ¥15 vika文档如何与obsidian同步
  • ¥15 华为手机相册里面的照片能够替换成自己想要的照片吗?
  • ¥15 陆空双模式无人机飞控设置
  • ¥15 sentaurus lithography
  • ¥100 求抖音ck号 或者提ck教程
  • ¥15 关于#linux#的问题:子进程1等待子进程A、B退出后退出(语言-c语言)
  • ¥20 web页面如何打开Outlook 365的全球离线通讯簿功能