# MailSlurpClient

Available on Packagist as mailslurp-client-php (opens new window)

MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more.

# Resources

This PHP package is automatically generated by the OpenAPI Generator (opens new window) project:

  • API version: 67c9a1eda264be4cfe0bb2c76151f0aadf0862bc
  • Package version: 7.0.7
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen

# Requirements

PHP 5.5 and later

# Installation & Usage

# Composer

To install the bindings via Composer (opens new window), add the following to composer.json:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/mailslurp/mailslurp-client-php.git"
    }
  ],
  "require": {
    "mailslurp/mailslurp-client-php": "*@dev"
  }
}

Then run composer install

# Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/MailSlurpClient/vendor/autoload.php');

# Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

# Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: API_KEY
$config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKey('x-api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = MailSlurp\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer');
$apiInstance = new MailSlurp\Api\AttachmentControllerApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$upload_options = new \MailSlurp\Models\UploadAttachmentOptions(); // \MailSlurp\Models\UploadAttachmentOptions | uploadOptions
try {
    $result = $apiInstance->uploadAttachment($upload_options);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AttachmentControllerApi->uploadAttachment: ', $e->getMessage(), PHP_EOL;
}
?>

# Documentation for API Endpoints

All URIs are relative to https://api.mailslurp.com

Class Method HTTP request Description
AttachmentControllerApi uploadAttachment POST /attachments Upload an attachment for sending
AttachmentControllerApi uploadMultipartForm POST /attachments/multipart Upload an attachment for sending using Multipart Form
BulkActionsControllerApi bulkCreateInboxes POST /bulk/inboxes Bulk create Inboxes (email addresses)
BulkActionsControllerApi bulkDeleteInboxes DELETE /bulk/inboxes Bulk Delete Inboxes
BulkActionsControllerApi bulkSendEmails POST /bulk/send Bulk Send Emails
CommonActionsControllerApi createNewEmailAddress POST /newEmailAddress Create new random inbox
CommonActionsControllerApi emptyInbox DELETE /emptyInbox Delete all emails in an inbox
CommonActionsControllerApi sendEmailSimple POST /sendEmail Send an email from a random email address
ContactControllerApi createContact POST /contacts Create a contact
ContactControllerApi deleteContact DELETE /contacts/{contactId} Delete contact
ContactControllerApi getAllContacts GET /contacts/paginated Get all contacts
ContactControllerApi getContact GET /contacts/{contactId} Get contact
ContactControllerApi getContacts GET /contacts Get all contacts
DomainControllerApi createDomain POST /domains Create Domain
DomainControllerApi deleteDomain DELETE /domains/{id} Delete a domain
DomainControllerApi getDomain GET /domains/{id} Get a domain
DomainControllerApi getDomains GET /domains Get domains
EmailControllerApi deleteAllEmails DELETE /emails Delete all emails
EmailControllerApi deleteEmail DELETE /emails/{emailId} Delete an email
EmailControllerApi downloadAttachment GET /emails/{emailId}/attachments/{attachmentId} Get email attachment bytes
EmailControllerApi forwardEmail POST /emails/{emailId}/forward Forward email
EmailControllerApi getAttachmentMetaData GET /emails/{emailId}/attachments/{attachmentId}/metadata Get email attachment metadata
EmailControllerApi getAttachments GET /emails/{emailId}/attachments Get all email attachment metadata
EmailControllerApi getEmail GET /emails/{emailId} Get email content
EmailControllerApi getEmailHTML GET /emails/{emailId}/html Get email content as HTML
EmailControllerApi getEmailsPaginated GET /emails Get all emails
EmailControllerApi getRawEmailContents GET /emails/{emailId}/raw Get raw email string
EmailControllerApi getRawEmailJson GET /emails/{emailId}/raw/json Get raw email in JSON
EmailControllerApi getUnreadEmailCount GET /emails/unreadCount Get unread email count
EmailControllerApi validateEmail POST /emails/{emailId}/validate Validate email
GroupControllerApi addContactsToGroup PUT /groups/{groupId}/contacts Add contacts to a group
GroupControllerApi createGroup POST /groups Create a group
GroupControllerApi deleteGroup DELETE /groups/{groupId} Delete group
GroupControllerApi getAllGroups GET /groups/paginated Get all Contact Groups in paginated format
GroupControllerApi getGroup GET /groups/{groupId} Get group
GroupControllerApi getGroupWithContacts GET /groups/{groupId}/contacts Get group and contacts belonging to it
GroupControllerApi getGroups GET /groups Get all groups
GroupControllerApi removeContactsFromGroup DELETE /groups/{groupId}/contacts Remove contacts from a group
InboxControllerApi createInbox POST /inboxes Create an Inbox (email address)
InboxControllerApi deleteAllInboxes DELETE /inboxes Delete all inboxes
InboxControllerApi deleteInbox DELETE /inboxes/{inboxId} Delete inbox
InboxControllerApi getAllInboxes GET /inboxes/paginated List Inboxes Paginated
InboxControllerApi getEmails GET /inboxes/{inboxId}/emails Get emails in an Inbox
InboxControllerApi getInbox GET /inboxes/{inboxId} Get Inbox
InboxControllerApi getInboxEmailsPaginated GET /inboxes/{inboxId}/emails/paginated Get inbox emails paginated
InboxControllerApi getInboxes GET /inboxes List Inboxes / Email Addresses
InboxControllerApi sendEmail POST /inboxes/{inboxId} Send Email
InboxControllerApi setInboxFavourited PUT /inboxes/{inboxId}/favourite Set inbox favourited state
InboxControllerApi updateInbox PATCH /inboxes/{inboxId} Update Inbox
TemplateControllerApi createTemplate POST /templates Create a Template
TemplateControllerApi deleteTemplate DELETE /templates/{TemplateId} Delete Template
TemplateControllerApi getAllTemplates GET /templates/paginated Get all Templates in paginated format
TemplateControllerApi getTemplate GET /templates/{TemplateId} Get Template
TemplateControllerApi getTemplates GET /templates Get all Templates
WaitForControllerApi waitFor POST /waitFor Wait for conditions to be met
WaitForControllerApi waitForEmailCount GET /waitForEmailCount Wait for and return count number of emails
WaitForControllerApi waitForLatestEmail GET /waitForLatestEmail Fetch inbox's latest email or if empty wait for an email to arrive
WaitForControllerApi waitForMatchingEmail POST /waitForMatchingEmails Wait or return list of emails that match simple matching patterns
WaitForControllerApi waitForNthEmail GET /waitForNthEmail Wait for or fetch the email with a given index in the inbox specified
WebhookControllerApi createWebhook POST /inboxes/{inboxId}/webhooks Attach a WebHook URL to an inbox
WebhookControllerApi deleteWebhook DELETE /inboxes/{inboxId}/webhooks/{webhookId} Delete and disable a Webhook for an Inbox
WebhookControllerApi getAllWebhooks GET /webhooks/paginated List Webhooks Paginated
WebhookControllerApi getWebhook GET /webhooks/{webhookId} Get a webhook for an Inbox
WebhookControllerApi getWebhooks GET /inboxes/{inboxId}/webhooks Get all Webhooks for an Inbox
WebhookControllerApi sendTestData POST /webhooks/{webhookId}/test Send webhook test data

# Documentation For Models

# Documentation For Authorization

# API_KEY

  • Type: API key
  • API key parameter name: x-api-key
  • Location: HTTP header

# Author