PHPackages                             taitava/swiftmailer-imapsentfolder - 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. taitava/swiftmailer-imapsentfolder

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

taitava/swiftmailer-imapsentfolder
==================================

A SwiftMailer plugin that stores a copy of all sent messages to a folder on an IMAP email server.

1.0.2(7y ago)0191MITPHP

Since Apr 1Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Taitava/swiftmail-imapsentfolder)[ Packagist](https://packagist.org/packages/taitava/swiftmailer-imapsentfolder)[ RSS](/packages/taitava-swiftmailer-imapsentfolder/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (1)Versions (4)Used By (1)

swiftmailer-imapsentfolder
==========================

[](#swiftmailer-imapsentfolder)

This is a plugin for [SwiftMailer](https://github.com/swiftmailer/swiftmailer) that stores all\* sent email messages to an IMAP server (or servers).

\*) Optionally you can use a callback function to create a custom filter that can prevent saving messages if needed.

**This feature only works with IMAP servers, any other protocols are not supported!** It does not matter, which protocol was originally used to send the message.

Requirements
------------

[](#requirements)

- SwiftMailer 5 or 6
- PHP imap extension

Installation
------------

[](#installation)

`composer require taitava/swiftmailer-imapsentfolder`

Usage
-----

[](#usage)

```
use \Taitava\ImapSentFolder\ImapSentFolderPlugin;
$mailer = Swift_Mailer::newInstance();

// Define mailboxes like this:
$mailboxes = [
     'email.address@somedomain.tld' => [
             'host' => 'imap.somedomain.tld',
             'port' => 993,
             'username' => 'email.address',
             'password' => 'verysecretdonotsharepubliclyintheinternet',
        'sent_folder' => 'Sent',
     ],
     'default' => [
             'host' => 'imap.somedomain.tld',
             'port' => 993,
             'username' => 'other.account',
             'password' => 'verysecretdonotsharepubliclyintheinternet',
        'sent_folder' => 'Sent',
     ],
];

$plugin = new ImapSentFolderPlugin($mailboxes);

$mailer->registerPlugin($plugin);
```

The plugin will automatically pick the correct mailbox by inspecting the 'From' field from the email message that was sent. If the email address is not found from the `$mailboxes` array, the plugin will use the mailbox defined with the key 'default'. You should **always define a default mailbox** if its possible that mail is sent from unforeseen email addresses!

Control what gets saved and what not
------------------------------------

[](#control-what-gets-saved-and-what-not)

You can define a custom callback function that will be called right before saving a sent email message.

```
use \Taitava\ImapSentFolder\ImapSentFolderPlugin;
$plugin = new ImapSentFolderPlugin($mailboxes);

$plugin->setCallBeforeSaving(function (Swift_Mime_Message $email_message){
        // ... Inspect the $email_message instance ...

        // ... Decide not to save this message ...
        return false;

        // ... Decide to accept saving the message ...
        return true;

        // ... If you do not write a 'return' statement or if you return null, saving is also accepted ...
        return;
});
```

Future
------

[](#future)

Ideas (and pull requests) are welcome :). No big plans at the moment, I'm considering this plugin quite complete. But will try to fix issues if any arise.

Author
------

[](#author)

Oh, it's just me. Too lazy to write my name. :)

License
-------

[](#license)

MIT

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

 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

Every ~5 days

Total

3

Last Release

2585d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/611d4d836f6db7ba7357ea174bf48ab8cf86af5ac40be4a7a6101e67267333f9?d=identicon)[taitava](/maintainers/taitava)

---

Top Contributors

[![Taitava](https://avatars.githubusercontent.com/u/13002142?v=4)](https://github.com/Taitava "Taitava (3 commits)")

---

Tags

emailimapsent

### Embed Badge

![Health badge](/badges/taitava-swiftmailer-imapsentfolder/health.svg)

```
[![Health](https://phpackages.com/badges/taitava-swiftmailer-imapsentfolder/health.svg)](https://phpackages.com/packages/taitava-swiftmailer-imapsentfolder)
```

###  Alternatives

[ddeboer/imap

Object-oriented IMAP for PHP

9153.9M11](/packages/ddeboer-imap)[tedivm/fetch

A PHP IMAP Library

5061.2M8](/packages/tedivm-fetch)[henrique-borba/php-sieve-manager

A modern (started in 2022) PHP library for the ManageSieve protocol (RFC5804) to create/edit Sieve scripts (RFC5228). Used by Cypht Webmail.

23125.7k2](/packages/henrique-borba-php-sieve-manager)[benhall14/php-imap-reader

A PHP class that makes working with IMAP in PHP simple.

3516.6k](/packages/benhall14-php-imap-reader)[tedivm/dovecottesting

An IMAP Testing Suite

312.2k7](/packages/tedivm-dovecottesting)

PHPackages © 2026

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