mailslurp.api.EmailControllerApi

Load the API package

import 'package:mailslurp/api.dart';

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

MethodHTTP requestDescription
deleteAllEmailsDELETE /emailsDelete all emails in all inboxes.
deleteEmailDELETE /emails/{emailId}Delete an email
downloadAttachmentGET /emails/{emailId}/attachments/{attachmentId}Get email attachment bytes. Returned as octet-stream with content type header. If you have trouble with byte responses try the downloadAttachmentBase64 response endpoints and convert the base 64 encoded content to a file or string.
downloadAttachmentBase64GET /emails/{emailId}/attachments/{attachmentId}/base64Get email attachment as base64 encoded string as an alternative to binary responses. Decode the base64FileContents as a utf-8 encoded string or array of bytes depending on the contentType.
downloadBodyGET /emails/{emailId}/bodyGet email body as string. Returned as plain/text with content type header.
downloadBodyBytesGET /emails/{emailId}/body-bytesGet email body in bytes. Returned as octet-stream with content type header.
forwardEmailPOST /emails/{emailId}/forwardForward email to recipients
getAttachmentMetaDataGET /emails/{emailId}/attachments/{attachmentId}/metadataGet email attachment metadata. This is the contentType and contentLength of an attachment. To get the individual attachments use the downloadAttachment methods.
getAttachments1GET /emails/{emailId}/attachmentsGet all email attachment metadata. Metadata includes name and size of attachments.
getEmailGET /emails/{emailId}Get email content including headers and body. Expects email to exist by ID. For emails that may not have arrived yet use the WaitForController.
getEmailContentMatchPOST /emails/{emailId}/contentMatchGet email content regex pattern match results. Runs regex against email body and returns match groups.
getEmailHTMLGET /emails/{emailId}/htmlGet email content as HTML. For displaying emails in browser context.
getEmailHTMLQueryGET /emails/{emailId}/htmlQueryParse and return text from an email, stripping HTML and decoding encoded characters
getEmailLinksGET /emails/{emailId}/linksParse and return list of links found in an email (only works for HTML content)
getEmailTextLinesGET /emails/{emailId}/textLinesParse and return text from an email, stripping HTML and decoding encoded characters
getEmailsPaginatedGET /emailsGet all emails in all inboxes in paginated form. Email API list all.
getGravatarUrlForEmailAddressGET /emails/gravatarForGet gravatar url for email address
getLatestEmailGET /emails/latestGet latest email in all inboxes. Most recently received.
getLatestEmailInInboxGET /emails/latestInGet latest email in an inbox. Use WaitForController to get emails that may not have arrived yet.
getOrganizationEmailsPaginatedGET /emails/organizationGet all organization emails. List team or shared test email accounts
getRawEmailContentsGET /emails/{emailId}/rawGet raw email string. Returns unparsed raw SMTP message with headers and body.
getRawEmailJsonGET /emails/{emailId}/raw/jsonGet raw email in JSON. Unparsed SMTP message in JSON wrapper format.
getUnreadEmailCountGET /emails/unreadCountGet unread email count
markAsReadPATCH /emails/{emailId}/readMark an email as read on unread
replyToEmailPUT /emails/{emailId}Reply to an email
sendEmailSourceOptionalPOST /emailsSend email
validateEmailPOST /emails/{emailId}/validateValidate email HTML contents

deleteAllEmails

deleteAllEmails()

Delete all emails in all inboxes.

Deletes all emails in your account. Be careful as emails cannot be recovered

Example

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';

final api_instance = EmailControllerApi();

try { 
    api_instance.deleteAllEmails();
} catch (e) {
    print('Exception when calling EmailControllerApi->deleteAllEmails: $en');
}

Parameters

This endpoint does not need any parameter.

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 ]

deleteEmail

deleteEmail(emailId)

Delete an email

Deletes an email and removes it from the inbox. Deleted emails cannot be recovered.

Example

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';

final api_instance = EmailControllerApi();
final emailId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | ID of email to delete

try { 
    api_instance.deleteEmail(emailId);
} catch (e) {
    print('Exception when calling EmailControllerApi->deleteEmail: $en');
}

Parameters

NameTypeDescriptionNotes
emailIdStringID of email to delete

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 ]

downloadAttachment

String downloadAttachment(attachmentId, emailId, apiKey)

