attach($filename[, $disposition = ''[, $newname = NULL[, $mime = '']]])
Parameters: |
|
---|---|
Returns: |
CI_Email instance (method chaining) |
Return type: |
CI_Email |
Enables you to send an attachment. Put the file path/name in the first parameter. For multiple attachments use the method multiple times. For example:
$this->email->attach('/path/to/photo1.jpg'); $this->email->attach('/path/to/photo2.jpg'); $this->email->attach('/path/to/photo3.jpg');
To use the default disposition (attachment), leave the second parameter blank, otherwise use a custom disposition:
$this->email->attach('image.jpg', 'inline');
You can also use a URL:
$this->email->attach('http://example.com/filename.pdf');
If you’d like to use a custom file name, you can use the third paramater:
$this->email->attach('filename.pdf', 'attachment', 'report.pdf');
If you need to use a buffer string instead of a real - physical - file you can use the first parameter as buffer, the third parameter as file name and the fourth parameter as mime-type:
$this->email->attach($buffer, 'attachment', 'report.pdf', 'application/pdf');
Please login to continue.