CodeIgniter Forums
Problem with email->attach() on CI 3.1.2 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Problem with email->attach() on CI 3.1.2 (/showthread.php?tid=67246)



Problem with email->attach() on CI 3.1.2 - nvv - 01-31-2017

Hi.
I'm have a problem.

final public function send_order_to_email($id_order, $email, &$body, $file_attach = null)
    {
        $this->load->library('email');
        $this->email->initialize(array(
            'useragent' => 'useragent',
            'mailtype' => 'html',
            'validate' => true
        ));
        $this->email->from('[email protected]', 'useragent');
        $this->email->to($email);
        $this->email->subject('Order №' . $id_order);
        $this->email->message($body);
        if (!is_null($file_attach)) {
            $this->email->attach($file_attach, 'attachment', 'invoice_' . $id_order . '.pdf');
        }
        return (bool)$this->email->send();
    }
WHERE:
$file_attach= base_url( ' /email/attch/myfile.pdf ' ); (file is present on server)
$email = [email protected]

Problem: on local server - code works fine. On hoster's server - letters to the email come, but file size is 0 bytes


RE: Problem with email->attach() on CI 3.1.2 - Wouter60 - 01-31-2017

This is a known error. Update to 3.1.3 to solve it.


RE: Problem with email->attach() on CI 3.1.2 - Narf - 01-31-2017

(01-31-2017, 11:18 AM)Wouter60 Wrote: This is a known error. Update to 3.1.3 to solve it.

No, it's not.
The OP should upgrade regardless though.


RE: Problem with email->attach() on CI 3.1.2 - nvv - 01-31-2017

(01-31-2017, 11:18 AM)Wouter60 Wrote: This is a known error. Update to 3.1.3 to solve it.

Thank you. It has been updated to CI 3.1.3 and code worked.