Get email attachment bytes. Returned as octet-stream with content type header. If you have trouble with byte responses try the downloadAttachmentBase64 response endpoints and convert the base 64 encoded content to a file or string.

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

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';

final api_instance = EmailControllerApi();
final attachmentId = attachmentId_example; // String | ID of attachment
final emailId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | ID of email
final apiKey = apiKey_example; // String | Can pass apiKey in url for this request if you wish to download the file in a browser. Content type will be set to original content type of the attachment file. This is so that browsers can download the file correctly.

try { 
    final result = api_instance.downloadAttachment(attachmentId, emailId, apiKey);
    print(result);
} catch (e) {
    print('Exception when calling EmailControllerApi->downloadAttachment: $en');
}

Parameters

NameTypeDescriptionNotes
attachmentIdStringID of attachment
emailIdStringID of email
apiKeyStringCan pass apiKey in url for this request if you wish to download the file in a browser. Content type will be set to original content type of the attachment file. This is so that browsers can download the file correctly.[optional]

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 ]

downloadAttachmentBase64

DownloadAttachmentDto downloadAttachmentBase64(attachmentId, emailId)

Get email attachment as base64 encoded string as an alternative to binary responses. Decode the base64FileContents as a utf-8 encoded string or array of bytes depending on the contentType.

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

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';

final api_instance = EmailControllerApi();
final attachmentId = attachmentId_example; // String | ID of attachment
final emailId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | ID of email

try { 
    final result = api_instance.downloadAttachmentBase64(attachmentId, emailId);
    print(result);
} catch (e) {
    print('Exception when calling EmailControllerApi->downloadAttachmentBase64: $en');
}

Parameters

NameTypeDescriptionNotes
attachmentIdStringID of attachment
emailIdStringID of email

Return type

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 ]

downloadBody

String downloadBody(emailId)

Get email body as string. Returned as plain/text with content type header.

Returns the specified email body for a given email as a string

Example

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';

final api_instance = EmailControllerApi();
final emailId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | ID of email

try { 
    final result = api_instance.downloadBody(emailId);
    print(result);
} catch (e) {
    print('Exception when calling EmailControllerApi->downloadBody: $en');
}

Parameters

NameTypeDescriptionNotes
emailIdStringID of email

Return type

String

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: text/html, text/plain

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

downloadBodyBytes

String downloadBodyBytes(emailId)

Get email body in bytes. Returned as octet-stream with content type header.

Returns the specified email body for a given email as a stream / array of bytes.

Example

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';

final api_instance = EmailControllerApi();
final emailId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | ID of email

try { 
    final result = api_instance.downloadBodyBytes(emailId);
    print(result);
} catch (e) {
    print('Exception when calling EmailControllerApi->downloadBodyBytes: $en');
}

Parameters

NameTypeDescriptionNotes
emailIdStringID of email

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 ]

forwardEmail

SentEmailDto forwardEmail(emailId, forwardEmailOptions)

Forward email to recipients

Forward an existing email to new recipients. The sender of the email will be the inbox that received the email you are forwarding. You can override the sender with the from option. Note you must have access to the from address in MailSlurp to use the override. For more control consider fetching the email and sending it a new using the send email endpoints.

Example

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';

final api_instance = EmailControllerApi();
final emailId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | ID of email
final forwardEmailOptions = ForwardEmailOptions(); // ForwardEmailOptions | forwardEmailOptions

try { 
    final result = api_instance.forwardEmail(emailId, forwardEmailOptions);
    print(result);
} catch (e) {
    print('Exception when calling EmailControllerApi->forwardEmail: $en');
}

Parameters

NameTypeDescriptionNotes
emailIdStringID of email
forwardEmailOptionsForwardEmailOptionsforwardEmailOptions

Return type

SentEmailDto

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 ]

getAttachmentMetaData

AttachmentMetaData getAttachmentMetaData(attachmentId, emailId)

Get email attachment metadata. This is the contentType and contentLength of an attachment. To get the individual attachments use the downloadAttachment methods.

Returns the metadata such as name and content-type for a given attachment and email.

Example

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';

final api_instance = EmailControllerApi();
final attachmentId = attachmentId_example; // String | ID of attachment
final emailId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | ID of email

try { 
    final result = api_instance.getAttachmentMetaData(attachmentId, emailId);
    print(result);
} catch (e) {
    print('Exception when calling EmailControllerApi->getAttachmentMetaData: $en');
}

