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

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.

Code samples

Language
Example
public function test_canCreateInboxes(): void
{
    $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKey('x-api-key', 'YOUR_API_KEY');

    // create an inbox controller with config
    $inboxController = new MailSlurp\Apis\InboxControllerApi(null, $config);

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

    // assert on properties
    $this->assertNotNull($inbox->getId());
    $this->assertStringContainsString("@mailslurp.com", $inbox->getEmailAddress());
}

Get started