Send and receive email in PHP (without using mail functions)

PHP email API for creating inboxes, sending email, and receiving attachments in code and tests.

Use MailSlurp's free PHP email API to send and receive real emails in code and tests. Install with composer or download and vendor the library. Compatible with Laravel, Symfony, Wordpress and more. Create test email accounts, listen for inbound emails, process attachments and more in PHP.

Installing MailSlurp in PHP

If you use the composer package manager you can run

composer require mailslurp/mailslurp-client-php

Or add it to your composer.json file:

  "repositories": [
      "type": "vcs",
      "url": ""
  "require": {
    "mailslurp/mailslurp-client-php": "*@dev"

Basic usage (creating an email address)

To create a new email address use the inbox controller:

public function test_canCreateInboxes(): void
    // create an inbox controller with config
    $inboxController = new MailSlurpApisInboxControllerApi(null, $this->config);

    // create inbox
    $inbox = $inboxController->createInbox();

    // assert on properties
    $this->assertStringContainsString("", $inbox->getEmailAddress());

Get started

To take the next step sign up for a free account and read the documentation: