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 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog