Skip to content

MailSlurp\AliasControllerApi

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

Method HTTP request Description
createAlias() POST /aliases Create an email alias. Must be verified by clicking link inside verification email that will be sent to the address. Once verified the alias will be active.
deleteAlias() DELETE /aliases/{aliasId} Delete an email alias
getAlias() GET /aliases/{aliasId} Get an email alias
getAliasEmails() GET /aliases/{aliasId}/emails Get emails for an alias
getAliasThreads() GET /aliases/{aliasId}/threads Get threads created for an alias
getAliases() GET /aliases Get all email aliases you have created
replyToAliasEmail() PUT /aliases/{aliasId}/emails/{emailId} Reply to an email
sendAliasEmail() POST /aliases/{aliasId}/emails Send an email from an alias inbox
updateAlias() PUT /aliases/{aliasId} Update an email alias

createAlias()

createAlias($create_alias_options): MailSlurpModelsAliasDto

Create an email alias. Must be verified by clicking link inside verification email that will be sent to the address. Once verified the alias will be active.

Email aliases use a MailSlurp randomly generated email address (or a custom domain inbox that you provide) to mask or proxy a real email address. Emails sent to the alias address will be forwarded to the hidden email address it was created for. If you want to send a reply use the threadId attached

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: API_KEY
$config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKey('x-api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer');


$apiInstance = new MailSlurpApiAliasControllerApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`.
    // This is optional, `GuzzleHttpClient` will be used as default.
    new GuzzleHttpClient(),
    $config
);
$create_alias_options = new MailSlurpModelsCreateAliasOptions(); // MailSlurpModelsCreateAliasOptions

try {
    $result = $apiInstance->createAlias($create_alias_options);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AliasControllerApi->createAlias: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
create_alias_options MailSlurpModelsCreateAliasOptions

Return type

MailSlurpModelsAliasDto

Authorization

API_KEY

HTTP request headers

  • Content-Type: application/json
  • Accept: */*

[Back to top] [Back to API list] [Back to Model list] [Back to ]

deleteAlias()

deleteAlias($alias_id)

Delete an email alias

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: API_KEY
$config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKey('x-api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer');


$apiInstance = new MailSlurpApiAliasControllerApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`.
    // This is optional, `GuzzleHttpClient` will be used as default.
    new GuzzleHttpClient(),
    $config
);
$alias_id = 'alias_id_example'; // string

try {
    $apiInstance->deleteAlias($alias_id);
} catch (Exception $e) {
    echo 'Exception when calling AliasControllerApi->deleteAlias: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
alias_id string

Return type

void (empty response body)

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to ]

getAlias()

getAlias($alias_id): MailSlurpModelsAliasDto

Get an email alias

Get an email alias by ID

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: API_KEY
$config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKey('x-api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer');


$apiInstance = new MailSlurpApiAliasControllerApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`.
    // This is optional, `GuzzleHttpClient` will be used as default.
    new GuzzleHttpClient(),
    $config
);
$alias_id = 'alias_id_example'; // string

try {
    $result = $apiInstance->getAlias($alias_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AliasControllerApi->getAlias: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
alias_id string

Return type

MailSlurpModelsAliasDto

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: */*

[Back to top] [Back to API list] [Back to Model list] [Back to ]

getAliasEmails()

getAliasEmails($alias_id, $page, $size, $sort, $since, $before): MailSlurpModelsPageEmailProjection

Get emails for an alias

Get paginated emails for an alias by ID

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: API_KEY
$config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKey('x-api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer');


$apiInstance = new MailSlurpApiAliasControllerApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`.
    // This is optional, `GuzzleHttpClient` will be used as default.
    new GuzzleHttpClient(),
    $config
);
$alias_id = 'alias_id_example'; // string
$page = 0; // int | Optional page  alias email list pagination
$size = 20; // int | Optional page size alias email list pagination
$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC
$since = new DateTime("2013-10-20T19:20:30+01:00"); // DateTime | Optional filter by sent after given date time
$before = new DateTime("2013-10-20T19:20:30+01:00"); // DateTime | Optional filter by sent before given date time

try {
    $result = $apiInstance->getAliasEmails($alias_id, $page, $size, $sort, $since, $before);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AliasControllerApi->getAliasEmails: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
alias_id string
page int Optional page alias email list pagination [optional] [default to 0]
size int Optional page size alias email list pagination [optional] [default to 20]
sort string Optional createdAt sort direction ASC or DESC [optional] [default to 'ASC']
since DateTime Optional filter by sent after given date time [optional]
before DateTime Optional filter by sent before given date time [optional]

Return type

MailSlurpModelsPageEmailProjection

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: */*

[Back to top] [Back to API list] [Back to Model list] [Back to ]

getAliasThreads()

getAliasThreads($alias_id, $page, $size, $sort, $since, $before): MailSlurpModelsPageThreadProjection

Get threads created for an alias

Returns threads created for an email alias in paginated form

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: API_KEY
$config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKey('x-api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer');


$apiInstance = new MailSlurpApiAliasControllerApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`.
    // This is optional, `GuzzleHttpClient` will be used as default.
    new GuzzleHttpClient(),
    $config
);
$alias_id = 'alias_id_example'; // string
$page = 0; // int | Optional page  in thread list pagination
$size = 20; // int | Optional page size in thread list pagination
$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC
$since = new DateTime("2013-10-20T19:20:30+01:00"); // DateTime | Optional filter by sent after given date time
$before = new DateTime("2013-10-20T19:20:30+01:00"); // DateTime | Optional filter by sent before given date time

try {
    $result = $apiInstance->getAliasThreads($alias_id, $page, $size, $sort, $since, $before);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AliasControllerApi->getAliasThreads: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
alias_id string
page int Optional page in thread list pagination [optional] [default to 0]
size int Optional page size in thread list pagination [optional] [default to 20]
sort string Optional createdAt sort direction ASC or DESC [optional] [default to 'ASC']
since DateTime Optional filter by sent after given date time [optional]
before DateTime Optional filter by sent before given date time [optional]

Return type

MailSlurpModelsPageThreadProjection

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: */*

[Back to top] [Back to API list] [Back to Model list] [Back to ]

getAliases()

getAliases($page, $size, $sort, $since, $before): MailSlurpModelsPageAlias

Get all email aliases you have created

Get all email aliases in paginated form

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: API_KEY
$config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKey('x-api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer');


$apiInstance = new MailSlurpApiAliasControllerApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`.
    // This is optional, `GuzzleHttpClient` will be used as default.
    new GuzzleHttpClient(),
    $config
);
$page = 0; // int | Optional page  in alias list pagination
$size = 20; // int | Optional page size in alias list pagination
$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC
$since = new DateTime("2013-10-20T19:20:30+01:00"); // DateTime | Filter by created at after the given timestamp
$before = new DateTime("2013-10-20T19:20:30+01:00"); // DateTime | Filter by created at before the given timestamp

try {
    $result = $apiInstance->getAliases($page, $size, $sort, $since, $before);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AliasControllerApi->getAliases: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
page int Optional page in alias list pagination [optional] [default to 0]
size int Optional page size in alias list pagination [optional] [default to 20]
sort string Optional createdAt sort direction ASC or DESC [optional] [default to 'ASC']
since DateTime Filter by created at after the given timestamp [optional]
before DateTime Filter by created at before the given timestamp [optional]

Return type

MailSlurpModelsPageAlias

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: */*

[Back to top] [Back to API list] [Back to Model list] [Back to ]

replyToAliasEmail()

replyToAliasEmail($alias_id, $email_id, $reply_to_alias_email_options): MailSlurpModelsSentEmailDto

Reply to an email

Send the reply to the email sender or reply-to and include same subject cc bcc etc. Reply to an email and the contents will be sent with the existing subject to the emails to, cc, and bcc.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: API_KEY
$config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKey('x-api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer');


$apiInstance = new MailSlurpApiAliasControllerApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`.
    // This is optional, `GuzzleHttpClient` will be used as default.
    new GuzzleHttpClient(),
    $config
);
$alias_id = 'alias_id_example'; // string | ID of the alias that email belongs to
$email_id = 'email_id_example'; // string | ID of the email that should be replied to
$reply_to_alias_email_options = new MailSlurpModelsReplyToAliasEmailOptions(); // MailSlurpModelsReplyToAliasEmailOptions

try {
    $result = $apiInstance->replyToAliasEmail($alias_id, $email_id, $reply_to_alias_email_options);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AliasControllerApi->replyToAliasEmail: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
alias_id string ID of the alias that email belongs to
email_id string ID of the email that should be replied to
reply_to_alias_email_options MailSlurpModelsReplyToAliasEmailOptions

Return type

MailSlurpModelsSentEmailDto

Authorization

API_KEY

HTTP request headers

  • Content-Type: application/json
  • Accept: */*

[Back to top] [Back to API list] [Back to Model list] [Back to ]

sendAliasEmail()

sendAliasEmail($alias_id, $send_email_options): MailSlurpModelsSentEmailDto

Send an email from an alias inbox

Send an email from an alias. Replies to the email will be forwarded to the alias masked email address

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: API_KEY
$config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKey('x-api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer');


$apiInstance = new MailSlurpApiAliasControllerApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`.
    // This is optional, `GuzzleHttpClient` will be used as default.
    new GuzzleHttpClient(),
    $config
);
$alias_id = 'alias_id_example'; // string
$send_email_options = new MailSlurpModelsSendEmailOptions(); // MailSlurpModelsSendEmailOptions

try {
    $result = $apiInstance->sendAliasEmail($alias_id, $send_email_options);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AliasControllerApi->sendAliasEmail: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
alias_id string
send_email_options MailSlurpModelsSendEmailOptions

Return type

MailSlurpModelsSentEmailDto

Authorization

API_KEY

HTTP request headers

  • Content-Type: application/json
  • Accept: */*

[Back to top] [Back to API list] [Back to Model list] [Back to ]

updateAlias()

updateAlias($alias_id, $update_alias_options): MailSlurpModelsAliasDto

Update an email alias

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: API_KEY
$config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKey('x-api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = MailSlurpConfiguration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer');


$apiInstance = new MailSlurpApiAliasControllerApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`.
    // This is optional, `GuzzleHttpClient` will be used as default.
    new GuzzleHttpClient(),
    $config
);
$alias_id = 'alias_id_example'; // string
$update_alias_options = new MailSlurpModelsUpdateAliasOptions(); // MailSlurpModelsUpdateAliasOptions

try {
    $result = $apiInstance->updateAlias($alias_id, $update_alias_options);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AliasControllerApi->updateAlias: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
alias_id string
update_alias_options MailSlurpModelsUpdateAliasOptions

Return type

MailSlurpModelsAliasDto

Authorization

API_KEY

HTTP request headers

  • Content-Type: application/json
  • Accept: */*

[Back to top] [Back to API list] [Back to Model list] [Back to ]