在CakePHP中将多个文件附加到电子邮件 [英] Attach multiple files to email in CakePHP

查看:67
本文介绍了在CakePHP中将多个文件附加到电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在邮件中附加5个动态文本文件,但不起作用。

I want to attach 5 dynamic text file in mail but not working.

我在电子邮件中发送单个附件,但我的代码完美:

I send single attachment in email working perfect my code is :

  $Email->attachments('path/to/example.txt');

但是我在电子邮件中发送了多个附件,无法正常工作。

But i send multiple attachment in email not working.

我的代码是:

$Email->attachments('path/to/example.txt','path/to/example1.txt','path/to/example3.txt','abs/path/to/example4.txt','path/to/example5.txt');


推荐答案

尝试使用以下代码进行多次附件:

Try this code for multiple attachment :

$Email->attachments(array(
            'example.txt' => array(
                'file' => 'path/to/example.txt',
                'mimetype' => 'text/plain'
            ),
example1.txt' => array(
                'file' => 'path/to/example1.txt',
                'mimetype' => 'text/plain'
            ),
example3.txt' => array(
                'file' => 'path/to/example3.txt',
                'mimetype' => 'text/plain'
            ),
example4.txt' => array(
                'file' => 'path/to/example4.txt',
                'mimetype' => 'text/plain'
            ),
example5.txt' => array(
                'file' => 'path/to/example5.txt',
                'mimetype' => 'text/plain'
            )

        ));

这篇关于在CakePHP中将多个文件附加到电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