Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Email 用cakephp发送带有附件的电子邮件_Email_Cakephp - Fatal编程技术网

Email 用cakephp发送带有附件的电子邮件

Email 用cakephp发送带有附件的电子邮件,email,cakephp,Email,Cakephp,我想用cakephp发送带有附件的电子邮件 这是我的密码: $Email = new CakeEmail('default'); $Email->from(array('info@test.com' => $message['Message']['subject'])) ->to($email) ->sender(array('info@test.com' => $message['Message']['subject'])

我想用cakephp发送带有附件的电子邮件

这是我的密码:

 $Email = new CakeEmail('default');
    $Email->from(array('info@test.com' => $message['Message']['subject']))
        ->to($email)
        ->sender(array('info@test.com' => $message['Message']['subject']))
        ->replyTo(array('info@test.com' => $message['Message']['subject']))
        ->subject($message['Message']['subject'])
        ->attachments(array(
            1 => 'http://test.com/files/message_file/file/9/56b22b15b3cec.jpg'
        ))
        ->send($message['Message']['description']);
但我在运行它时遇到了这个错误:

找不到文件:“”
错误:发生内部错误。

附件需要使用文件系统路径而不是URL。

附件需要使用文件系统路径而不是URL。

附件需要使用文件系统绝对路径

$Email
      ->attachments(array(
            1 =>  WWW_ROOT . 'files' . DS. 'message_file' . DS . 'file'.DS.'9'.DS.'56b22b15b3cec.jpg'
        ))

使用用于附件的文件的服务器绝对路径

$Email
      ->attachments(array(
            1 =>  WWW_ROOT . 'files' . DS. 'message_file' . DS . 'file'.DS.'9'.DS.'56b22b15b3cec.jpg'
        ))