Attachment
Less than 1 minute
Attachment
Represents an email attachment, extending MIME part functionality.
class Attachment extends \Hazaar\Mail\PartHandles file attachment encoding, content type, and headers for email transmission. Supports base64 encoding and custom file naming.
Methods
__construct
Constructs an Attachment object for use in email messages.
public __construct(File $file, ?string $name, bool $base64_encode = true): voidSets content type, description, and headers for the file. Optionally encodes the file contents in base64 for safe email transmission.
Parameters
| Parameter | Type | Description |
|---|---|---|
$file | File | the file to attach to the email |
$name | string | optional custom name for the attachment; defaults to the file's basename |
$base64_encode | bool | whether to encode the file contents in base64 (default: true) |
Generated by Hazaar API Doc Generator on Tue, 21 Apr 2026 04:00:23 +0000