Attachment
Less than 1 minute
Attachment
Represents an email attachment, extending MIME part functionality.
class Attachment extends \Hazaar\Mail\Mime\PartExtends: Hazaar\Mail\Mime\Part
Handles 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 | Hazaar\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 Fri, 04 Sep 2026 23:32:17 +0000