AttachmentControllerApi

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

MethodHTTP requestDescription
delete_all_attachmentsdelete /attachmentsDelete all attachments
delete_attachmentdelete /attachments/{attachmentId}Delete an attachment
download_attachment_as_base64_encodedget /attachments/{attachmentId}/base64Get email attachment as base64 encoded string as alternative to binary responses. To read the content decode the Base64 encoded contents.
download_attachment_as_bytesget /attachments/{attachmentId}/bytesDownload attachments. Get email attachment bytes. If you have trouble with byte responses try the downloadAttachmentBase64 response endpoints.
get_attachmentget /attachments/{attachmentId}Get an attachment entity
get_attachment_infoget /attachments/{attachmentId}/metadataGet email attachment metadata information
get_attachmentsget /attachmentsGet email attachments
upload_attachmentpost /attachmentsUpload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment.
upload_attachment_bytespost /attachments/bytesUpload an attachment for sending using file byte stream input octet stream. Returns an array whose first element is the ID of the uploaded attachment.
upload_multipart_formpost /attachments/multipartUpload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment.

delete_all_attachments

delete_all_attachments() Delete all attachments

Parameters

This endpoint does not need any parameter.

Return type

(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 ]

delete_attachment

delete_attachment(attachment_id) Delete an attachment

Email attachments are essentially files with meta data. Files are byte arrays and the meta data is a content type and a filename. These properties allow email clients to display the filename and icon etc. When sending emails with attachments first upload each attachment with an upload endpoint. Record the returned attachment ID and use it with subsequent email sending. For legacy reasons the ID is returned as the first element in an array. Only a single ID is ever returned. To send the attachments pass a list of attachment IDs with SendEmailOptions when sending an email. Using the upload endpoints prior to sending mean attachments can easily be reused.

Parameters

NameTypeDescriptionRequiredNotes
attachment_idStringID of attachment[required]

Return type

(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 ]

download_attachment_as_base64_encoded

crate::models::DownloadAttachmentDto download_attachment_as_base64_encoded(attachment_id) 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.

Parameters

NameTypeDescriptionRequiredNotes
attachment_idStringID of attachment[required]

Return type

crate::models::DownloadAttachmentDto

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

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

download_attachment_as_bytes

String download_attachment_as_bytes(attachment_id) 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.

Parameters

NameTypeDescriptionRequiredNotes
attachment_idStringID of attachment[required]

Return type

String

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/octet-stream

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

get_attachment

crate::models::AttachmentEntity get_attachment(attachment_id) Get an attachment entity

Email attachments are essentially files with meta data. Files are byte arrays and the meta data is a content type and a filename. These properties allow email clients to display the filename and icon etc. When sending emails with attachments first upload each attachment with an upload endpoint. Record the returned attachment ID and use it with subsequent email sending. For legacy reasons the ID is returned as the first element in an array. Only a single ID is ever returned. To send the attachments pass a list of attachment IDs with SendEmailOptions when sending an email. Using the upload endpoints prior to sending mean attachments can easily be reused.

Parameters

NameTypeDescriptionRequiredNotes
attachment_idStringID of attachment[required]

Return type

crate::models::AttachmentEntity

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

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

get_attachment_info

crate::models::AttachmentMetaData get_attachment_info(attachment_id) 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.

Parameters

NameTypeDescriptionRequiredNotes
attachment_idStringID of attachment[required]

Return type

crate::models::AttachmentMetaData

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

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

get_attachments

crate::models::PageAttachmentEntity get_attachments(before, file_name_filter, page, since, size, sort) 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.

Parameters

NameTypeDescriptionRequiredNotes
beforeOption<String>Filter by created at before the given timestamp
file_name_filterOption<String>Optional file name and content type search filter
pageOption<i32>Optional page event list pagination[default to 0]
sinceOption<String>Filter by created at after the given timestamp
sizeOption<i32>Optional page size event list pagination[default to 20]
sortOption<String>Optional createdAt sort direction ASC or DESC[default to ASC]

Return type

crate::models::PageAttachmentEntity

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

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

upload_attachment

Vec upload_attachment(upload_options) Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment.

Email attachments are essentially files with meta data. Files are byte arrays and the meta data is a content type and a filename. These properties allow email clients to display the filename and icon etc. When sending emails with attachments first upload each attachment with an upload endpoint. Record the returned attachment ID and use it with subsequent email sending. For legacy reasons the ID is returned as the first element in an array. Only a single ID is ever returned. To send the attachments pass a list of attachment IDs with SendEmailOptions when sending an email. Using the upload endpoints prior to sending mean attachments can easily be reused.

Parameters

NameTypeDescriptionRequiredNotes
upload_optionsUploadAttachmentOptionsuploadOptions[required]

Return type

Vec

Authorization

API_KEY

HTTP request headers

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

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

upload_attachment_bytes

Vec upload_attachment_bytes(content_type, filename, byte_array) 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.

Email attachments are essentially files with meta data. Files are byte arrays and the meta data is a content type and a filename. These properties allow email clients to display the filename and icon etc. When sending emails with attachments first upload each attachment with an upload endpoint. Record the returned attachment ID and use it with subsequent email sending. For legacy reasons the ID is returned as the first element in an array. Only a single ID is ever returned. To send the attachments pass a list of attachment IDs with SendEmailOptions when sending an email. Using the upload endpoints prior to sending mean attachments can easily be reused.

Parameters

NameTypeDescriptionRequiredNotes
content_typeOption<String>Optional contentType for file. For instance application/pdf
filenameOption<String>Optional filename to save upload with
byte_arrayOption<String>Byte array request body

Return type

Vec

Authorization

API_KEY

HTTP request headers

  • Content-Type: application/octet-stream
  • Accept: application/json

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

upload_multipart_form

Vec upload_multipart_form(file, content_type, filename, x_filename) Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment.

Email attachments are essentially files with meta data. Files are byte arrays and the meta data is a content type and a filename. These properties allow email clients to display the filename and icon etc. When sending emails with attachments first upload each attachment with an upload endpoint. Record the returned attachment ID and use it with subsequent email sending. For legacy reasons the ID is returned as the first element in an array. Only a single ID is ever returned. To send the attachments pass a list of attachment IDs with SendEmailOptions when sending an email. Using the upload endpoints prior to sending mean attachments can easily be reused.

Parameters

NameTypeDescriptionRequiredNotes
filestd::path::PathBuffile[required]
content_typeOption<String>Optional content type of attachment
filenameOption<String>Optional name of file
x_filenameOption<String>Optional content type header of attachment

Return type

Vec

Authorization

API_KEY

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json

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