Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Zend Mime Laravel Package

zendframework/zend-mime

Zend\Mime is a PHP library for creating and parsing MIME messages. Build multipart emails, manage MIME parts, boundaries, headers, and content types/encodings, and handle attachments reliably—useful for mail composition and transport integration.

View on GitHub
Deep Wiki
Context7

Zend\Mime\Message

Zend\Mime\Message represents a MIME compliant message that can contain one or more separate Parts (represented as Zend\Mime\Part instances). Encoding and boundary handling are handled transparently by the class. Message instances can also be generated from MIME strings.

Instantiation

There is no explicit constructor for Zend\Mime\Message.

Adding MIME Parts

Zend\Mime\Part instances can be added to a given Message instance by calling ->addPart($part)

An array with all Part instances in the Message is returned from the method getParts(). The Part instances can then be modified on retrieveal, as they are stored in the array as references. If parts are added to the array or the sequence is changed, the array needs to be passed back to the Message instance by calling setParts($partsArray).

The function isMultiPart() will return TRUE if more than one part is registered with the Message instance; when true, the instance will generate a multipart MIME message.

Boundary handling

Zend\Mime\Message usually creates and uses its own Zend\Mime\Mime instance to generate a boundary. If you need to define the boundary or want to change the behaviour of the Mime instance used by Message, you can create the Mime instance yourself and register it with your Message using the setMime() method; this is an atypical occurrence.

getMime() returns the Mime instance to use when rendering the message via generateMessage().

generateMessage() renders the Message content to a string.

Parsing a string to create a Zend\Mime\Message object

Zend\Mime\Message defines a static factory for parsing MIME-compliant message strings and returning a Zend\Mime\Message instance:

$message = Zend\Mime\Message::createFromMessage($string, $boundary);

As of version 2.6.1, You may also parse a single-part message by omitting the $boundary argument:

$message = Zend\Mime\Message::createFromMessage($string);

Available methods

Zend\Mime\Message contains the following methods:

  • getParts: Get the all Zend\Mime\Parts in the message.
  • setParts($parts): Set the array of Zend\Mime\Parts for the message.
  • addPart(Zend\Mime\Part $part): Append a new Zend\Mime\Part to the message.
  • isMultiPart: Check if the message needs to be sent as a multipart MIME message.
  • setMime(Zend\Mime\Mime $mime): Set a custom Zend\Mime\Mime object for the message.
  • getMime: Get the Zend\Mime\Mime object for the message.
  • generateMessage($EOL = Zend\Mime\Mime::LINEEND): Generate a MIME-compliant message from the current configuration.
  • getPartHeadersArray($partnum): Get the headers of a given part as an array.
  • getPartHeaders($partnum, $EOL = Zend\Mime\Mime::LINEEND): Get the headers of a given part as a string.
  • getPartContent($partnum, $EOL = Zend\Mime\Mime::LINEEND): Get the encoded content of a given part as a string.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4
php-http/client-implementation
phpcr/phpcr-implementation
cucumber/gherkin-monorepo
haydenpierce/class-finder
psr/simple-cache-implementation