MailSlurp\AttachmentControllerApi
All URIs are relative to https://php.api.mailslurp.com, except if the operation defines another base path.
Method | HTTP request | Description |
---|---|---|
deleteAllAttachments() | DELETE /attachments | Delete all attachments |
deleteAttachment() | DELETE /attachments/{attachmentId} | Delete an attachment |
downloadAttachmentAsBase64Encoded() | GET /attachments/{attachmentId}/base64 | Get email attachment as base64 encoded string as alternative to binary responses. To read the content decode the Base64 encoded contents. |
downloadAttachmentAsBytes() | GET /attachments/{attachmentId}/bytes | Download attachments. Get email attachment bytes. If you have trouble with byte responses try the downloadAttachmentBase64 response endpoints. |
getAttachment() | GET /attachments/{attachmentId} | Get an attachment entity |
getAttachmentInfo() | GET /attachments/{attachmentId}/metadata | Get email attachment metadata information |
getAttachments() | GET /attachments | Get email attachments |
uploadAttachment() | POST /attachments | Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment. |
uploadAttachmentBytes() | POST /attachments/bytes | Upload an attachment for sending using file byte stream input octet stream. Returns an array whose first element is the ID of the uploaded attachment. |
uploadMultipartForm() | POST /attachments/multipart | Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment. |
deleteAllAttachments()
Delete all attachments
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 MailSlurpApiAttachmentControllerApi(
// 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
);
try {
$apiInstance->deleteAllAttachments();
} catch (Exception $e) {
echo 'Exception when calling AttachmentControllerApi->deleteAllAttachments: ', $e->getMessage(), PHP_EOL;
}
Parameters
This endpoint does not need any parameter.
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to ]
deleteAttachment()
Delete an attachment
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 MailSlurpApiAttachmentControllerApi(
// 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
);
$attachment_id = 'attachment_id_example'; // string | ID of attachment
try {
$apiInstance->deleteAttachment($attachment_id);
} catch (Exception $e) {
echo 'Exception when calling AttachmentControllerApi->deleteAttachment: ', $e->getMessage(), PHP_EOL;
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
attachment_id | string | ID of attachment |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to ]
downloadAttachmentAsBase64Encoded()
Get email attachment as base64 encoded string as alternative to binary responses. To read the content decode the Base64 encoded contents.
Returns the specified attachment for a given email as a base 64 encoded string. The response type is application/json. This method is similar to the downloadAttachment
method but allows some clients to get around issues with binary responses.
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 MailSlurpApiAttachmentControllerApi(
// 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
);
$attachment_id = 'attachment_id_example'; // string | ID of attachment
try {
$result = $apiInstance->downloadAttachmentAsBase64Encoded($attachment_id);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AttachmentControllerApi->downloadAttachmentAsBase64Encoded: ', $e->getMessage(), PHP_EOL;
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
attachment_id | string | ID of attachment |
Return type
MailSlurpModelsDownloadAttachmentDto
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept:
*/*
[Back to top] [Back to API list] [Back to Model list] [Back to ]
downloadAttachmentAsBytes()
Download attachments. Get email attachment bytes. If you have trouble with byte responses try the downloadAttachmentBase64
response endpoints.
Returns the specified attachment for a given email as a stream / array of bytes. You can find attachment ids in email responses endpoint responses. The response type is application/octet-stream.
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 MailSlurpApiAttachmentControllerApi(
// 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
);
$attachment_id = 'attachment_id_example'; // string | ID of attachment
try {
$result = $apiInstance->downloadAttachmentAsBytes($attachment_id);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AttachmentControllerApi->downloadAttachmentAsBytes: ', $e->getMessage(), PHP_EOL;
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
attachment_id | string | ID of attachment |
Return type
string
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept:
application/octet-stream
[Back to top] [Back to API list] [Back to Model list] [Back to ]
getAttachment()
Get an attachment entity
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 MailSlurpApiAttachmentControllerApi(
// 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
);
$attachment_id = 'attachment_id_example'; // string | ID of attachment
try {
$result = $apiInstance->getAttachment($attachment_id);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AttachmentControllerApi->getAttachment: ', $e->getMessage(), PHP_EOL;
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
attachment_id | string | ID of attachment |
Return type
MailSlurpModelsAttachmentEntity
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept:
*/*
[Back to top] [Back to API list] [Back to Model list] [Back to ]
getAttachmentInfo()
Get email attachment metadata information
Returns the metadata for an attachment. It is saved separately to the content of the attachment. Contains properties name
and content-type
and content-length
in bytes for a given attachment.
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 MailSlurpApiAttachmentControllerApi(
// 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
);
$attachment_id = 'attachment_id_example'; // string | ID of attachment
try {
$result = $apiInstance->getAttachmentInfo($attachment_id);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AttachmentControllerApi->getAttachmentInfo: ', $e->getMessage(), PHP_EOL;
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
attachment_id | string | ID of attachment |
Return type
MailSlurpModelsAttachmentMetaData
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept:
*/*
[Back to top] [Back to API list] [Back to Model list] [Back to ]
getAttachments()
getAttachments($page, $size, $sort, $file_name_filter, $since, $before): MailSlurpModelsPageAttachmentEntity
Get email attachments
Get all attachments in paginated response. Each entity contains meta data for the attachment such as name
and content-type
. Use the attachmentId
and the download endpoints to get the file contents.
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 MailSlurpApiAttachmentControllerApi(
// 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 for list pagination
$size = 20; // int | Optional page size for list pagination
$sort = 'ASC'; // string | Optional createdAt sort direction ASC or DESC
$file_name_filter = 'file_name_filter_example'; // string | Optional file name and content type search filter
$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->getAttachments($page, $size, $sort, $file_name_filter, $since, $before);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AttachmentControllerApi->getAttachments: ', $e->getMessage(), PHP_EOL;
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
page | int | Optional page for list pagination | [optional] [default to 0] |
size | int | Optional page size for list pagination | [optional] [default to 20] |
sort | string | Optional createdAt sort direction ASC or DESC | [optional] [default to 'ASC'] |
file_name_filter | string | Optional file name and content type search filter | [optional] |
since | DateTime | Filter by created at after the given timestamp | [optional] |
before | DateTime | Filter by created at before the given timestamp | [optional] |
Return type
MailSlurpModelsPageAttachmentEntity
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept:
*/*
[Back to top] [Back to API list] [Back to Model list] [Back to ]
uploadAttachment()
Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment.
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 MailSlurpApiAttachmentControllerApi(
// 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
);
$upload_attachment_options = new MailSlurpModelsUploadAttachmentOptions(); // MailSlurpModelsUploadAttachmentOptions
try {
$result = $apiInstance->uploadAttachment($upload_attachment_options);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AttachmentControllerApi->uploadAttachment: ', $e->getMessage(), PHP_EOL;
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
upload_attachment_options | MailSlurpModelsUploadAttachmentOptions |
Return type
string[]
Authorization
HTTP request headers
- Content-Type:
application/json
- Accept:
*/*
[Back to top] [Back to API list] [Back to Model list] [Back to ]
uploadAttachmentBytes()
Upload an attachment for sending using file byte stream input octet stream. Returns an array whose first element is the ID of the uploaded attachment.
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 MailSlurpApiAttachmentControllerApi(
// 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
);
$upload_attachment_bytes_request = new MailSlurpModelsUploadAttachmentBytesRequest(); // MailSlurpModelsUploadAttachmentBytesRequest
$content_type = 'content_type_example'; // string | Optional contentType for file. For instance `application/pdf`
$filename = 'filename_example'; // string | Optional filename to save upload with
try {
$result = $apiInstance->uploadAttachmentBytes($upload_attachment_bytes_request, $content_type, $filename);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AttachmentControllerApi->uploadAttachmentBytes: ', $e->getMessage(), PHP_EOL;
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
upload_attachment_bytes_request | MailSlurpModelsUploadAttachmentBytesRequest | ||
content_type | string | Optional contentType for file. For instance application/pdf | [optional] |
filename | string | Optional filename to save upload with | [optional] |
Return type
string[]
Authorization
HTTP request headers
- Content-Type:
application/octet-stream
- Accept:
application/json
[Back to top] [Back to API list] [Back to Model list] [Back to ]
uploadMultipartForm()
uploadMultipartForm($content_type, $filename, $x_filename, $upload_multipart_form_request): string[]
Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment.
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 MailSlurpApiAttachmentControllerApi(
// 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
);
$content_type = 'content_type_example'; // string | Optional content type of attachment
$filename = 'filename_example'; // string | Optional name of file
$x_filename = 'x_filename_example'; // string | Optional content type header of attachment
$upload_multipart_form_request = new MailSlurpModelsUploadMultipartFormRequest(); // MailSlurpModelsUploadMultipartFormRequest
try {
$result = $apiInstance->uploadMultipartForm($content_type, $filename, $x_filename, $upload_multipart_form_request);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AttachmentControllerApi->uploadMultipartForm: ', $e->getMessage(), PHP_EOL;
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
content_type | string | Optional content type of attachment | [optional] |
filename | string | Optional name of file | [optional] |
x_filename | string | Optional content type header of attachment | [optional] |
upload_multipart_form_request | MailSlurpModelsUploadMultipartFormRequest | [optional] |
Return type
string[]
Authorization
HTTP request headers
- Content-Type:
application/json
- Accept:
*/*
[Back to top] [Back to API list] [Back to Model list] [Back to ]