Parameters

NameTypeDescriptionNotes
attachmentIdStringID of attachment
emailIdStringID of email

Return type

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 ]

getAttachments1

List getAttachments1(emailId)

Get all email attachment metadata. Metadata includes name and size of attachments.

Returns an array of attachment metadata such as name and content-type for a given email if present.

Example

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';

final api_instance = EmailControllerApi();
final emailId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | ID of email

try { 
    final result = api_instance.getAttachments1(emailId);
    print(result);
} catch (e) {
    print('Exception when calling EmailControllerApi->getAttachments1: $en');
}

Parameters

NameTypeDescriptionNotes
emailIdStringID of email

Return type

List

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 ]

getEmail

Email getEmail(emailId, decode)

Get email content including headers and body. Expects email to exist by ID. For emails that may not have arrived yet use the WaitForController.

Returns a email summary object with headers and content. To retrieve the raw unparsed email use the getRawEmail endpoints

Example

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';

final api_instance = EmailControllerApi();
final emailId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | emailId
final decode = true; // bool | Decode email body quoted-printable encoding to plain text. SMTP servers often encode text using quoted-printable format (for instance `=D7`). This can be a pain for testing

try { 
    final result = api_instance.getEmail(emailId, decode);
    print(result);
} catch (e) {
    print('Exception when calling EmailControllerApi->getEmail: $en');
}

Parameters

NameTypeDescriptionNotes
emailIdStringemailId
decodeboolDecode email body quoted-printable encoding to plain text. SMTP servers often encode text using quoted-printable format (for instance =D7). This can be a pain for testing[optional] [default to false]

Return type

Email

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 ]

getEmailContentMatch

EmailContentMatchResult getEmailContentMatch(emailId, contentMatchOptions)

Get email content regex pattern match results. Runs regex against email body and returns match groups.

Return the matches for a given Java style regex pattern. Do not include the typical / at start or end of regex in some languages. Given an example your code is: 12345 the pattern to extract match looks like code is: (d{6}). This will return an array of matches with the first matching the entire pattern and the subsequent matching the groups: ['code is: 123456', '123456'] See https://docs.oracle.com/javase/8/docs/api/java/util/regex/ for more information of available patterns.

Example

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';

final api_instance = EmailControllerApi();
final emailId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | ID of email to match against
final contentMatchOptions = ContentMatchOptions(); // ContentMatchOptions | contentMatchOptions

try { 
    final result = api_instance.getEmailContentMatch(emailId, contentMatchOptions);
    print(result);
} catch (e) {
    print('Exception when calling EmailControllerApi->getEmailContentMatch: $en');
}

Parameters

NameTypeDescriptionNotes
emailIdStringID of email to match against
contentMatchOptionsContentMatchOptionscontentMatchOptions

Return type

EmailContentMatchResult

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 ]

getEmailHTML

String getEmailHTML(emailId, decode)

Get email content as HTML. For displaying emails in browser context.

Retrieve email content as HTML response for viewing in browsers. Decodes quoted-printable entities and converts charset to UTF-8. Pass your API KEY as a request parameter when viewing in a browser: ?apiKey=xxx

Example

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';

final api_instance = EmailControllerApi();
final emailId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | emailId
final decode = true; // bool | decode

try { 
    final result = api_instance.getEmailHTML(emailId, decode);
    print(result);
} catch (e) {
    print('Exception when calling EmailControllerApi->getEmailHTML: $en');
}

Parameters

NameTypeDescriptionNotes
emailIdStringemailId
decodebooldecode[optional] [default to false]

Return type

String

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: text/html

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

getEmailHTMLQuery

EmailTextLinesResult getEmailHTMLQuery(emailId, htmlSelector)

Parse and return text from an email, stripping HTML and decoding encoded characters

Parse an email body and return the content as an array of text. HTML parsing uses JSoup which supports JQuery/CSS style selectors

Example

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';

final api_instance = EmailControllerApi();
final emailId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | ID of email to perform HTML query on
final htmlSelector = htmlSelector_example; // String | HTML selector to search for. Uses JQuery/JSoup/CSS style selector like '.my-div' to match content. See https://jsoup.org/apidocs/org/jsoup/select/ for more information.

try { 
    final result = api_instance.getEmailHTMLQuery(emailId, htmlSelector);
    print(result);
} catch (e) {
    print('Exception when calling EmailControllerApi->getEmailHTMLQuery: $en');
}

