2012-09-07 14:44
浏览 24


I'm using PHPMailer to send customers receipt of their order in a pdf format. PDF creation works like a dream, but it just wont attach it to mail. I've tried to my gmail and my own servers email, but it wont send the attachment. Here's my code:

//Lähetä tilausvahvistus
$bodytext = '
Olemme vastaanottaneet tilauksenne '. $ordernumber .'. 
Tilaamanne tuotteet löytyvät liitteestä.'
$email = new PHPMailer();
$email->From      = '';
$email->FromName  = '';
$email->Subject   = 'Olemme vastaanottaneet tilauksenne ' . $ordernumber;
$email->Body      = $bodytext;
return $email->Send();

I've tried relative path and direct path, but no, it wont send.

图片转代码服务由CSDN问答提供 功能建议

我正在使用PHPMailer以pdf格式向客户发送订单收据。 PDF创作就像一个梦想,但它不会附加到邮件。 我试过我的Gmail和我自己的服务器电子邮件,但它不会发送附件。 这是我的代码:

require_once('mail / class.phpmailer.php'); 
 $ bodytext ='
  vastaan​​ottaneet tilauksenne'。  $ ordernumber。'。  
 $ email = new PHPMailer(); 
 $ email-&gt; From =''; 
 $ email-&gt; FromName ='no'; 
 $ email-&gt; Subject ='Olemme vastaan​​ottaneet tilauksenne'。  $ ordernumber; 
 $ email-&gt; Body = $ bodytext; 
 $ email-&gt; AddAddress(''); 
 $ email-&gt; AddAttachment('kuitit / kuitti777.pdf  ','kuitti777.pdf'); 
return $ email-&gt;发送(); 

我尝试了相对路径和直接 路径,但不,它不会发送。

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • duanhuo7441
    duanhuo7441 2012-09-07 14:56

    check that PHP is interpreting your path to the file correctly. Try sticking the $pathtofile in a session and using that rather than statically assigning (or dumping it to output) so you can ensure it isn't a simple path issue.

    点赞 评论
  • dongpan9760
    dongpan9760 2012-09-07 15:01

    Have you validate your path correctly?

    Try to write your path again using $_SERVER['DOCUMENT_ROOT']

    点赞 评论