PHPackages                             ikirux/yii-swift-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. ikirux/yii-swift-mailer

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

ikirux/yii-swift-mailer
=======================

Wrapper of Swiftmailer for Yii framework version 1.x

322.0k[1 issues](https://github.com/ikirux/Yii-SwiftMailer/issues)PHP

Since May 18Pushed 11y ago2 watchersCompare

[ Source](https://github.com/ikirux/Yii-SwiftMailer)[ Packagist](https://packagist.org/packages/ikirux/yii-swift-mailer)[ RSS](/packages/ikirux-yii-swift-mailer/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Yii-SwiftMailer
===============

[](#yii-swiftmailer)

Wrapper of Swiftmailer for Yii framework version 1.x

Current swiftmailer version supported 5.1.0

It supports these features:

1. smtp, sendmail or mail transport
2. ssl or tls security
3. setTo, CC, BCC
4. Attachment of dynamic (generate at runtime) and static files
5. Embed files (statics and dynamic)
6. Swiftmailer's plugin (AntiFlood, Throtter, Logger)

You can review the official documentation at

Installation
============

[](#installation)

Using Composer:

Simply add a dependency on "ikirux/yii-swift-mailer" to your project's composer.json file if you use Composer to manage the dependencies of your project. Here is a minimal example of a composer.json

```
{
    "require": {
        "ikirux/yii-swift-mailer": "dev-master"
    }
}

```

for more information visits

Using Git:

Just clone the project inside your extension directory

```
git clone git@github.com:ikirux/Yii-SwiftMailer.git`

```

Configuration:

Set up yii component via config:

```
'mailer' => [
	'class' => 'path.to.swiftMailer.SwiftMailer',

	// Using SMTP:
	'mailer' => 'smtp',
	// 'ssl' for "SSL/TLS" or 'tls' for 'STARTTLS'
	'security' => 'ssl',
	'host' => 'localhost',
	'from' => 'admin@localhost',
	'username' => 'smptusername',
	'password' => '123456',

	// Activate the Logger plugin
	// more information http://swiftmailer.org/docs/plugins.html#using-the-logger-plugin
	//'activateLoggerPlugin' => true,

	// Activate the AntiFlood plugin
	// more information http://swiftmailer.org/docs/plugins.html#antiflood-plugin
	//'activateAntiFloodPlugin' => true,
	//'setFloodPluginParams' => ['threshold' => 100, 'sleep' => 30],

	// Activate the Throtter plugin
	// more information http://swiftmailer.org/docs/plugins.html#throttler-plugin
	// Modes support 1 => SwiftMailer::BYTES_PER_MINUTE,
	//               2 => SwiftMailer::MESSAGES_PER_SECOND
	//               3 => SwiftMailer::MESSAGES_PER_MINUTE
	//'activateThrotterPlugin' => true,
	//'setThrotterPluginParams' => ['rate' => 10, 'mode' => 3],
],

```

Usage
=====

[](#usage)

Creating a Message

```
Yii::app()->mailer->setSubject('A great subject')
	->addAddress('mail@domain.com')
	->setBody('Nice HTML message')
	->setAltBody('Message plain text alternative')
	->send();

```

Creating a Message With Several Recipients

```
Yii::app()->mailer->setSubject('A great subject')
	->addAddress(['mail@domain.com', 'mail2@domain.com'])
	->addCcAddress('mail3@domain.com')
	->addBccAddress(['mail4@domain.com', 'mail5@domain.com'])
	->setBody('Nice HTML message')
	->setAltBody('Message plain text alternative')
	->send();

```

Attaching Files

```
Yii::app()->mailer->setSubject('A great subject')
	->addAddress('mail@domain.com')
	->setBody('Nice HTML message')
	->setAltBody('Message plain text alternative')
	->addAttachment('/path/to/file.pdf', 'application/pdf', 'Nickname File.pdf')
	->addAttachment('/path/to/file.jpg')
	->send();

```

Attaching Dynamic Files

```
// Create your file contents in the normal way, but don't write them to disk
$data = create_my_pdf_data();

Yii::app()->mailer->setSubject('A great subject')
	->addAddress('mail@domain.com')
	->setBody('Nice HTML message')
	->setAltBody('Message plain text alternative')
	->addDinamicAttachment($data, 'application/pdf', 'FileName.pdf')
	->send();

```

Embedding Existing Files

```
Yii::app()->mailer->setSubject('A great subject')
	->addAddress('mail@domain.com')
	->setBody(
	'' .
	' ' .
	' ' .
	'  Here is an image {{image}}' .
	'  Rest of message' .
	' ' .
	'')
	->setAltBody('Message plain text alternative')
	->embedFile('{{image}}', '/path/to/file.jpg')
	->send();

```

Embedding Dynamic Files

```
// Create your file contents in the normal way, but don't write them to disk
$img_data = create_my_image_data();

Yii::app()->mailer->setSubject('A great subject')
	->addAddress('mail@domain.com')
	->setBody(
	'' .
	' ' .
	' ' .
	'  Here is an image {{image}}' .
	'  Rest of message' .
	' ' .
	'')
	->setAltBody('Message plain text alternative')
	->embedDinamicFile('{{image}}', $img_data, 'image/jpeg', 'image.jpg')
	->send();

```

Your feedback is very welcome!

Have Fun!

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82.4% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/962353?v=4)[Carlos Pinto](/maintainers/ikirux)[@ikirux](https://github.com/ikirux)

---

Top Contributors

[![ikirux](https://avatars.githubusercontent.com/u/962353?v=4)](https://github.com/ikirux "ikirux (14 commits)")[![PatchRanger](https://avatars.githubusercontent.com/u/3889569?v=4)](https://github.com/PatchRanger "PatchRanger (3 commits)")

### Embed Badge

![Health badge](/badges/ikirux-yii-swift-mailer/health.svg)

```
[![Health](https://phpackages.com/badges/ikirux-yii-swift-mailer/health.svg)](https://phpackages.com/packages/ikirux-yii-swift-mailer)
```

###  Alternatives

[maize-tech/laravel-email-domain-rule

Laravel Email Domain Rule

612.0k](/packages/maize-tech-laravel-email-domain-rule)

PHPackages © 2026

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