Download the PHP package inventor96/mako-mailer without Composer
On this page you can find all versions of the php package inventor96/mako-mailer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download inventor96/mako-mailer
More information about inventor96/mako-mailer
Files in inventor96/mako-mailer
Package mako-mailer
Short Description A simple emailing package for the PHP Mako framework.
License MIT
Informations about the package mako-mailer
Mako Mailer
A simple emailing package for the PHP Mako framework. It provides an abstraction layer over email sending libraries, allowing for easy swapping of underlying implementations. The default adapter uses PHPMailer (included in this package).
Installation
-
Install the composer package:
-
Enable the package in Mako:
app/config/application.php:This will automatically register the
Mailerclass in the Mako dependency injection container, including the aliasmailer.
Configuration
Create a new file at app/config/packages/mailer/email.php, and add any of the following applicable configuration options:
Usage
Basics
You can use the inventor96\MakoMailer\Mailer or the mailer alias in the Mako dependency injection container. Here's a basic example in the context of a controller method:
Email Templates
You can also use Mako's view templates for email content. Here's an example:
EmailUser
The EmailUser class is a simple value object that represents an email user (i.e., the sender or recipient of an email). It contains the user's email address and name. You can either create an instance of EmailUser directly (as shown above) or use the static fromUser() method to create an instance from an object that implements inventor96\MakoMailer\interfaces\EmailUserInterface:
Reply-To
You can set a default reply-to address in the email config (reply_to_email and reply_to_name). You can also override it per-email by passing an EmailUser as the reply-to:
Attachments
You can attach files to your emails using the inventor96\MakoMailer\Attachment class. Attachments are passed as the last argument to send() or sendTemplate():
The Attachment class supports both file attachments (Attachment::fromPath()) and string data attachments (Attachment::fromData()). It also accepts optional encoding, mime type, and disposition arguments. The Attachment::DISPOSITION_INLINE disposition can be used for embedded images.
All versions of mako-mailer with dependencies
mako/framework Version 10.* || 11.* || 12.*
phpmailer/phpmailer Version ^6.0 || ^7.0