Download the PHP package initphp/mailer without Composer
On this page you can find all versions of the php package initphp/mailer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package mailer
InitPHP Mailer
A small, dependency-free PHP mailer. Compose a message with a fluent API and
send it through PHP's native mail(), a local sendmail binary, or SMTP — with
attachments, inline images, HTML + plain-text multipart bodies and RFC-compliant
header encoding.
Upgrading from 1.x? Version 2.0 keeps the same fluent API but raises the PHP requirement, encapsulates state and replaces
boolreturn values with exceptions. See UPGRADE-2.0.md.
Requirements
- PHP 8.1 or higher
- ext-mbstring, ext-iconv, ext-fileinfo
Installation
Quick start
SMTP
Native mail()
HTML with a plain-text alternative
Attachments and inline images
Error handling
send() returns void and throws on failure. Invalid input is rejected as soon
as it is supplied (fail-fast), not deferred to send().
| Exception | When |
|---|---|
InvalidAddressException |
A sender/recipient address fails validation. |
ConfigurationException |
A required value is missing (no sender, no recipient, empty SMTP host). |
AttachmentException |
An attachment cannot be read or its type detected. |
TransportException |
Delivery failed (the SMTP reply code is in getCode()). |
All extend InitPHP\Mailer\Exception\MailerException, so a single catch can
handle any failure.
Facade
For quick, one-off usage there is a static facade backed by a shared instance:
To configure the shared instance, build a Mailer and register it:
Documentation
Full developer documentation lives in docs/:
- Getting started
- Configuration
- Sending mail
- Attachments
- SMTP transport
- Encoding & headers
- Exceptions
- Facade
Contributing
Bug reports and pull requests are welcome on the issue tracker. New code should come with tests; run the full check bundle before opening a PR:
Credits
License
Released under the MIT License. Copyright © 2022 InitPHP.
All versions of mailer with dependencies
ext-mbstring Version *
ext-iconv Version *
ext-fileinfo Version *