参数:$filename (string) – File name
$disposition (string) – ‘disposition’ of the attachment. Most
email clients make their own decision regardless of the MIME
specification used here. https://www.iana.org/assignments/cont-disp/cont-disp.xhtml
$newname (string) – Custom file name to use in the e-mail
$mime (string) – MIME type to use (useful for buffered data)
返回:CodeIgniter\Email\Email instance (method chaining)
返回类型:CodeIgniter\Email\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:
$email->attach('/path/to/photo1.jpg');
$email->attach('/path/to/photo2.jpg');
$email->attach('/path/to/photo3.jpg');
To use the default disposition (attachment), leave the second parameter blank,
otherwise use a custom disposition:
$email->attach('image.jpg', 'inline');
You can also use a URL:
$email->attach('http://example.com/filename.pdf');
If you’d like to use a custom file name, you can use the third parameter:
$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:
$email->attach($buffer, 'attachment', 'report.pdf', 'application/pdf');