mini\Mail\EmailInterface::withAttachments() Method

public abstract

Signature

public abstract function withAttachments(array $attachments): static

Parameters

Name Type Default Description
$attachments array required Documentation missing

Returns

static

Documentation

Return instance with the specified attachments

Attachments can be specified as file paths or MessageInterface instances. Use string keys to override the displayed filename:

->withAttachments([
    '/path/to/file.pdf',                    // Filename: file.pdf
    'Report.pdf' => '/tmp/generated.pdf',   // Filename: Report.pdf
    Message::fromFile('data.csv'),          // Filename from Message
])

This method replaces any existing attachments.

Source

src/Mail/EmailInterface.php:448