Parameters

NameTypeDescriptionNotes
emailIdStringID of email to perform HTML query on
htmlSelectorStringHTML selector to search for. Uses JQuery/JSoup/CSS style selector like ‘.my-div’ to match content. See https://jsoup.org/apidocs/org/jsoup/select/ for more information.[optional]

Return type

EmailTextLinesResult

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 ]

EmailLinksResult getEmailLinks(emailId)

Parse and return list of links found in an email (only works for HTML content)

HTML parsing uses JSoup and UNIX line separators. Searches content for href attributes

Example

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';

final api_instance = EmailControllerApi();
final emailId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | ID of email to fetch text for

try { 
    final result = api_instance.getEmailLinks(emailId);
    print(result);
} catch (e) {
    print('Exception when calling EmailControllerApi->getEmailLinks: $en');
}

Parameters

NameTypeDescriptionNotes
emailIdStringID of email to fetch text for

Return type

EmailLinksResult

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 ]

getEmailTextLines

EmailTextLinesResult getEmailTextLines(emailId, decodeHtmlEntities, lineSeparator)

Parse and return text from an email, stripping HTML and decoding encoded characters

Parse an email body and return the content as an array of strings. HTML parsing uses JSoup and UNIX line separators.

Example

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';

final api_instance = EmailControllerApi();
final emailId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | ID of email to fetch text for
final decodeHtmlEntities = true; // bool | Decode HTML entities
final lineSeparator = lineSeparator_example; // String | Line separator character

try { 
    final result = api_instance.getEmailTextLines(emailId, decodeHtmlEntities, lineSeparator);
    print(result);
} catch (e) {
    print('Exception when calling EmailControllerApi->getEmailTextLines: $en');
}

Parameters

NameTypeDescriptionNotes
emailIdStringID of email to fetch text for
decodeHtmlEntitiesboolDecode HTML entities[optional]
lineSeparatorStringLine separator character[optional]

Return type

EmailTextLinesResult

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 ]

getEmailsPaginated

PageEmailProjection getEmailsPaginated(before, inboxId, page, searchFilter, since, size, sort, unreadOnly)

Get all emails in all inboxes in paginated form. Email API list all.

By default returns all emails across all inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages

Example

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';

final api_instance = EmailControllerApi();
final before = 2013-10-20T19:20:30+01:00; // DateTime | Optional filter emails received before given date time
final inboxId = []; // List<String> | Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account.
final page = 56; // int | Optional page  in email list pagination
final searchFilter = searchFilter_example; // String | Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body
final since = 2013-10-20T19:20:30+01:00; // DateTime | Optional filter emails received after given date time
final size = 56; // int | Optional page size in email list pagination. Maximum size is 100. Use page  and sort to page through larger results
final sort = sort_example; // String | Optional createdAt sort direction ASC or DESC
final unreadOnly = true; // bool | Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly

try { 
    final result = api_instance.getEmailsPaginated(before, inboxId, page, searchFilter, since, size, sort, unreadOnly);
    print(result);
} catch (e) {
    print('Exception when calling EmailControllerApi->getEmailsPaginated: $en');
}

Parameters

NameTypeDescriptionNotes
beforeDateTimeOptional filter emails received before given date time[optional]
inboxIdListOptional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account.[optional] [default to const []]
pageintOptional page in email list pagination[optional] [default to 0]
searchFilterStringOptional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body[optional] [default to ‘false’]
sinceDateTimeOptional filter emails received after given date time[optional]
sizeintOptional page size in email list pagination. Maximum size is 100. Use page and sort to page through larger results[optional] [default to 20]
sortStringOptional createdAt sort direction ASC or DESC[optional] [default to ‘ASC’]
unreadOnlyboolOptional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly[optional] [default to false]

Return type

PageEmailProjection

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 ]

getGravatarUrlForEmailAddress

GravatarUrl getGravatarUrlForEmailAddress(emailAddress, size)

Get gravatar url for email address

Example

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';

final api_instance = EmailControllerApi();
final emailAddress = emailAddress_example; // String | emailAddress
final size = size_example; // String | size

try { 
    final result = api_instance.getGravatarUrlForEmailAddress(emailAddress, size);
    print(result);
} catch (e) {
    print('Exception when calling EmailControllerApi->getGravatarUrlForEmailAddress: $en');
}

