Code Igniter -> attach email

后端 未结 5 917
逝去的感伤
逝去的感伤 2020-12-06 07:19

How do you use the email->attach function?

I can\'t figure what is happen, cos when i put the code for email->attach the mesage came in blank(the mail body) and ther

5条回答
  •  眼角桃花
    2020-12-06 08:08

    This is a late update, but it might be useful.
    It was said twice

    "You can not directly attach a file from the upload field of your form to an email"

    . However, this works fine in Codeigniter 3.0

    foreach ($_FILES as $key => $file)
    {
        if ($file['error'] == 0)
        {
            $this->email->attach($file['tmp_name'], '', $file['name']);
        }
    }
    

    (Though, the email is not sent and no errors are shown, if there are two files with the same name)

提交回复
热议问题