Mailer

Configuration & usage

Mailer wrapper over PHPMailer for Phalcon

Configurations

You can choose between 3 mailer driver: mail, sendmail and smtp.

# using provider
MAILER_DRIVER=mail

# using sendmail
MAILER_DRIVER=sendmail

# using smtp
MAILER_DRIVER=smtp

Then you can configure the mailer component according to your needs, set your email, name, charset, views directory, base URI etc.

# From Email
MAILER_FROM_EMAIL=zemit@localhost

# Your Name
MAILER_FROM_NAME=Zemit

# Default Charset
MAILER_CHARSET=utf-8

# Default views directory
MAILER_VIEWS_DIR=<app_path>/Modules/Frontend/Views/

# Default base URI
MAILER_BASE_URI=

# Comma seperated list of email to add as TO
MAILER_TO_EMAIL=

# Comma seperated list of email to add as CC
MAILER_CC_EMAIL=

# Comma seperated list of email to add as BCC
MAILER_BCC_EMAIL=

Advanced Settings: Some settings are only available when you use a specific mailer driver. Below you can find the advanced settings for each driver.

# Mailer Settings of the `mail` driver
MAILER_DRIVER=mail

Usage

// if the class is aware of injections
$mailer = $this->mailer;

// if the container is present
$mailer = $this->di->get('mailer');

// to access the shared db service
$mailer = Di::getDefault()->get('mailer');

Sources

Last updated