Parameters

NameTypeDescriptionNotes
emailAddressStringemailAddress
sizeStringsize[optional]

Return type

GravatarUrl

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 ]

getLatestEmail

Email getLatestEmail(inboxIds)

Get latest email in all inboxes. Most recently received.

Get the newest email in all inboxes or in a passed set of inbox IDs

Example

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';

final api_instance = EmailControllerApi();
final inboxIds = []; // List<String> | Optional set of inboxes to filter by. Only get the latest email from these inbox IDs. If not provided will search across all inboxes

try { 
    final result = api_instance.getLatestEmail(inboxIds);
    print(result);
} catch (e) {
    print('Exception when calling EmailControllerApi->getLatestEmail: $en');
}

Parameters

NameTypeDescriptionNotes
inboxIdsListOptional set of inboxes to filter by. Only get the latest email from these inbox IDs. If not provided will search across all inboxes[optional] [default to const []]

Return type

Email

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 ]

getLatestEmailInInbox

Email getLatestEmailInInbox(inboxId)

Get latest email in an inbox. Use WaitForController to get emails that may not have arrived yet.

Get the newest email in all inboxes or in a passed set of inbox IDs

Example

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';

final api_instance = EmailControllerApi();
final inboxId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | ID of the inbox you want to get the latest email from

try { 
    final result = api_instance.getLatestEmailInInbox(inboxId);
    print(result);
} catch (e) {
    print('Exception when calling EmailControllerApi->getLatestEmailInInbox: $en');
}

Parameters

NameTypeDescriptionNotes
inboxIdStringID of the inbox you want to get the latest email from[optional]

Return type

Email

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 ]

getOrganizationEmailsPaginated

PageEmailProjection getOrganizationEmailsPaginated(before, inboxId, page, searchFilter, since, size, sort, unreadOnly)

Get all organization emails. List team or shared test email accounts

By default returns all emails across all team inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages

Example

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';

final api_instance = EmailControllerApi();
final before = 2013-10-20T19:20:30+01:00; // DateTime | Optional filter emails received before given date time
final inboxId = []; // List<String> | Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account.
final page = 56; // int | Optional page  in email list pagination
final searchFilter = searchFilter_example; // String | Optional search filter search filter for emails.
final since = 2013-10-20T19:20:30+01:00; // DateTime | Optional filter emails received after given date time
final size = 56; // int | Optional page size in email list pagination. Maximum size is 100. Use page  and sort to page through larger results
final sort = sort_example; // String | Optional createdAt sort direction ASC or DESC
final unreadOnly = true; // bool | Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly

try { 
    final result = api_instance.getOrganizationEmailsPaginated(before, inboxId, page, searchFilter, since, size, sort, unreadOnly);
    print(result);
} catch (e) {
    print('Exception when calling EmailControllerApi->getOrganizationEmailsPaginated: $en');
}

Parameters

NameTypeDescriptionNotes
beforeDateTimeOptional filter emails received before given date time[optional]
inboxIdListOptional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account.[optional] [default to const []]
pageintOptional page in email list pagination[optional] [default to 0]
searchFilterStringOptional search filter search filter for emails.[optional]
sinceDateTimeOptional filter emails received after given date time[optional]
sizeintOptional page size in email list pagination. Maximum size is 100. Use page and sort to page through larger results[optional] [default to 20]
sortStringOptional createdAt sort direction ASC or DESC[optional] [default to ‘ASC’]
unreadOnlyboolOptional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly[optional] [default to false]

Return type

PageEmailProjection

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 ]

getRawEmailContents

String getRawEmailContents(emailId)

Get raw email string. Returns unparsed raw SMTP message with headers and body.

Returns a raw, unparsed, and unprocessed email. If your client has issues processing the response it is likely due to the response content-type which is text/plain. If you need a JSON response content-type use the getRawEmailJson endpoint

Example

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';

final api_instance = EmailControllerApi();
final emailId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | ID of email

try { 
    final result = api_instance.getRawEmailContents(emailId);
    print(result);
} catch (e) {
    print('Exception when calling EmailControllerApi->getRawEmailContents: $en');
}

Parameters

NameTypeDescriptionNotes
emailIdStringID of email

Return type

String

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: text/plain

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

getRawEmailJson

RawEmailJson getRawEmailJson(emailId)

Get raw email in JSON. Unparsed SMTP message in JSON wrapper format.

