首页 > 解决方案 > 无法发送存储在数据库中的电子邮件附件 - Codeigniter

问题描述

我有一个用户附加文件的表单。该文件被上传到一个文件夹,然后 full_path 链接存储在数据库中。该链接与其他项目一起以数组格式存储。这是它在数据库中的存储方式。

[{"product_id":"20","product_name":"C4(Big A4) Envelopes","quantity":"1000","image":"\"\\\/home\\\/printlin\\\/public_html\\\/uploads\\\/birthday24.jpg\""}]

现在,当我想发送电子邮件时,我对存储在数据库中的数据进行解码并将 file_path 放在 attach() 函数中。

foreach ($data['shopping_cart'] as $cart_data) { 
        $items = json_decode($cart_data['items'],true);
           foreach ($items as $documents){
              $this->email->attach(stripcslashes($documents['image']));
            }
        }

电子邮件已发送,但不附带任何附件。($documents['image']) 显示为:

"\/home\/printlin\/public_html\/uploads\/birthday28.jpg"

stripcslashes($documents['image']) 显示为:

"/home/printlin/public_html/uploads/birthday28.jpg"

我的链接格式可能有什么问题?

标签: codeigniteremail-attachments

解决方案


推荐阅读