PHPackages                             ericmartel/codeception-email-mailcatcher - 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. ericmartel/codeception-email-mailcatcher

ActiveLibrary

ericmartel/codeception-email-mailcatcher
========================================

Provides test helpers for Codeception when testing email functionality with MailCatcher

1.0.3(10y ago)23.3k1MITPHP

Since Jan 7Pushed 10y ago1 watchersCompare

[ Source](https://github.com/ericmartel/codeception-email-mailcatcher)[ Packagist](https://packagist.org/packages/ericmartel/codeception-email-mailcatcher)[ RSS](/packages/ericmartel-codeception-email-mailcatcher/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (3)DependenciesVersions (4)Used By (0)

MailCatcher Service Provider for the Codeception Email Testing Framework
========================================================================

[](#mailcatcher-service-provider-for-the-codeception-email-testing-framework)

This Codeception Module implements the required methods to test emails using the [Codeception Email Testing Framework](https://github.com/ericmartel/codeception-email) with [MailCatcher](http://mailcatcher.me)

### Installation

[](#installation)

Through composer, require the package:

```
"require-dev": {
        "ericmartel/codeception-email-mailcatcher": "^1.0"
    }

```

Then turn it on in your Codeception suite yaml file

```
class_name: FunctionalTester
modules:
    enabled:
        - MailCatcher
    config:
        MailCatcher:
            url: 'http://127.0.0.1'
            port: '1080'

```

Additional parameters can be fed directly to the Guzzle connection using the `guzzleRequestOptions` variable.

The variable `deleteEmailsAfterScenario` can be set to true to ensure that all emails are deleted at the end of each scenario, but it is turned off by default.

### Added Methods

[](#added-methods)

This Module adds a few public methods for the user, such as:

```
deleteAllEmails()

```

Deletes all emails in MailCatcher

```
fetchEmails()

```

Fetches all email headers from MailCatcher, sorts them by timestamp and assigns them to the current and unread inboxes

```
accessInboxFor($address)

```

Filters emails to only keep those that are received by the provided address

```
openNextUnreadEmail()

```

Pops the most recent unread email and assigns it as the email to conduct tests on

### Example Test

[](#example-test)

Here is a simple scenario where we test the content of an email. For a detailed list of all available test methods, please refer to the [Codeception Email Testing Framework](https://github.com/ericmartel/codeception-email).

```
