【问题标题】:Cake Email Gives an ErrorCake 电子邮件出错
【发布时间】:2013-02-28 12:59:39
【问题描述】:

在我的控制器文件中,我编写了以下代码用于将图像附加到邮件中,但它给出了错误

$email->attachments(array('/localhost/projname/app/webroot/img/file.png'));

它显示一个错误,例如 File not found: "&quot

【问题讨论】:

    标签: cakephp-2.0 cakephp-2.1 cakephp-2.2 cakephp-2.3


    【解决方案1】:

    您可以使用IMAGES 常量来获取图像文件夹的文件路径:

    $email->attachments(array(IMAGES.DS.'file.png'));
    

    【讨论】:

    • 谢谢马特,我得到了解决方案
    【解决方案2】:

    我终于找到了附加图片的解决方案

    $email->attachments(array (
                        array('file'=>ROOT.'/app/webroot/img/car.gif',
                              'mimetype'=>'image/png'
                             ),
                        ));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-06-23
      • 2012-05-16
      • 2012-06-09
      • 1970-01-01
      • 2013-07-14
      • 1970-01-01
      相关资源
      最近更新 更多