Returns a raw, unparsed, and unprocessed email wrapped in a JSON response object for easier handling when compared with the getRawEmail text/plain response

Example

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';

final api_instance = EmailControllerApi();
final emailId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | ID of email

try { 
    final result = api_instance.getRawEmailJson(emailId);
    print(result);
} catch (e) {
    print('Exception when calling EmailControllerApi->getRawEmailJson: $en');
}

Parameters

NameTypeDescriptionNotes
emailIdStringID of email

Return type

RawEmailJson

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 ]

getUnreadEmailCount

UnreadCount getUnreadEmailCount()

Get unread email count

Get number of emails unread. Unread means has not been viewed in dashboard or returned in an email API response

Example

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';

final api_instance = EmailControllerApi();

try { 
    final result = api_instance.getUnreadEmailCount();
    print(result);
} catch (e) {
    print('Exception when calling EmailControllerApi->getUnreadEmailCount: $en');
}

Parameters

This endpoint does not need any parameter.

Return type

UnreadCount

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 ]

markAsRead

EmailPreview markAsRead(emailId, read)

Mark an email as read on unread

Marks an email as read or unread. Pass boolean read flag to set value. This is useful if you want to read an email but keep it as unread

Example

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';

final api_instance = EmailControllerApi();
final emailId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | emailId
final read = true; // bool | What value to assign to email read property. Default true.

try { 
    final result = api_instance.markAsRead(emailId, read);
    print(result);
} catch (e) {
    print('Exception when calling EmailControllerApi->markAsRead: $en');
}

Parameters

NameTypeDescriptionNotes
emailIdStringemailId
readboolWhat value to assign to email read property. Default true.[optional] [default to true]

Return type

EmailPreview

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 ]

replyToEmail

SentEmailDto replyToEmail(emailId, replyToEmailOptions)

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

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';

final api_instance = EmailControllerApi();
final emailId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | ID of the email that should be replied to
final replyToEmailOptions = ReplyToEmailOptions(); // ReplyToEmailOptions | replyToEmailOptions

try { 
    final result = api_instance.replyToEmail(emailId, replyToEmailOptions);
    print(result);
} catch (e) {
    print('Exception when calling EmailControllerApi->replyToEmail: $en');
}

Parameters

NameTypeDescriptionNotes
emailIdStringID of the email that should be replied to
replyToEmailOptionsReplyToEmailOptionsreplyToEmailOptions

Return type

SentEmailDto

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 ]

sendEmailSourceOptional

sendEmailSourceOptional(inboxId, useDomainPool, sendEmailOptions)

Send email

Alias for InboxController.sendEmail method - see original method for full details. Sends an email from a given inbox that you have created. If no inbox is supplied a random inbox will be created for you and used to send the email.

Example

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';

final api_instance = EmailControllerApi();
final inboxId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | ID of the inbox you want to send the email from
final useDomainPool = true; // bool | Use domain pool. Optionally create inbox to send from using the mailslurp domain pool.
final sendEmailOptions = SendEmailOptions(); // SendEmailOptions | Options for the email

try { 
    api_instance.sendEmailSourceOptional(inboxId, useDomainPool, sendEmailOptions);
} catch (e) {
    print('Exception when calling EmailControllerApi->sendEmailSourceOptional: $en');
}

Parameters

NameTypeDescriptionNotes
inboxIdStringID of the inbox you want to send the email from[optional]
useDomainPoolboolUse domain pool. Optionally create inbox to send from using the mailslurp domain pool.[optional]
sendEmailOptionsSendEmailOptionsOptions for the email[optional]

Return type

void (empty response body)

Authorization

API_KEY

HTTP request headers

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

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

validateEmail

ValidationDto validateEmail(emailId)

Validate email HTML contents

Validate the HTML content of email if HTML is found. Considered valid if no HTML is present.

Example

import 'package:mailslurp/api.dart';
// TODO Configure API key authorization: API_KEY
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('API_KEY').apiKeyPrefix = 'Bearer';

final api_instance = EmailControllerApi();
final emailId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | ID of email

try { 
    final result = api_instance.validateEmail(emailId);
    print(result);
} catch (e) {
    print('Exception when calling EmailControllerApi->validateEmail: $en');
}

Parameters

NameTypeDescriptionNotes
emailIdStringID of email

Return type

ValidationDto

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 ]