PHPackages                             alvlapo/phalcon-mailer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. alvlapo/phalcon-mailer

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

alvlapo/phalcon-mailer
======================

Mailer wrapper over SwiftMailer and View component for Phalcon framework

1.0.0(7y ago)217MITPHPPHP &gt;=7.0

Since Oct 1Pushed 7y ago1 watchersCompare

[ Source](https://github.com/alvlapo/phalcon-mailer)[ Packagist](https://packagist.org/packages/alvlapo/phalcon-mailer)[ RSS](/packages/alvlapo-phalcon-mailer/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

phalcon-mailer
==============

[](#phalcon-mailer)

Mailer wrapper over [SwiftMailer](https://swiftmailer.symfony.com/) for [Phalcon framework](https://phalconphp.com/).

Usage
-----

[](#usage)

### Configuration

[](#configuration)

There are [several types of Transport](https://swiftmailer.symfony.com/docs/sending.html#transport-types) in Swift Mailer, you create a Transport, use it to create the Manager, then you use the Manager to send the mail.

```
$transport = new \Swift_SendmailTransport();
$view = \Phalcon\Di::getDefault()->getShared('view');

$mailer = new \Rotoscoping\Phalcon\Manager($transport, $view);

// Add mailer to container (optional)
\Phalcon\Di::getDefault()->setShared('mailer', $mailer);
```

### Sending the Email

[](#sending-the-email)

```
// Get mailer from DI
$mailer = \Phalcon\Di::getDefault()->get('mailer');

// Compose mail
$mailer
  ->to('test@test.com')
  ->subject('Simple subject')
  ->text('Simple text part message')
  ->send();

// Fin
```

### Configuring The Sender

[](#configuring-the-sender)

There are two ways to configure the sender.

First, you may use the **from** method within your Mail class' build method:

```
// You must initialize and add Manager instance to DI as 'mailer' service (see above)
// or extend Mail class and owerride method getMailerInstance()

$mail = new Mail();
$mail
  ->from('support@example.com', 'Support team')
  ->to('test@test.com')
  ->subject('Simple subject')
  ->text('Simple text part message');

$mail->send();
```

Instead, you may specify a global "from" address throw draft mail in your Manager instance. This address will be used by default for all you mails:

```
$defaultMail = new Mail();
$defaultMail
  ->from('support@example.com', 'Support team');

// Get mailer from DI (see initializatio section)
$mailer = \Phalcon\Di::getDefault()->get('mailer');

$mailer->setDraftMail($defaultMail);

$mail = new Mail();
$mail
  ->to('test@test.com')
  ->subject('Simple subject')
  ->text('Simple text part message');

$mail->send();
```

Example
-------

[](#example)

### Sending a message from the template

[](#sending-a-message-from-the-template)

```
// Initialize manager with mail and view services from DI
$mailer = new \Rotoscoping\Phalcon\Manager('mail', 'view');

// template email_confirmation.phtml in your viewDir
$mailer->send(
  // view path
  'email_confirmation',
  // Swift params
  [
    'subject' => 'Example email confirmation',
    'from' => 'no-reply@example.com',
    'to' => 'user@mail.com'
  ],
  // View params
  [
    'username' => 'User Name',
    'token' => 'aq1sw2de3'
  ]
);
```

### Sending a message from the template via a magic method call

[](#sending-a-message-from-the-template-via-a-magic-method-call)

```
// word of the send from the beginning and the template filename in camelCase notation
$mailer->sendEmailConfirmation(
  [
    'subject' => 'Example email confirmation',
    'from' => 'no-reply@example.com',
    'to' => 'user@mail.com'
  ],
  [
    'username' => 'User Name',
    'token' => 'aq1sw2de3'
  ]
);
```

Sending with a Mailable
-----------------------

[](#sending-with-a-mailable)

Using mailable classes are a lot more elegant than the basic usage example above. Building up the mail in a mailable class cleans up controllers and routes, making things look a more tidy and less cluttered as well as making things so much more manageable.

All of a mailable class' configuration is done in the **compose** method. Within this method, you may call various methods such as **from**, **subject**, **view**, and **attach** to configure the email's presentation and delivery.

Mailable classes are required to extend the base Rotoscoping\\Phalcon\\Mailer\\Mailable class;

Inspired by
-----------

[](#inspired-by)

- [mailer-library](https://github.com/2amigos/mailer-library)
- [slim3-mailer](https://github.com/andrewdyer/slim3-mailer)
- [mailer-library](https://github.com/2amigos/mailer-library)

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2828d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/551744?v=4)[Alexander Polyakov](/maintainers/alvlapo)[@alvlapo](https://github.com/alvlapo)

---

Top Contributors

[![alvlapo](https://avatars.githubusercontent.com/u/551744?v=4)](https://github.com/alvlapo "alvlapo (9 commits)")

---

Tags

mailerphalconphalcon-frameworkphalconphpswiftmailer

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/alvlapo-phalcon-mailer/health.svg)

```
[![Health](https://phpackages.com/badges/alvlapo-phalcon-mailer/health.svg)](https://phpackages.com/packages/alvlapo-phalcon-mailer)
```

###  Alternatives

[cspoo/swiftmailer-mailgun-bundle

Swiftmailer Mailgun bundle

1041.1M](/packages/cspoo-swiftmailer-mailgun-bundle)[wildbit/swiftmailer-postmark

A Swiftmailer Transport for Postmark.

542.8M6](/packages/wildbit-swiftmailer-postmark)[openbuildings/swiftmailer-css-inliner

Inline the css of your html emails

66404.2k3](/packages/openbuildings-swiftmailer-css-inliner)[mailjet/mailjet-swiftmailer

A SwiftMailer transport implementation for Mailjet

251.3M9](/packages/mailjet-mailjet-swiftmailer)[phalcon-ext/mailer

Mailer component as wrapper over SwiftMailer for Phalcon.

39199.8k2](/packages/phalcon-ext-mailer)[neos/swiftmailer

A Flow package for easy use of Swift Mailer

14887.2k22](/packages/neos-swiftmailer)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
