# Mailosaur > Mailosaur is an email and SMS testing platform. It gives teams instant, secure test inboxes and phone numbers, and email previews across clients and devices, to test every sign-up, password reset and authentication flow automatically. --- Source: https://mailosaur.com/docs/api # Email and SMS Testing API Using the Mailosaur API, you can write automated tests for the email and SMS messages your product sends. ## Overview The Mailosaur API lets you test email using a simple REST API. You can make the API calls yourself, however because email and SMS messages can take time to arrive, we highly recommend using one of our official clients. ![Postman](https://app.getpostman.com/run-collection/6961255-6cc72dff-f576-451a-9023-b82dec84f95d?action=collection%2Ffork&collection-url=entityId%3D6961255-6cc72dff-f576-451a-9023-b82dec84f95d%26entityType%3Dcollection%26workspaceId%3D386a4af1-4293-4197-8f40-0eb49f831325) ![Insomnia](https://insomnia.rest/run/?label=Mailosaur&uri=https%3A%2F%2Fmailosaur.com%2Finsomnia.json) ## Authentication The Mailosaur API uses [API keys](/docs/managing-your-account/api-keys) to authenticate requests. Authentication to the API is performed via **HTTP Basic Auth**. Your API key must be provided as the basic auth username value. You do not need to provide a password. Your API keys carry many privileges, so always keep them secret and secure! Never share your API key in publicly-accessible areas such GitHub, client-side code, etc. All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail. ```curl curl https://mailosaur.com/api/servers \ -u api:YOUR_API_KEY ``` ### Managing API keys You can [manage all your API keys](/docs/managing-your-account/api-keys) in the Mailosaur Dashboard. ## Errors ### HTTP Status Codes Mailosaur uses conventional HTTP response codes to indicate the success or failure of an API request. In general, codes in the ```2xx``` range indicate success, codes in the ```4xx``` range indicate an error that failed given the information provided (e.g., a required parameter was omitted), and codes in the ```5xx``` range indicate an error with Mailosaur’s servers (give us a shout in the unlikely event that you see one of those). | CODE | DESCRIPTION | | ------ | ------ | | **200 OK** | Request was successful. | | **204 No Content** | Request was successful, no response content. | | **400 Bad Request** | The request could not be handled, often due to missing a required parameter. | | **401 Unauthorized** | No valid API key provided. | | **404 Not Found** | The requested resource doesn’t exist. | | **5XX Server Errors** | Something went wrong at Mailosaur. (Give us a shout). | ### Error handling In case of an error the server will return as much information as possible. In the case of a ```401``` or ```404``` error the status code gives as much information as you’d need. But for ```400``` errors Mailosaur will return a JSON object containing the structure below. Note that our [client libraries](/docs/automation) convert responses to appropriate language-specific objects. | FIELD | DESCRIPTION | | ------- | ------- | | **type** | The type of error returned. | | **message** | A human-readable message providing more details about the error. | | **parameters** | A JSON object containing a key for each property name at fault, with a human-readable message per field. | | **model** | The request model that was sent and failed to be processed. | ## Email and SMS Testing The Messages API allows you to list, search, view, modify and create email and SMS messages within your Mailosaur account. ### Retrieve a message `GET /api/messages/:id` If you are using one of [Mailosaur’s client libraries](/docs/automation), we **highly recommend** using the ```.Get``` method instead of ```.GetById```, as it automatically waits for results to arrive! Retrieves the detail for a single message. Simply supply the unique identifier for the required message. To get the ID of a message you need to call one of our other API calls which returns a list of messages. Each message in the list will contain an ID which you can use to make this call. #### Parameters | Name | Type | Location | Required | Description | | --- | --- | --- | --- | --- | | id | string | path | Yes | The identifier of the message to be retrieved. This can be found via other API calls such as List/Search. | #### Request ```curl curl \ -u api:YOUR_API_KEY \ https://mailosaur.com/api/messages/MESSAGE_ID ``` ```nodejs const message = await mailosaur.messages.getById('MESSAGE_ID'); ``` ```cypress cy.mailosaurGetMessageById('MESSAGE_ID') .then(message => { cy.log(message.subject); // "Example" }); ``` ```python message = mailosaur.messages.get_by_id("MESSAGE_ID") ``` ```java Message message = mailosaur.messages().getById("MESSAGE_ID"); ``` ```dotnet var message = mailosaur.Messages.GetById("MESSAGE_ID"); ``` ```ruby message = mailosaur.messages.get_by_id('MESSAGE_ID') ``` ```php $message = $mailosaur->messages->getById('MESSAGE_ID'); ``` ```go $message = $mailosaur->messages->getById('MESSAGE_ID'); ``` #### Response ```json { "id": "77061c9f-da47-4009-9f33-9715a3bbf00c", "received": "2019-08-06T17:44:07.197781+00:00", "type": "Email", "subject": "Email subject line", "from": [{ "name": "Acme", "email": "noreply@example.com" }], "to": [{ "name": "Jane Doe", "email": "janedoe@abc1234.mailosaur.net" }], "cc": [], "bcc": [], "html": { "links": [{ "href": "https://example.com/signup", "text": "Sign Up Now" }], "images": [], "body": "Lorem ipsum..." }, "text": { "links": [{ "href": "https://example.com/signup", "text": "https://example.com/signup" }], "body": "Lorem ipsum..." }, "attachments": [], "metadata": { "headers": [{ "field": "MIME-Version", "value": "1.0" }] }, "server": "abcd1234" } ``` ### Delete a message `DELETE /api/messages/:id` Permanently deletes a message. This operation cannot be undone. Also deletes any attachments related to the message. #### Parameters | Name | Type | Location | Required | Description | | --- | --- | --- | --- | --- | | id | string | path | Yes | The identifier of the message to be deleted. | #### Request ```curl curl \ -X DELETE \ -u api:YOUR_API_KEY \ https://mailosaur.com/api/messages/MESSAGE_ID ``` ```nodejs await mailosaur.messages.del('MESSAGE_ID'); ``` ```cypress cy.mailosaurDeleteMessage('MESSAGE_ID'); ``` ```python mailosaur.messages.delete("MESSAGE_ID") ``` ```java mailosaur.messages().delete("MESSAGE_ID"); ``` ```dotnet mailosaur.Messages.Delete("MESSAGE_ID"); ``` ```ruby mailosaur.messages.delete('MESSAGE_ID') ``` ```php $mailosaur->messages->delete('MESSAGE_ID'); ``` ```go m.Messages.Delete("MESSAGE_ID") ``` ### List all messages `GET /api/messages?server=:server` Returns a list of your messages in summary form. The summaries are returned sorted by received date, with the most recently-received messages appearing first. #### Parameters | Name | Type | Location | Required | Description | | --- | --- | --- | --- | --- | | server | string | query | Yes | The identifier of the server hosting the messages. | | receivedAfter | date/time | query | No | Limits results to only messages received after this date/time. | | page | integer | query | No | Used in conjunction with `itemsPerPage` to support pagination. | | itemsPerPage | integer | query | No | A limit on the number of results to be returned per page. Can be set between 1 and 1000 items, the default is 50. | | dir | string | query | No | Optionally limits results based on the direction (`Sent` or `Received`), with the default being `Received`. | #### Request ```curl curl \ -u api:YOUR_API_KEY \ https://mailosaur.com/api/messages?server=SERVER_ID ``` ```nodejs const result = await mailosaur.messages.list('SERVER_ID'); console.log(result.items[0].subject); // "Example" ``` ```cypress cy.mailosaurListMessages('SERVER_ID').then(result => { cy.log(result.items[0].subject); // "Example" }); ``` ```python result = mailosaur.messages.list("SERVER_ID") print result.items[0].subject # "Example" ``` ```java MessageListParams params = new MessageListParams(); params.withServer("SERVER_ID"); MessageListResult result = mailosaur.messages().list(params); ``` ```dotnet var result = mailosaur.Messages.List("SERVER_ID"); Console.WriteLine(result.Items[0].Subject); // "Example" ``` ```ruby result = mailosaur.messages.list('SERVER_ID') print(result.items[0].subject) # "Example" ``` ```php $result = $mailosaur->messages->all('SERVER_ID'); print($result->items[0]->subject); // "Example" ``` ```go result := m.Messages.List("SERVER_ID") fmt.Println(result.Items[0].Subject) // "Example" ``` #### Response ```json [ { "id": "77061c9f-da47-4009-9f33-9715a3bbf00c", "received": "2019-08-06T17:44:07.197781+00:00", "type": "Email", "subject": "Email subject line", "from": [{ "name": "Acme", "email": "noreply@example.com" }], "to": [{ "name": "Jane Doe", "email": "janedoe@abc1234.mailosaur.net" }], "cc": [], "bcc": [] } ] ``` ### Delete all messages `DELETE /api/messages?server=:server` Permanently deletes all messages held by the specified server. This operation cannot be undone. Also deletes any attachments related to each message. #### Parameters | Name | Type | Location | Required | Description | | --- | --- | --- | --- | --- | | server | string | query | Yes | The identifier of the server to be emptied. | #### Request ```curl curl \ -X DELETE \ -u api:YOUR_API_KEY \ https://mailosaur.com/api/messages?server=SERVER_ID ``` ```nodejs await mailosaur.messages.deleteAll('SERVER_ID'); ``` ```cypress cy.mailosaurDeleteAllMessages('SERVER_ID'); ``` ```python mailosaur.messages.delete_all("SERVER_ID") ``` ```java mailosaur.messages().deleteAll("SERVER_ID"); ``` ```dotnet mailosaur.Messages.DeleteAll("SERVER_ID"); ``` ```ruby mailosaur.messages.delete_all('SERVER_ID') ``` ```php $mailosaur->messages->deleteAll('SERVER_ID'); ``` ```go m.Messages.DeleteAll("SERVER_ID") ``` ### Search for messages `POST /api/messages/search?server=:server` If you are using one of [Mailosaur’s client libraries](/docs/automation), we **highly recommend** using the ```.Get``` method instead of ```.Search```, as it automatically waits for results to arrive. It also returns the whole email/SMS, rather than just a message summary. Returns a list of message summaries matching the specified search criteria, in summary form. The summaries are returned sorted by received date, with the most recently-received messages appearing first. To get the full message content, including HTML & Text body content, you need to use the Retrieve a message endpoint. Alternatively you can search and retrieve in a single call by using our official client libraries. #### Parameters | Name | Type | Location | Required | Description | | --- | --- | --- | --- | --- | | server | string | query | Yes | The identifier of the server hosting the messages. | | receivedAfter | date/time | query | No | Limits results to only messages received after this date/time. | | page | integer | query | No | Used in conjunction with `itemsPerPage` to support pagination. | | itemsPerPage | integer | query | No | A limit on the number of results to be returned per page. Can be set between 1 and 1000 items, the default is 50. | | dir | string | query | No | Optionally limits results based on the direction (`Sent` or `Received`), with the default being `Received`. | | sentFrom | string | body | No | The full email address or phone number from which the target message was sent. | | sentTo | string | body | No | The full email address or phone number to which the target message was sent. | | subject | string | body | No | The value to seek within the target email’s subject line. | | body | string | body | No | The value to seek within the target message’s HTML or text body. | | match | string | body | No | If set to `ALL` (default), then only results that match all specified criteria will be returned. If set to `ANY`, results that match any of the specified criteria will be returned. | #### Request ```curl curl \ -X POST \ -H 'Content-Type: application/json' \ -d '{"sentTo":"someone@SERVER_ID.mailosaur.net"}' \ -u api:YOUR_API_KEY \ https://mailosaur.com/api/messages/search?server=SERVER_ID ``` ```nodejs const result = await mailosaur.messages.search('SERVER_ID', { sentTo: 'someone@SERVER_ID.mailosaur.net' }); // Get the most recent match const message = result.items[0]; console.log('Subject:', message.subject); ``` ```cypress cy.mailosaurSearchMessages('SERVER_ID', { sentTo: 'someone@SERVER_ID.mailosaur.net' }).then(result => { // Get the most recent match const message = result.items[0]; cy.log(`Subject: ${message.subject}`); }); ``` ```python from mailosaur.models import SearchCriteria # ... criteria = SearchCriteria() criteria.sent_to = "someone@SERVER_ID.mailosaur.net" result = mailosaur.messages.search('SERVER_ID', criteria) # Get the most recent match message = result.items[0] print('Subject: ' + message.subject) ``` ```java MessageSearchParams params = new MessageSearchParams(); params.withServer("SERVER_ID"); SearchCriteria criteria = new SearchCriteria(); criteria.withSentTo("someone@SERVER_ID.mailosaur.net"); MessageListResult result = mailosaur.messages().search(params, criteria); // Get the most recent match MessageSummary message = result.items().get(0); System.out.println("Subject: " + message.subject()); ``` ```dotnet var result = mailosaur.Messages.Search("SERVER_ID", new SearchCriteria() { SentTo = "someone@SERVER_ID.mailosaur.net" }); // Get the most recent match var message = result.Items[0]; Console.WriteLine("Subject: " + message.Subject); ``` ```ruby criteria = Mailosaur::Models::SearchCriteria.new() criteria.sent_to = "someone@SERVER_ID.mailosaur.net" result = mailosaur.messages.search("SERVER_ID", criteria) # Get the most recent match message = result.items[0] print('Subject: ' + message.subject) ``` ```php $criteria = new SearchCriteria(); $criteria->sentTo = 'someone@SERVER_ID.mailosaur.net'; $result = $mailosaur->messages->search('SERVER_ID', $criteria); # Get the most recent match $message = $result->items[0]; print('Subject: ' . $message->subject); ``` ```go params := &mailosaur.MessageListParams { Server: server, } criteria := &mailosaur.SearchCriteria { SentTo: "someone@SERVER_ID.mailosaur.net", } result, err := m.Messages.Search(params, criteria) if (err != nil) { // Handle err } // Get the most recent match message := result.Items[0] fmt.Println("Subject: " + message.Subject) ``` #### Response ```json [ { "id": "77061c9f-da47-4009-9f33-9715a3bbf00c", "received": "2019-08-06T17:44:07.197781+00:00", "type": "Email", "subject": "Email subject line", "from": [{ "name": "Acme", "email": "noreply@example.com" }], "to": [{ "name": "Jane Doe", "email": "janedoe@abc1234.mailosaur.net" }], "cc": [], "bcc": [] } ] ``` ### Forward a message `POST /api/messages/:id/forward` Forward an email or SMS message to a [verified external email address](/docs/managing-your-account/external-email-addresses). Supply the unique identifier for message you want to forward, as well as additional, relevant options. To get the ID of a message you need to call one of our other API calls which returns a list of messages. Each message in the list will contain an ID which you can use to make this call. #### Parameters | Name | Type | Location | Required | Description | | --- | --- | --- | --- | --- | | id | string | path | Yes | The identifier of the message to be forwarded. This can be found via other API calls such as Search for messages. | | to | string | body | Yes | The verified external email address to which the message should be sent. | | subject | string | body | No | Optionally override an email's subject line. | | html | string | body | No | Any HTML content to prefix the forwarded message with. | | text | string | body | No | Any plain text content to prefix the forwarded message with. | #### Request ```curl curl \ -X POST \ -H 'Content-Type: application/json' \ -d '{"to":"someone@example.com","text":"Example"}' \ -u api:YOUR_API_KEY \ https://mailosaur.com/api/messages/MESSAGE_ID/forward ``` ```nodejs // MESSAGE_ID: The `id` of the message you want to forward await mailosaur.messages.forward('MESSAGE_ID', { to: 'someone@example.com', // must be a verified address html: '

Hello world.

' }); ``` ```cypress // MESSAGE_ID: The `id` of the message you want to reply to cy.mailosaurForwardMessage('MESSAGE_ID', { to: 'someone@example.com', // must be a verified address html: '

Hello world.

' }) ``` ```python recipient = "someone@example.com" # must be a verified address body = "

Hello world.

" options = MessageForwardOptions(recipient, html=body) # MESSAGE_ID: The `id` of the message you want to forward mailosaur.messages.forward("MESSAGE_ID", options) ``` ```java MessageForwardOptions options = new MessageForwardOptions(); options.withTo("someone@example.com") // must be a verified address .withHtml("

Hello world.

"); // MESSAGE_ID: The `id` of the message you want to forward mailosaur.messages().forward("MESSAGE_ID", options); ``` ```dotnet // MESSAGE_ID: The `id` of the message you want to forward mailosaur.Messages.Forward("MESSAGE_ID", new MessageForwardOptions() { To = "someone@example.com", // must be a verified address Html = "

Hello world.

" } ); ``` ```ruby options = Mailosaur::Models::MessageForwardOptions.new() options.to = 'someone@example.com' # must be a verified address options.html = '

Hello world.

' # MESSAGE_ID: The `id` of the message you want to forward mailosaur.messages.forward('MESSAGE_ID', options) ``` ```php $options = new MessageForwardOptions(); $options->to = 'someone@example.com'; // must be a verified address $options->html = '

Hello world.

'; // MESSAGE_ID: The `id` of the message you want to forward $mailosaur->messages->forward('MESSAGE_ID', $options); ``` ```go // MESSAGE_ID: The `id` of the message you want to forward m.Messages.Forward("MESSAGE_ID", &MessageForwardOptions{ To: "someone@example.com", // must be a verified address Html: "

Hello world.

", }) ``` #### Response ```json { "id": "77061c9f-da47-4009-9f33-9715a3bbf00c", "received": "2019-08-06T17:44:07.197781+00:00", "type": "Email", "subject": "Email subject line", "from": [{ "name": "Acme", "email": "noreply@example.com" }], "to": [{ "name": "Jane Doe", "email": "janedoe@abc1234.mailosaur.net" }], "cc": [], "bcc": [], "html": { "links": [{ "href": "https://example.com/signup", "text": "Sign Up Now" }], "images": [], "body": "Lorem ipsum..." }, "text": { "links": [{ "href": "https://example.com/signup", "text": "https://example.com/signup" }], "body": "Lorem ipsum..." }, "attachments": [], "metadata": { "headers": [{ "field": "MIME-Version", "value": "1.0" }] }, "server": "abcd1234" } ``` ### Reply to a message `POST /api/messages/:id/reply` Reply to an email or SMS message. Supply the unique identifier for message you want to forward, as well as additional, relevant options. Email replies can only be sent back to [verified external email address](/docs/managing-your-account/external-email-addresses). SMS replies can only contain [approved phrases](/docs/sms-testing/replying#0-approved-phrases) to prevent fraud. To get the ID of a message you need to call one of our other API calls which returns a list of messages. Each message in the list will contain an ID which you can use to make this call. #### Parameters | Name | Type | Location | Required | Description | | --- | --- | --- | --- | --- | | id | string | path | Yes | The identifier of the message to be replied to. This can be found via other API calls such as Search for messages. | | subject | string | body | No | Optionally override an email's subject line. | | html | string | body | No | Any HTML content to prefix the reply with. | | text | string | body | No | Any plain text content to prefix the reply with. | | attachments | array | body | No | An object array of base64-encoded attachment objects (`fileName`, `contentType`, `content`). | #### Request ```curl curl \ -X POST \ -H 'Content-Type: application/json' \ -d '{"text":"Example"}' \ -u api:YOUR_API_KEY \ https://mailosaur.com/api/messages/MESSAGE_ID/reply ``` ```nodejs // MESSAGE_ID: The `id` of the message you want to reply to await mailosaur.messages.reply('MESSAGE_ID', { html: '

Hello world.

' }); ``` ```cypress // MESSAGE_ID: The `id` of the message you want to reply to cy.mailosaurReplyToMessage('MESSAGE_ID', { html: '

Hello world.

' }); ``` ```python body = "

Hello world.

" options = MessageReplyOptions(html=body) # MESSAGE_ID: The `id` of the message you want to reply to mailosaur.messages.reply("MESSAGE_ID", options) ``` ```java MessageReplyOptions options = new MessageReplyOptions(); options.withHtml("

Hello world.

"); // MESSAGE_ID: The `id` of the message you want to reply to mailosaur.messages().reply("MESSAGE_ID", options); ``` ```dotnet // MESSAGE_ID: The `id` of the message you want to reply to mailosaur.Messages.Reply("MESSAGE_ID", new MessageReplyOptions() { Html = "

Hello world.

" } ); ``` ```ruby options = Mailosaur::Models::MessageReplyOptions.new() options.html = '

Hello world.

' # MESSAGE_ID: The `id` of the message you want to reply to mailosaur.messages.reply('MESSAGE_ID', options) ``` ```php $options = new MessageReplyOptions(); $options->html = '

Hello world.

'; // MESSAGE_ID: The `id` of the message you want to reply to $mailosaur->messages->reply('MESSAGE_ID', $options); ``` ```go // MESSAGE_ID: The `id` of the message you want to reply to m.Messages.Reply("MESSAGE_ID", &MessageReplyOptions{ Html: "

Hello world.

", }) ``` #### Response ```json { "id": "77061c9f-da47-4009-9f33-9715a3bbf00c", "received": "2019-08-06T17:44:07.197781+00:00", "type": "Email", "subject": "Email subject line", "from": [{ "name": "Acme", "email": "noreply@example.com" }], "to": [{ "name": "Jane Doe", "email": "janedoe@abc1234.mailosaur.net" }], "cc": [], "bcc": [], "html": { "links": [{ "href": "https://example.com/signup", "text": "Sign Up Now" }], "images": [], "body": "Lorem ipsum..." }, "text": { "links": [{ "href": "https://example.com/signup", "text": "https://example.com/signup" }], "body": "Lorem ipsum..." }, "attachments": [], "metadata": { "headers": [{ "field": "MIME-Version", "value": "1.0" }] }, "server": "abcd1234" } ``` ### Send an email `POST /api/messages?server=:server` You can only send emails to [verified external email address](/docs/managing-your-account/external-email-addresses). Supply the unique identifier for server you want to send from, as well as additional, relevant options. #### Parameters | Name | Type | Location | Required | Description | | --- | --- | --- | --- | --- | | server | string | query | Yes | The identifier of the server from which the email should be sent. | | to | string | body | Yes | The verified external email address to which the email should be sent. | | from | string | body | No | Optionally overrides of the message’s ‘from’ address. This **must** be an address ending with `YOUR_SERVER.mailosaur.net`, such as `my-emails @a1bcdef2.mailosaur.net`. | | subject | string | body | Yes | The subject line for an email. | | html | string | body | No | HTML content for the email. | | text | string | body | No | Plain text content for the email. | | send | boolean | body | No | If not `true`, then the email will be created in your server, but will not be sent. | | attachments | array | body | No | An object array of base64-encoded attachment objects (`fileName`, `contentType`, `content`). | #### Request ```curl curl \ -X POST \ -H 'Content-Type: application/json' \ -d '{"to":"someone@example.com","subject":"Email from Mailosaur","text":"Example","send":true}' \ -u api:YOUR_API_KEY \ https://mailosaur.com/api/messages?server=SERVER_ID ``` ```nodejs await mailosaur.messages.create('SERVER_ID', { to: 'someone@example.com', // must be a verified address subject: 'Email from Mailosaur', html: '

Hello world.

', send: true }); ``` ```cypress cy.mailosaurCreateMessage('SERVER_ID', { to: 'someone@example.com', // must be a verified address subject: 'Email from Mailosaur', html: '

Hello world.

', send: true }); ``` ```python recipient = "someone@example.com" # must be a verified address subject = "Email from Mailosaur" body = "

Hello world.

" options = MessageCreateOptions( recipient, True, subject, html=body) mailosaur.messages.create("SERVER_ID", options) ``` ```java MessageCreateOptions options = new MessageCreateOptions(); options.withTo("someone@example.com") // must be a verified address .withSubject("Email from Mailosaur") .withHtml("

Hello world.

") .withSend(true); mailosaur.messages().create("SERVER_ID", options); ``` ```dotnet mailosaur.Messages.Create("SERVER_ID", new MessageCreateOptions() { To = "someone@example.com", // must be a verified address Subject = "Email from Mailosaur", Html = "

Hello world.

", Send = true } ); ``` ```ruby options = Mailosaur::Models::MessageCreateOptions.new() options.to = 'someone@example.com' # must be a verified address options.subject = 'Email from Mailosaur' options.html = '

Hello world.

' options.send = true mailosaur.messages.create('SERVER_ID', options) ``` ```php $options = new MessageCreateOptions(); $options->to = 'someone@example.com'; // must be a verified address $options->subject = 'Email from Mailosaur'; $options->html = '

Hello world.

'; $options->send = TRUE; $mailosaur->messages->create('SERVER_ID', $options); ``` ```go m.Messages.Create("SERVER_ID", &MessageCreateOptions{ To: "someone@example.com", // must be a verified address Subject: "Email from Mailosaur", Html: "

Hello world.

", Send: true, }) ``` #### Response ```json { "id": "77061c9f-da47-4009-9f33-9715a3bbf00c", "received": "2019-08-06T17:44:07.197781+00:00", "type": "Email", "subject": "Email subject line", "from": [{ "name": "Acme", "email": "noreply@example.com" }], "to": [{ "name": "Jane Doe", "email": "janedoe@abc1234.mailosaur.net" }], "cc": [], "bcc": [], "html": { "links": [{ "href": "https://example.com/signup", "text": "Sign Up Now" }], "images": [], "body": "Lorem ipsum..." }, "text": { "links": [{ "href": "https://example.com/signup", "text": "https://example.com/signup" }], "body": "Lorem ipsum..." }, "attachments": [], "metadata": { "headers": [{ "field": "MIME-Version", "value": "1.0" }] }, "server": "abcd1234" } ``` ## Authenticator (2FA) The Authenticator (2FA devices) API allows you to generate one-time passwords (OTPs) and virtual security devices, for the purpose of testing authentication systems. ### Retrieve one-time password `POST /api/devices/otp` Retrieves the one-time password for a given base32-encoded secret. #### Parameters | Name | Type | Location | Required | Description | | --- | --- | --- | --- | --- | | sharedSecret | string | body | Yes | The base32-encoded shared secret to generate a one-time password for. | #### Request ```curl curl \ -X POST \ -H 'Content-Type: application/json' \ -d '{"sharedSecret":"ONSWG4TFOQYTEMY="}' \ -u api:YOUR_API_KEY \ https://mailosaur.com/api/devices/otp ``` ```nodejs const sharedSecret = 'ONSWG4TFOQYTEMY='; const currentOtp = await mailosaur.devices.otp(sharedSecret); console.log(currentOtp.code); // "564214" ``` ```cypress const sharedSecret = 'ONSWG4TFOQYTEMY='; cy.mailosaurGetDeviceOtp(sharedSecret) .then(currentOtp => { cy.log(currentOtp.code); // "564214" }); ``` ```python shared_secret = "ONSWG4TFOQYTEMY=" current_otp = mailosaur.devices.otp(shared_secret) print current_otp.code # "564214" ``` ```java String sharedSecret = "ONSWG4TFOQYTEMY="; String currentOtp = mailosaur.devices().otp(sharedSecret); System.out.println(currentOtp.code); // "564214" ``` ```dotnet var sharedSecret = "ONSWG4TFOQYTEMY="; var currentOtp = mailosaur.Devices.Otp(sharedSecret); Console.WriteLine(currentOtp.code); // "564214" ``` ```ruby shared_secret = 'ONSWG4TFOQYTEMY=' current_otp = mailosaur.devices.otp(shared_secret) print(current_otp.code) # "564214" ``` ```php $sharedSecret = 'ONSWG4TFOQYTEMY='; $currentOtp = $mailosaur->devices->otp($sharedSecret); print($currentOtp->code); // "564214" ``` ```go sharedSecret := "ONSWG4TFOQYTEMY=" currentOtp := m.Devices.Otp(sharedSecret) fmt.Println(currentOtp.Code) // "564214" ``` #### Response ```json { "code": "123456", "expires": "2022-01-01T00:00:00Z" } ``` ### List all devices `GET /api/devices` Returns a list of your virtual security devices. #### Request ```curl curl \ -u api:YOUR_API_KEY \ https://mailosaur.com/api/devices ``` ```nodejs const result = await mailosaur.devices.list(); console.log(result.items[0].name); // "Example" ``` ```cypress cy.mailosaurListDevices().then(result => { cy.log(result.items[0].name); // "Example" }); ``` ```python result = mailosaur.devices.list() print result.items[0].name # "Example" ``` ```java DeviceListResult result = mailosaur.devices().list(); ``` ```dotnet var result = mailosaur.Devices.List(); Console.WriteLine(result.Items[0].Name); // "Example" ``` ```ruby result = mailosaur.devices.list() print(result.items[0].name) # "Example" ``` ```php $result = $mailosaur->devices->all(); print($result->items[0]->name); // "Example" ``` ```go result := m.Devices.List() fmt.Println(result.Items[0].Name) // "Example" ``` #### Response ```json [ { "id": "abcd1234", "name": "Device name" } ] ``` ### Create a device `POST /api/devices` Creates a new virtual security device and returns it. #### Parameters | Name | Type | Location | Required | Description | | --- | --- | --- | --- | --- | | name | string | body | Yes | A name for the virtual device. | | sharedSecret | string | body | Yes | The base32-encoded shared secret to generate a one-time password for. | #### Request ```curl curl \ -X POST \ -H 'Content-Type: application/json' \ -d '{"name":"Example","sharedSecret":"ONSWG4TFOQYTEMY="}' \ -u api:YOUR_API_KEY \ https://mailosaur.com/api/devices ``` ```nodejs await mailosaur.devices.create({ name: 'Example', sharedSecret: 'ONSWG4TFOQYTEMY=' }); ``` ```cypress cy.mailosaurCreateDevice({ name: 'Example', sharedSecret: 'ONSWG4TFOQYTEMY=' }); ``` ```python name = "Example" shared_secret = "ONSWG4TFOQYTEMY=" options = DeviceCreateOptions(name, shared_secret) mailosaur.devices.create(options) ``` ```java DeviceCreateOptions options = new DeviceCreateOptions(); options.withName("Example") .withSharedSecret("ONSWG4TFOQYTEMY="); mailosaur.devices().create(options); ``` ```dotnet mailosaur.Devices.Create(new DeviceCreateOptions() { Name = "Example", SharedSecret = "ONSWG4TFOQYTEMY=" } ); ``` ```ruby options = Mailosaur::Models::DeviceCreateOptions.new() options.name = 'Example' options.shared_secret = 'ONSWG4TFOQYTEMY=' mailosaur.devices.create(options) ``` ```php $options = new DeviceCreateOptions(); $options->name = 'Example'; $options->sharedSecret = 'ONSWG4TFOQYTEMY='; $mailosaur->devices->create($options); ``` ```go m.Devices.Create(&DeviceCreateOptions{ Name: "Example", SharedSecret: "ONSWG4TFOQYTEMY=", }) ``` #### Response ```json { "id": "abcd1234", "name": "My device" } ``` ### Retrieve OTP for an existing device `GET /api/devices/:id/otp` Retrieves the current one-time password for an existing virtual security device. Simply supply the unique identifier for the required device. #### Parameters | Name | Type | Location | Required | Description | | --- | --- | --- | --- | --- | | id | string | path | Yes | The identifier of the device to be retrieved. | #### Request ```curl curl \ -u api:YOUR_API_KEY \ https://mailosaur.com/api/devices/DEVICE_ID/otp ``` ```nodejs const currentOtp = await mailosaur.devices.otp('DEVICE_ID'); console.log(currentOtp.code); // "564214" ``` ```cypress cy.mailosaurGetDeviceOtp('DEVICE_ID') .then(currentOtp => { cy.log(currentOtp.code); // "564214" }); ``` ```python current_otp = mailosaur.devices.otp("DEVICE_ID") print current_otp.code # "564214" ``` ```java String currentOtp = mailosaur.devices().otp("DEVICE_ID"); System.out.println(currentOtp.code); // "564214" ``` ```dotnet var currentOtp = mailosaur.Devices.Otp("DEVICE_ID"); Console.WriteLine(currentOtp.code); // "564214" ``` ```ruby current_otp = mailosaur.devices.otp('DEVICE_ID') print(current_otp.code) # "564214" ``` ```php $currentOtp = $mailosaur->devices->otp('DEVICE_ID'); print($currentOtp->code); // "564214" ``` ```go currentOtp := m.Devices.Otp("DEVICE_ID") fmt.Println(currentOtp.Code) // "564214" ``` #### Response ```json { "code": "123456", "expires": "2022-01-01T00:00:00Z" } ``` ### Delete a device `DELETE /api/devices/:id` Permanently deletes a device. This operation cannot be undone. #### Parameters | Name | Type | Location | Required | Description | | --- | --- | --- | --- | --- | | id | string | path | Yes | The identifier of the device to be deleted. | #### Request ```curl curl \ -X DELETE \ -u api:YOUR_API_KEY \ https://mailosaur.com/api/devices/DEVICE_ID ``` ```nodejs await mailosaur.devices.del('DEVICE_ID'); ``` ```cypress cy.mailosaurDeleteDevice('DEVICE_ID'); ``` ```python mailosaur.devices.delete("DEVICE_ID") ``` ```java mailosaur.devices().delete("DEVICE_ID"); ``` ```dotnet mailosaur.Devices.Delete("DEVICE_ID"); ``` ```ruby mailosaur.devices.delete('DELETE_ID') ``` ```php $mailosaur->devices->delete('DEVICE_ID'); ``` ```go m.Devices.Delete("DEVICE_ID") ``` ## Files The Files API allows you to download files, such as message attachments, from Mailosaur. ### Download an attachment `GET /api/files/attachments/:id` Downloads a single attachment. Simply supply the unique identifier for the required attachment. #### Parameters | Name | Type | Location | Required | Description | | --- | --- | --- | --- | --- | | id | string | path | Yes | The identifier of the attachment to be downloaded. | #### Request ```curl curl \ -o example.png \ -u api:YOUR_API_KEY \ https://mailosaur.com/api/files/attachments/ATTACHMENT_ID ``` ```nodejs const fs = require('fs'); // ... const file = await mailosaur.files.getAttachment('ATTACHMENT_ID'); fs.writeFileSync('example.png', file); ``` ```cypress cy.mailosaurDownloadAttachment('ATTACHMENT_ID').then(file => { cy.writeFile('example.png', file, 'binary') }) ``` ```python file = mailosaur.files.get_attachment('ATTACHMENT_ID').content f = open('example.png', 'wb') f.write(file) f.close() ``` ```java byte[] file = mailosaur.files().getAttachment("ATTACHMENT_ID"); Files.write(Paths.get("example.png"), file); ``` ```dotnet var file = mailosaur.Files.GetAttachment("ATTACHMENT_ID"); File.WriteAllBytes("example.png", file); ``` ```ruby file = mailosaur.files.get_attachment('ATTACHMENT_ID') File.open(first_attachment.file_name, 'wb') { |fp| fp.write(file) } ``` ```php $file = $mailosaur->files->getAttachment("ATTACHMENT_ID"); $f = fopen("example.png", "w") or die("Unable to open file!"); fwrite($f, $file); fclose($f); ``` ```go var file, _ = m.Files.GetAttachment("ATTACHMENT_ID") var err = os.WriteFile("example.png", file, 0644) if err != nil { // handle error } ``` ### Download EML `GET /api/files/email/:id` Downloads an EML file representing the specified email. Simply supply the unique identifier for the required email. #### Parameters | Name | Type | Location | Required | Description | | --- | --- | --- | --- | --- | | id | string | path | Yes | The identifier of the email to be downloaded. | #### Request ```curl curl \ -o example.eml \ -u api:YOUR_API_KEY \ https://mailosaur.com/api/files/email/MESSAGE_ID ``` ```nodejs const fs = require('fs'); // ... const file = await mailosaur.files.getEmail('MESSAGE_ID'); fs.writeFileSync('example.eml', file); ``` ```cypress cy.mailosaurDownloadMessage('MESSAGE_ID').then(file => { cy.writeFile('example.eml', file, 'binary') }) ``` ```python file = mailosaur.files.get_email('MESSAGE_ID').content f = open('example.eml', 'wb') f.write(file) f.close() ``` ```java byte[] file = mailosaur.files().getEmail("MESSAGE_ID"); Files.write(Paths.get("example.eml"), file); ``` ```dotnet var file = mailosaur.Files.GetEmail("MESSAGE_ID"); File.WriteAllBytes("example.eml", file); ``` ```ruby file = mailosaur.files.get_email('MESSAGE_ID') File.open(first_attachment.file_name, 'wb') { |fp| fp.write(file) } ``` ```php $file = $mailosaur->files->getEmail("MESSAGE_ID"); $f = fopen("example.eml", "w") or die("Unable to open file!"); fwrite($f, $file); fclose($f); ``` ```go var file, _ = m.Files.GetEmail("MESSAGE_ID") var err = os.WriteFile("example.eml", file, 0644) if err != nil { // handle error } ``` ## Analysis The Analysis API allows you to analyse messages in more detail. For example, running a SpamAssassin report. ### Perform a deliverability check `GET /api/analysis/deliverability/:id` Generates a a deliverability report for the specified email. The domain of the sender is checked to ensure the deliverability of the email. Content of the email is also checked to highlight issues that may cause the email to be marked as illegitimate. Content is also checked via SpamAssassin which is one of the most common spam checkers on the market, these results can be used to understand how common spam checkers will view your email. #### Parameters | Name | Type | Location | Required | Description | | --- | --- | --- | --- | --- | | id | string | path | Yes | The identifier of the email to be analyzed. | #### Request ```curl curl \ -u api:YOUR_API_KEY \ https://mailosaur.com/api/analysis/deliverability/MESSAGE_ID ``` ```nodejs const result = await mailosaur.analysis.deliverability(message.id) console.log(result.spf.result) // "Pass" result.spamAssassin.forEach(r => { console.log(r.rule) console.log(r.description) console.log(r.score) }) ``` ```cypress cy.mailosaurGetDeliverabilityReport().then(result => { cy.log(result.spf.result) // "Pass" result.spamAssassin.forEach(r => { cy.log(r.rule) cy.log(r.description) cy.log(r.score) }) }) ``` ```python result = mailosaur.analysis.deliverability(message.id) print(result.spf.result) // "Pass" for r in result.spam_assassin: print(r.rule) print(r.description) print(r.score) ``` ```java DeliverabilityReport result = client.analysis().deliverability(message.id()); System.out.println(result.spf().result()); // "Pass" for (SpamAssassinRule rule : result.spamFilterResults().spamAssassin()) { System.out.println(rule.rule()); System.out.println(rule.description()); } ``` ```dotnet var result = mailosaur.Analysis.Deliverability(message.Id); Console.WriteLine(result.spf.result) // "Pass" foreach (var r in result.SpamAssassin) { Console.WriteLine(r.Rule); Console.WriteLine(r.Description); Console.WriteLine(r.Score); } ``` ```ruby result = mailosaur.analysis.deliverability(message.id) puts(result.spf.result) // "Pass" for r in result.spam_assassin do puts(r.rule) puts(r.description) puts(r.score) end ``` ```php $result = $mailosaur->analysis->deliverability($message->id); print($result->spf->result) // "Pass" foreach ($result->spamAssassin as &$r) { print($r->rule); print($r->description); print($r->score); } ``` ```go result, _ := m.Analysis.Deliverability(message.Id) fmt.Println(result.Spf.Result) // "Pass" for _, r := range result.SpamAssassin { fmt.Println(r.Rule) fmt.Println(r.Description) fmt.Println(r.Score) } ``` ```swift let result = try await EmailsTestsSetup.client.analysis.deliverability(email: message.id) print(result.spf?.result) // "Pass" for rule in result.spamAssassin { print(rule.rule) print(rule.description) print(rule.score) } ``` #### Response ```json { "spf": { "result": "Pass", "description": null, "rawValue": null, "tags": {} }, "dkim": [ { "result": "Pass", "description": null, "rawValue": null, "tags": {} } ], "dmarc": { "result": "Pass", "description": null, "rawValue": "v=DMARC1; p=reject; rua=mailto:dmarc@abc1234.mailosaur.net;", "tags": { "v": "DMARC1", "p": "reject", "rua": "mailto:dmarc@abc1234.mailosaur.net" } }, "blockLists": [ { "id": "ABC123", "name": "ABC", "result": "Pass" }, { "id": "DEF123", "name": "DEF", "result": "Warning" }, { "id": "GHI123", "name": "GHI", "result": "Fail" }, ], "content": { "embed": false, "iframe": false, "object": false, "script": false, "shortUrls": false, "textSize": 123, "totalSize": 3456, "missingAlt": false, "missingListUnsubscribe": false }, "dnsRecords": { "a": [ "mailosaur.net. 30 IN A 192.168.1.1" ], "mx": [ "mailosaur.net. 30 IN MX 0 mailosaur.net." ], "ptr": [] }, "spamAssassin": { "score": 0, "result": "Pass", "rules": [ { "score": 0.0, "rule": "ABC123", "description": "ABC123" } ] } } ``` ## Email Previews The Previews API lets you generate previews of an email in real email clients and devices, then download each preview as an image. To use it in an automated test, see [Automate email previews](/docs/email-previews/automate-previews). The Previews API is available on the Core and Enterprise plans with the Email Previews add-on. It is not available during a free trial. ### List email clients `GET /api/screenshots/clients` Lists the email clients and devices you can generate previews in. Use the `label` of a client to choose it when you [generate email previews](#generate-email-previews). Each label is made up of the device, the email client, light or dark mode, and the orientation. For example, `iphone-16-applemail-darkmode-portrait`. For a readable list, see [Supported email clients and devices](/docs/email-previews/supported-clients). #### Request ```curl curl \ -u api:YOUR_API_KEY \ https://mailosaur.com/api/screenshots/clients ``` ```nodejs const result = await mailosaur.previews.listEmailClients(); ``` ```cypress cy.mailosaurListPreviewEmailClients().then(result => { cy.log(result.items[0].label) }) ``` ```python result = mailosaur.previews.list_email_clients() ``` ```java EmailClientListResult result = mailosaur.previews().listEmailClients(); ``` ```dotnet var result = mailosaur.Previews.ListEmailClients(); ``` ```ruby result = mailosaur.previews.list_email_clients() ``` ```php $result = $mailosaur->previews->allEmailClients(); ``` ```go result, _ := m.Previews.ListEmailClients() ``` #### Response ```json { "items": [ { "label": "windows-outlook-lightmode-landscape", "name": "Windows Outlook Light Mode Landscape" }, { "label": "iphone-16-applemail-darkmode-portrait", "name": "iPhone 16 Apple Mail Dark Mode Portrait" }, { "label": "android-15-gmail-lightmode-portrait", "name": "Android 15 Gmail Light Mode Portrait" } ] } ``` ### Generate email previews `POST /api/messages/:id/screenshots` Generates previews of an email in the email clients you choose. Each preview uses one credit from your monthly limit. See [Usage limits](/docs/managing-your-account/usage-limits). The response lists one preview for each email client. Previews take a short time to render, so a new preview has a `status` of `Pending`. To wait for a preview and download it, see [Download an email preview](#download-an-email-preview). The request fails with a `400` error, and generates no previews, if: - An email client label is not valid. The error suggests a valid label where it can. - The previews would take you over your monthly limit. #### Parameters | Name | Type | Location | Required | Description | | --- | --- | --- | --- | --- | | id | string | path | Yes | The identifier of the email to preview. This can be found via other API calls such as Search for messages. | | emailClients | array | body | Yes | The labels of the email clients to generate previews in. To find the labels, use List email clients. | #### Request ```curl curl \ -X POST \ -H 'Content-Type: application/json' \ -d '{"emailClients":["iphone-16-applemail-darkmode-portrait","windows-outlook-lightmode-landscape"]}' \ -u api:YOUR_API_KEY \ https://mailosaur.com/api/messages/MESSAGE_ID/screenshots ``` ```nodejs // MESSAGE_ID: The `id` of the email you want to preview const result = await mailosaur.messages.generatePreviews('MESSAGE_ID', { emailClients: [ 'iphone-16-applemail-darkmode-portrait', 'windows-outlook-lightmode-landscape' ] }); ``` ```cypress // MESSAGE_ID: The `id` of the email you want to preview cy.mailosaurGenerateEmailPreviews('MESSAGE_ID', { emailClients: [ 'iphone-16-applemail-darkmode-portrait', 'windows-outlook-lightmode-landscape' ] }).then(result => { cy.log(result.items[0].id) }) ``` ```python options = PreviewRequestOptions([ "iphone-16-applemail-darkmode-portrait", "windows-outlook-lightmode-landscape" ]) # MESSAGE_ID: The `id` of the email you want to preview result = mailosaur.messages.generate_previews("MESSAGE_ID", options) ``` ```java PreviewRequestOptions options = new PreviewRequestOptions(); options.withEmailClients(Arrays.asList( "iphone-16-applemail-darkmode-portrait", "windows-outlook-lightmode-landscape" )); // MESSAGE_ID: The `id` of the email you want to preview PreviewListResult result = mailosaur.messages().generatePreviews("MESSAGE_ID", options); ``` ```dotnet var options = new PreviewRequestOptions(new List { "iphone-16-applemail-darkmode-portrait", "windows-outlook-lightmode-landscape" }); // MESSAGE_ID: The `id` of the email you want to preview var result = mailosaur.Messages.GeneratePreviews("MESSAGE_ID", options); ``` ```ruby options = Mailosaur::Models::PreviewRequestOptions.new([ 'iphone-16-applemail-darkmode-portrait', 'windows-outlook-lightmode-landscape' ]) # MESSAGE_ID: The `id` of the email you want to preview result = mailosaur.messages.generate_previews('MESSAGE_ID', options) ``` ```php $options = new PreviewRequestOptions(array( 'iphone-16-applemail-darkmode-portrait', 'windows-outlook-lightmode-landscape' )); // MESSAGE_ID: The `id` of the email you want to preview $result = $mailosaur->messages->generatePreviews('MESSAGE_ID', $options); ``` ```go // MESSAGE_ID: The `id` of the email you want to preview result, _ := m.Messages.GeneratePreviews("MESSAGE_ID", &PreviewRequestOptions{ EmailClients: []string{ "iphone-16-applemail-darkmode-portrait", "windows-outlook-lightmode-landscape", }, }) ``` #### Response ```json { "items": [ { "id": "0a9c7f44-6b3e-4d2c-9a43-1f8e2b5d7c61", "emailClient": "iphone-16-applemail-darkmode-portrait", "creationDate": "2026-12-02T10:15:30.123Z", "stale": false, "status": "Pending", "sourceId": "77061c9f-da47-4009-9f33-9715a3bbf00c" }, { "id": "5e2d8b17-93fa-4c06-b8d1-6a4f0c9e3b52", "emailClient": "windows-outlook-lightmode-landscape", "creationDate": "2026-12-02T10:15:30.123Z", "stale": false, "status": "Pending", "sourceId": "77061c9f-da47-4009-9f33-9715a3bbf00c" } ] } ``` ### Download an email preview `GET /api/files/screenshots/:id` Downloads a preview as a PNG image. Supply the `id` of a preview from the response when you [generate email previews](#generate-email-previews). While the preview is still rendering, the API returns `202 Accepted`. Wait a moment, then try again. If Mailosaur could not generate the preview, the API returns `410 Gone`. Our [client libraries](/docs/automation) wait up to 2 minutes for the preview to finish rendering, then return the image. If the preview is not ready in that time, they return an error with the type `preview_timeout`. #### Parameters | Name | Type | Location | Required | Description | | --- | --- | --- | --- | --- | | id | string | path | Yes | The identifier of the preview to be downloaded. | #### Request ```curl curl \ -o preview.png \ -u api:YOUR_API_KEY \ https://mailosaur.com/api/files/screenshots/PREVIEW_ID ``` ```nodejs const fs = require('fs'); // ... const file = await mailosaur.files.getPreview('PREVIEW_ID'); fs.writeFileSync('preview.png', file); ``` ```cypress cy.mailosaurDownloadPreview('PREVIEW_ID').then(file => { cy.writeFile('preview.png', file, 'binary') }) ``` ```python file = mailosaur.files.get_preview('PREVIEW_ID').content f = open('preview.png', 'wb') f.write(file) f.close() ``` ```java byte[] file = mailosaur.files().getPreview("PREVIEW_ID"); Files.write(Paths.get("preview.png"), file); ``` ```dotnet var file = mailosaur.Files.GetPreview("PREVIEW_ID"); File.WriteAllBytes("preview.png", file); ``` ```ruby file = mailosaur.files.get_preview('PREVIEW_ID') File.open('preview.png', 'wb') { |fp| fp.write(file) } ``` ```php $file = $mailosaur->files->getPreview("PREVIEW_ID"); $f = fopen("preview.png", "wb") or die("Unable to open file!"); fwrite($f, $file); fclose($f); ``` ```go var file, _ = m.Files.GetPreview("PREVIEW_ID") var err = os.WriteFile("preview.png", file, 0644) if err != nil { // handle error } ``` ## Inboxes (servers) The Servers API allows you to list, view, create, and modify the servers (inboxes) that store your email and SMS messages. ### List all servers `GET /api/servers` Returns a list of your virtual SMTP servers. Servers are returned sorted in alphabetical order. #### Request ```curl curl \ -u api:YOUR_API_KEY \ https://mailosaur.com/api/servers ``` ```nodejs const result = await mailosaur.servers.list(); console.log(result.items[0].name); // "Example" ``` ```cypress cy.mailosaurListServers().then(result => { cy.log(result.items[0].name); // "Example" }); ``` ```python result = mailosaur.servers.list() print result.items[0].name # "Example" ``` ```java ServerListResult result = mailosaur.servers().list(); ``` ```dotnet var result = mailosaur.Servers.List(); Console.WriteLine(result.Items[0].Name); // "Example" ``` ```ruby result = mailosaur.servers.list() print(result.items[0].name) # "Example" ``` ```php $result = $mailosaur->servers->all(); print($result->items[0]->name); // "Example" ``` ```go result := m.Servers.List() fmt.Println(result.Items[0].Name) // "Example" ``` #### Response ```json [ { "id": "abcd1234", "name": "Server name", "users": [], "messages": 16 } ] ``` ### Create a server `POST /api/servers` Creates a new virtual SMTP server and returns it. #### Parameters | Name | Type | Location | Required | Description | | --- | --- | --- | --- | --- | | name | string | body | Yes | The name of the server. | #### Request ```curl curl \ -X POST \ -H 'Content-Type: application/json' \ -d '{"name":"Example"}' \ -u api:YOUR_API_KEY \ https://mailosaur.com/api/servers ``` ```nodejs await mailosaur.servers.create({ name: 'Example' }); ``` ```cypress cy.mailosaurCreateServer({ name: 'Example' }); ``` ```python name = "Example" options = ServerCreateOptions(name) mailosaur.servers.create(options) ``` ```java ServerCreateOptions options = new ServerCreateOptions(); options.withName("Example"); mailosaur.servers().create(options); ``` ```dotnet mailosaur.Servers.Create(new ServerCreateOptions() { Name = "Example" } ); ``` ```ruby options = Mailosaur::Models::ServerCreateOptions.new() options.name = 'Example' mailosaur.servers.create(options) ``` ```php $options = new ServerCreateOptions(); $options->name = 'Example'; $mailosaur->servers->create($options); ``` ```go m.Servers.Create(&ServerCreateOptions{ Name: "Example", }) ``` #### Response ```json { "id": "abcd1234", "name": "Server name", "users": [], "messages": 0 } ``` ### Retrieve a server `GET /api/servers/:id` Retrieves the detail for a single server. Simply supply the unique identifier for the required server. #### Parameters | Name | Type | Location | Required | Description | | --- | --- | --- | --- | --- | | id | string | path | Yes | The identifier of the server to be retrieved. | #### Request ```curl curl \ -u api:YOUR_API_KEY \ https://mailosaur.com/api/servers/SERVER_ID ``` ```nodejs const server = await mailosaur.servers.get('SERVER_ID'); ``` ```cypress cy.mailosaurGetServer('SERVER_ID') .then(server => { cy.log(server.name); // "Example" }); ``` ```python server = mailosaur.servers.get("SERVER_ID") ``` ```java Server server = mailosaur.servers().get("SERVER_ID"); ``` ```dotnet var server = mailosaur.Servers.Get("SERVER_ID"); ``` ```ruby server = mailosaur.servers.get('SERVER_ID') ``` ```php $server = $mailosaur->servers->get('SERVER_ID'); ``` ```go server := m.Servers.Get("SERVER_ID") ``` #### Response ```json { "id": "abcd1234", "name": "Server name", "users": [], "messages": 0 } ``` ### Retrieve server password `GET /api/servers/:id/password` Retrieves the password, for use with SMTP and POP3, for a single server. Simply supply the unique identifier for the required server. #### Parameters | Name | Type | Location | Required | Description | | --- | --- | --- | --- | --- | | id | string | path | Yes | The identifier of the server. | #### Request ```curl curl \ -u api:YOUR_API_KEY \ https://mailosaur.com/api/servers/SERVER_ID/password ``` ```nodejs const password = await mailosaur.servers.getPassword('SERVER_ID'); ``` ```cypress cy.mailosaurGetServerPassword('SERVER_ID').then(password => { cy.log(password); }); ``` ```python password = mailosaur.servers.get_password("SERVER_ID") ``` ```java String password = mailosaur.servers().getPassword("SERVER_ID"); ``` ```dotnet var password = mailosaur.Servers.GetPassword("SERVER_ID"); ``` ```ruby password = mailosaur.servers.get_password('SERVER_ID') ``` ```php $password = $mailosaur->servers->getPassword('SERVER_ID'); ``` ```go password, err := m.Servers.GetPassword("SERVER_ID") ``` #### Response ```json { "value": "server-password" } ``` ### Update a server `PUT /api/servers/:id` Updates a single server and returns it. #### Parameters | Name | Type | Location | Required | Description | | --- | --- | --- | --- | --- | | id | string | path | Yes | The identifier of the server to be updated. | | name | string | body | Yes | The name of the server. | #### Request ```curl curl \ -X PUT \ -H 'Content-Type: application/json' \ -d '{"name":"Updated server name"}' \ -u api:YOUR_API_KEY \ https://mailosaur.com/api/servers/SERVER_ID ``` ```nodejs await mailosaur.servers.update('SERVER_ID', { name: 'Updated server name' }); ``` ```cypress cy.mailosaurUpdateServer('SERVER_ID', { name: 'Updated server name' }); ``` ```python retrieved_server = mailosaur.servers.get("SERVER_ID") retrieved_server.name = "Updated server name" mailosaur.servers.update(retrieved_server.id, retrieved_server) ``` ```java Server retrievedServer = mailosaur.servers().get("SERVER_ID"); retrievedServer.withName("Updated server name"); mailosaur.servers().update(retrievedServer.id(), retrievedServer); ``` ```dotnet var retrievedServer = mailosaur.Servers.Get("SERVER_ID"); retrievedServer.Name = "Updated server name"; mailosaur.Servers.Update(retrievedServer.Id, retrievedServer); ``` ```ruby retrieved_server = mailosaur.servers.get("SERVER_ID") retrieved_server.name = "Updated server name" mailosaur.servers.update(retrieved_server.id, retrieved_server) ``` ```php $retrievedServer = $mailosaur->servers->get('SERVER_ID'); $retrievedServer->name = 'Updated server name'; $mailosaur->servers->update($retrievedServer->id, $retrievedServer); ``` ```go retrievedServer, err := m.Servers.Get("SERVER_ID") if (err != nil) { // Handle err } retrievedServer.Name = "Updated server name" m.Servers.Update(retrievedServer.Id, retrievedServer); ``` #### Response ```json { "id": "abcd1234", "name": "Server name", "users": [], "messages": 0 } ``` ### Delete a server `DELETE /api/servers/:id` Permanently deletes a server. This operation cannot be undone. Also deletes all messages and associated attachments within the server. #### Parameters | Name | Type | Location | Required | Description | | --- | --- | --- | --- | --- | | id | string | path | Yes | The identifier of the server to be deleted. | #### Request ```curl curl \ -X DELETE \ -u api:YOUR_API_KEY \ https://mailosaur.com/api/servers/SERVER_ID ``` ```nodejs await mailosaur.servers.del('SERVER_ID'); ``` ```cypress cy.mailosaurDeleteServer('SERVER_ID'); ``` ```python mailosaur.servers.delete("SERVER_ID") ``` ```java mailosaur.servers().delete("SERVER_ID"); ``` ```dotnet mailosaur.Servers.Delete("SERVER_ID"); ``` ```ruby mailosaur.servers.delete('SERVER_ID') ``` ```php $mailosaur->servers->delete('SERVER_ID'); ``` ```go m.Servers.Delete("SERVER_ID") ``` ## Usage The Usage API allows you to view your account limits, as well as list usage history to better understand how your Mailosaur account is utilized. ### Retrieve account limits `GET /api/usage/limits` Retrieve account usage limits. Details the current limits and usage for your account. This endpoint requires authentication with an account-level API key. #### Request ```curl curl \ -u api:YOUR_API_KEY \ https://mailosaur.com/api/usage/limits ``` ```nodejs const limits = await mailosaur.usage.limits(); ``` ```cypress cy.mailosaurGetSpamAnalysis().then(limits => { cy.log(limits) }) ``` ```python limits = mailosaur.usage.limits() ``` ```java UsageAccountLimits limits = mailosaur.usage().limits(); ``` ```dotnet var limits = mailosaur.Usage.Limits(); ``` ```ruby limits = mailosaur.usage.limits() ``` ```php $limits = $mailosaur->usage->limits(); ``` ```go limits, _ := m.Usage.Limits() ``` #### Response ```json { "servers": { "current": 27, "limit": 50 }, "users": { "current": 16, "limit": 25 }, "email": { "current": 12356, "limit": 20000 }, "sms": { "current": 271, "limit": 500 }, "previews": { "current": 89, "limit": 200 }, "numbers": { "current": 2, "limit": 5 } } ``` ### List usage transactions `GET /api/usage/transactions` Retrieves the last 31 days of transactional usage. This endpoint requires authentication with an account-level API key. #### Request ```curl curl \ -u api:YOUR_API_KEY \ https://mailosaur.com/api/usage/transactions ``` ```nodejs const limits = await mailosaur.usage.transactions(); ``` ```cypress cy.mailosaurGetSpamAnalysis().then(transactions => { cy.log(transactions) }) ``` ```python limits = mailosaur.usage.transactions() ``` ```java UsageTransactionListResult limits = mailosaur.usage().transactions(); ``` ```dotnet var limits = mailosaur.Usage.Transactions(); ``` ```ruby limits = mailosaur.usage.transactions() ``` ```php $limits = $mailosaur->usage->transactions(); ``` ```go limits, _ := m.Usage.Transactions() ``` #### Response ```json { "items": [ { "timestamp": "2021-01-31T00:00:00Z", "email": 2000, "sms": 51, "previews": 0 } ] } ``` --- Source: https://mailosaur.com/docs/authenticator # Authenticator (TOTP) testing The Mailosaur authenticator is a virtual TOTP (Time-based One-Time Password) generator. It works like Google Authenticator or similar apps, but runs entirely within Mailosaur — no physical phone or app is required. The authenticator generates standard 6-digit codes on a 30-second time step. It requires a **Core** plan or above. ## Why use the authenticator The authenticator lets you test MFA (multi-factor authentication) and 2FA (two-factor authentication) flows in your applications. Instead of requiring a tester to manually read a 6-digit code from a phone app, Mailosaur generates the code programmatically. ## Two approaches ### 1. Create a device (long-lived) Create an authenticator device in the Mailosaur UI, similar to adding an account to Google Authenticator. The device stores the shared secret and generates TOTP codes on demand. You can set up a device by: - [Uploading a QR code](/docs/authenticator/create-and-delete-devices#upload-a-qr-code) image - [Entering a key manually](/docs/authenticator/create-and-delete-devices#enter-a-key-manually) (the shared secret) ### 2. Get a code via the API (one-time) If you have the shared secret available in your test (for example, from a test setup step), you can call the Mailosaur API directly to get the current 6-digit OTP code. This approach does not require creating a device — you pass the shared secret in the API call and receive the current code. See [Get the current code via API](/docs/authenticator/automate-totp-testing). ## Related pages - [Create a device](/docs/authenticator/create-and-delete-devices) - [Upload a QR code](/docs/authenticator/create-and-delete-devices#upload-a-qr-code) - [Enter a key manually](/docs/authenticator/create-and-delete-devices#enter-a-key-manually) - [Delete a device](/docs/authenticator/create-and-delete-devices#delete-a-device) - [Get the current code via API](/docs/authenticator/automate-totp-testing) --- Source: https://mailosaur.com/docs/authenticator/automate-totp-testing # Automating TOTP tests You can retrieve the current 6-digit TOTP code directly from the Mailosaur API by passing a shared secret. This approach does not require creating a device — it is ideal for automated tests where you have the shared secret available. ## How it works 1. Your application or test generates a shared secret during MFA setup. 2. You pass the shared secret to the Mailosaur API. 3. The API returns the current 6-digit TOTP code. 4. Your test enters the code into the application. For the full endpoint details, request format, and response schema, see [Retrieve an OTP code](/docs/api#retrieve-otp-for-an-existing-device) in the API reference. ## When to use this approach Use the API approach when: - You have access to the shared secret in your test code (for example, from a seeded test account) - You want to avoid creating and managing devices - You need a single code for a one-off verification Use [a device](/docs/authenticator/create-and-delete-devices) instead when: - You need a persistent authenticator that multiple team members can access in the Dashboard - You do not have programmatic access to the shared secret --- Source: https://mailosaur.com/docs/authenticator/create-and-delete-devices # Create and delete TOTP devices An authenticator device stores a shared secret and generates TOTP codes on demand. Creating a device is like adding an account to Google Authenticator. ## Before you get started Authenticator devices belong to a [project](/docs/projects). The **Authenticator** screen shows the devices in the project you are working in, and a new device belongs to that project. To add or delete a device you must be an **Editor** or **Admin** of that project, or an Account Administrator. Project **Viewers** can read the codes from existing devices. ## Steps 1. Navigate to the **Authenticator**. 2. Click **Add new device**. 3. Set up the device using one of two methods: ### Upload a QR code Upload an image of the QR code from your application's MFA setup page. Mailosaur extracts the shared secret from the QR code automatically. 1. Select the **Upload QR code** option. 2. Upload or drag and drop a PNG or JPG image containing the QR code (maximum 2 MB). For example, a screenshot from your application's MFA setup page. 3. Mailosaur extracts the shared secret and configures the device automatically. 4. Enter a name for the device. 5. Click **Create**. If the QR code cannot be read, an error is displayed. Try again with a higher-quality image, or [enter the key manually](#enter-a-key-manually) instead. ### Enter a key manually Enter the shared secret (also known as the setup key or secret key) directly. This is useful when you have the shared secret as text rather than a QR code. 1. Select the **Enter key manually** option. 2. Enter the base32-encoded shared secret provided by your application during MFA setup (for example, `JBSWY3DPEHPK3PXP`). 3. Enter a name for the device. 4. Click **Create**. Once created, the device displays the current 6-digit TOTP code, which refreshes automatically. The device name cannot be changed after creation. ## Delete a device 1. Navigate to **Authenticator**. 2. Find the device you want to remove. 3. Click the **...** actions menu. 4. Click **Delete**. 5. Confirm the deletion by clicking **Delete** again. The device is permanently removed and can no longer generate TOTP codes. If you need the device again, you must create a new one with the original shared secret. You can also delete a device via the [API](/docs/api). --- Source: https://mailosaur.com/docs/automation # Automation Create automated end-to-end tests with Mailosaur. You can integrate Mailosaur into any testing framework or project, regardless of the programming language it's written in. This is because we've crafted a set of official API client libraries for everything from Node.js to .NET, plus plugins for popular testing software like Cypress. If you're unsure how to get started, [get in touch](/contact). ## Get started - [Playwright](/docs/automation/playwright) - [Cypress](/docs/automation/cypress) - [Selenium](/docs/automation/selenium) - [Robot Framework](/docs/automation/robot-framework) - [Postman](/docs/automation/postman) - [Node.js](/docs/automation/nodejs) - [Java](/docs/automation/java) - [.NET](/docs/automation/dotnet) - [Python](/docs/automation/python) ## See also - [API reference](/docs/api) --- Source: https://mailosaur.com/docs/automation/attachments # Email attachments Learn how to test the email attachments with Mailosaur. ## Before you begin The examples shown below are based on two key assumptions: 1. You have already created a basic automated test using our [getting started guides](/docs/automation). 2. You have a chosen assertion library that you will use to test the values shown below. ## How many attachments The `attachments` property of a message contains an array of attachments. The length of this array corresponds to the number of files attached to the email. ```nodejs console.log(message.attachments.length) // 2 ``` ```python print(len(message.attachments)) # 2 ``` ```java System.out.println(message.attachments().size()); // 2 ``` ```csharp Console.WriteLine(message.Attachments.Count); // 2 ``` ```ruby puts(message.attachments.length) # 2 ``` ```php print(count($message->attachments)); // 2 ``` ```go fmt.Println(len(message.Attachments)) // 2 ``` ## Testing the file name and content type Each attachment contains metadata on the file name and content type. ```nodejs const firstAttachment = message.attachments[0] console.log(firstAttachment.fileName) // "contract.pdf" console.log(firstAttachment.contentType) // "application/pdf" ``` ```python first_attachment = message.attachments[0] print(first_attachment.file_name) # "contract.pdf" print(first_attachment.content_type) # "application/pdf" ``` ```java Attachment firstAttachment = message.attachments().get(0); System.out.println(firstAttachment.fileName()); // "contract.pdf" System.out.println(firstAttachment.contentType()); // "application/pdf" ``` ```csharp var firstAttachment = message.Attachments[0]; Console.WriteLine(firstAttachment.FileName); // "contract.pdf" Console.WriteLine(firstAttachment.ContentType); // "application/pdf" ``` ```ruby first_attachment = message.attachments[0] puts(first_attachment.file_name) # "contract.pdf" puts(first_attachment.content_type) # "application/pdf" ``` ```php $firstAttachment = $message->attachments[0]; print($firstAttachment->fileName); // "contract.pdf" print($firstAttachment->contentType); // "application/pdf" ``` ```go var firstAttachment = message.Attachments[0] fmt.Println(firstAttachment.FileName) // "contract.pdf" fmt.Println(firstAttachment.ContentType) // "application/pdf" ``` ## Testing attachment file size The `length` property returns the size of the attached file (in bytes). ```nodejs const firstAttachment = message.attachments[0] console.log(firstAttachment.length) // 4028 ``` ```python first_attachment = message.attachments[0] print(first_attachment.length) # 4028 ``` ```java Attachment firstAttachment = message.attachments().get(0); System.out.println(firstAttachment.length()); // 4028 ``` ```csharp var firstAttachment = message.Attachments[0]; Console.WriteLine(firstAttachment.Length); // 4028 ``` ```ruby first_attachment = message.attachments[0] puts(first_attachment.length) # 4028 ``` ```php $firstAttachment = $message->attachments[0]; print($firstAttachment->length); // 4028 ``` ```go var firstAttachment = message.Attachments[0] fmt.Println(firstAttachment.Length) // 4028 ``` ## Embedded Images If an email contains [embedded images](/docs/automation/images#6-embedded-images) then the `contentId` attribute will be populated and will have a corresponding entry in the [images array](/docs/automation/images#6-embedded-images). ```nodejs const firstAttachment = message.attachments[0] console.log(firstAttachment.fileName) // "contract.pdf" console.log(firstAttachment.contentType) // "application/pdf" ``` ```python first_attachment = message.attachments[0] print(first_attachment.file_name) # "contract.pdf" print(first_attachment.content_type) # "application/pdf" ``` ```java Attachment firstAttachment = message.attachments().get(0); System.out.println(firstAttachment.fileName()); // "contract.pdf" System.out.println(firstAttachment.contentType()); // "application/pdf" ``` ```csharp var firstAttachment = message.Attachments[0]; Console.WriteLine(firstAttachment.FileName); // "contract.pdf" Console.WriteLine(firstAttachment.ContentType); // "application/pdf" ``` ```ruby first_attachment = message.attachments[0] puts(first_attachment.file_name) # "contract.pdf" puts(first_attachment.content_type) # "application/pdf" ``` ```php $firstAttachment = $message->attachments[0]; print($firstAttachment->fileName); // "contract.pdf" print($firstAttachment->contentType); // "application/pdf" ``` ```go var firstAttachment = message.Attachments[0] fmt.Println(firstAttachment.FileName) // "contract.pdf" fmt.Println(firstAttachment.ContentType) // "application/pdf" ``` ## Testing content ID The `contentId` property identifies embedded attachments within an email. ```nodejs const firstAttachment = message.attachments[0] console.log(firstAttachment.contentId) // "ii_1435fadb31d523f6" ``` ```python first_attachment = message.attachments[0] print(first_attachment.content_id) # "ii_1435fadb31d523f6" ``` ```java Attachment firstAttachment = message.attachments().get(0); System.out.println(firstAttachment.contentId()); // "ii_1435fadb31d523f6" ``` ```csharp var firstAttachment = message.Attachments[0]; Console.WriteLine(firstAttachment.ContentId); // "ii_1435fadb31d523f6" ``` ```ruby first_attachment = message.attachments[0] puts(first_attachment.content_id) # "ii_1435fadb31d523f6" ``` ```php $firstAttachment = $message->attachments[0]; print($first_attachment->contentId); // "ii_1435fadb31d523f6" ``` ```go var firstAttachment = message.Attachments[0] fmt.Println(firstAttachment.ContentId) // "ii_1435fadb31d523f6" ``` ## Fetching an attachment as base64 You can fetch the content of an attachment, encoded as base64, using the “get attachment” method: ```nodejs const firstAttachment = message.attachments[0] const file = await mailosaur.files.getAttachment(firstAttachment.id) const base64 = file.toString('base64') console.log(base64) ``` ```python first_attachment = message.attachments[0] file = mailosaur.files.get_attachment(first_attachment.id).content base64 = base64.b64encode(file) print(base64) ``` ```java Attachment firstAttachment = message.attachments().get(0); byte[] file = mailosaur.files().getAttachment(firstAttachment.id()); String base64 = new String(Base64.getEncoder().encode(file)); System.out.println(base64); ``` ```csharp var firstAttachment = message.Attachments[0]; var file = mailosaur.Files.GetAttachment(firstAttachment.Id)); var base64 = Convert.ToBase64String(file); Console.WriteLine(base64); ``` ```ruby first_attachment = message.attachments[0] file = mailosaur.files.get_attachment(first_attachment.id) base64 = Base64.encode64(file) puts base64 ``` ```php $firstAttachment = $message->attachments[0]; $file = $mailosaur->files->getAttachment($firstAttachment->id); $base64 = base64_encode($file); print($base64); ``` ```go var firstAttachment = message.Attachments[0] var file, _ = m.Files.GetAttachment(firstAttachment.Id) base64 := b64.StdEncoding.EncodeToString(file) fmt.Println(base64) ``` ## Saving an attachment to disk You can also write an attached file to disk: ```nodejs const firstAttachment = message.attachments[0] const file = await mailosaur.files.getAttachment(firstAttachment.id) fs.writeFileSync(firstAttachment.fileName, file) ``` ```python first_attachment = message.attachments[0] file = mailosaur.files.get_attachment(first_attachment.id).content f = open(first_attachment.file_name, 'wb') f.write(file) f.close() ``` ```java Attachment firstAttachment = message.attachments().get(0); byte[] file = mailosaur.files().getAttachment(firstAttachment.id()); Files.write(Paths.get(firstAttachment.fileName()), file); ``` ```csharp var firstAttachment = message.Attachments[0]; var file = mailosaur.Files.GetAttachment(firstAttachment.Id)); File.WriteAllBytes(firstAttachment.FileName, file); ``` ```ruby first_attachment = message.attachments[0] file = mailosaur.files.get_attachment(first_attachment.id) File.open(first_attachment.file_name, 'wb') { |fp| fp.write(file) } ``` ```php $firstAttachment = $message->attachments[0]; $file = $mailosaur->files->getAttachment($firstAttachment->id); $f = fopen($firstAttachment->fileName, "w") or die("Unable to open file!"); fwrite($f, $file); fclose($f); ``` ```go var firstAttachment = message.Attachments[0] var file, _ = m.Files.GetAttachment(firstAttachment.Id) var err = os.WriteFile(firstAttachment.FileName, file, 0644) if err != nil { // handle error } ``` #### See also - [Extracting links](/docs/automation/links) - [Extracting codes](/docs/automation/codes) --- Source: https://mailosaur.com/docs/automation/codes # Extracting codes from email and SMS Learn how to test verification codes found in email and SMS messages with Mailosaur. ## Before you begin The examples shown below are based on two key assumptions: 1. You have already created a basic automated test using our [getting started guides](/docs/automation). 2. You have a chosen assertion library that you will use to test the values shown below. ## Codes within email and SMS text content When an email or SMS message is sent with plain text content, Mailosaur automatically extracts anything that looks like a verification code and makes these available via the `text.codes` array. Each code has a `value` property, representing the code itself. ```nodejs // How many codes? console.log(message.text.codes.length) // 2 const firstCode = message.text.codes[0] console.log(firstCode.value) // "456812" ``` ```python # How many codes? print(len(message.text.codes)) # 2 first_code = message.text.codes[0] print(first_code.value) # "456812" ``` ```java // How many codes? System.out.println(message.text().codes().size()); // 2 Code firstCode = message.text().codes().get(0); System.out.println(firstCode.value()); // "456812" ``` ```csharp // How many codes? Console.WriteLine(message.Text.Codes.Count); // 2 var firstCode = message.Text.Codes[0]; Console.WriteLine(firstCode.Value); // "456812" ``` ```ruby # How many codes? puts(message.text.codes.length) # 2 first_code = message.text.codes[0] puts(first_code.value) # "456812" ``` ```php // How many codes? print(count($message->text->codes)); // 2 $firstCode = $message->text->codes[0]; print($firstCode->value); // "456812" ``` ```go // How many codes? fmt.Println(len(message.Text.Codes)) // 2 firstCode := message.Text.Codes[0] fmt.Println(firstCode.Value) // "456812" ``` ## Codes within email HTML content As with codes found within the text content of a message, Mailosaur also detects and extracts codes found within the HTML of any email. These are made available via the `html.codes` array. ```nodejs // How many codes? console.log(message.html.codes.length) // 2 const firstCode = message.html.codes[0] console.log(firstCode.value) // "456812" ``` ```python # How many codes? print(len(message.html.codes)) # 2 first_code = message.html.codes[0] print(first_code.value) # "456812" ``` ```java // How many codes? System.out.println(message.html().codes().size()); // 2 Code firstCode = message.html().codes().get(0); System.out.println(firstCode.value()); // "456812" ``` ```csharp // How many codes? Console.WriteLine(message.Html.Codes.Count); // 2 var firstCode = message.Html.Codes[0]; Console.WriteLine(firstCode.Value); // "456812" ``` ```ruby # How many codes? puts(message.html.codes.length) # 2 first_code = message.html.codes[0] puts(first_code.value) # "456812" ``` ```php // How many codes? print(count($message->html->codes)); // 2 $firstCode = $message->html->codes[0]; print($firstCode->value); // "456812" ``` ```go // How many codes? fmt.Println(len(message.Html.Codes)) // 2 firstCode := message.Html.Codes[0] fmt.Println(firstCode.Value) // "456812" ``` ## What if my code is not detected? Mailosaur automatically detects most common verification code patterns, however, you can still [write your own regular expressions](/docs/automation/text-content#5-finding-a-6-digit-code) to meet more specific requirements. #### See also - [Testing email attachments](/docs/automation/attachments) --- Source: https://mailosaur.com/docs/automation/common-assertions # Common assertions Learn how to automate common assertions when testing email and SMS with Mailosaur. > [!LINK](/docs/automation/html-content) > ### HTML content > This guide shows how easy it is to extract and test HTML and text content within emails using Mailosaur. > [!LINK](/docs/automation/text-content) > ### Plain text content > This guide shows how easy it is to automate the testing of the contents of an email or SMS message using the Mailosaur API. > [!LINK](/docs/automation/links) > ### Links > This guide shows how easy it is to test links and hyperlinks from the content on your emails or messages to test they work correctly. > [!LINK](/docs/automation/codes) > ### Codes > This guide shows how easy it is to automatically extract verification and offer codes from the content of email or SMS messages. > [!LINK](/docs/automation/attachments) > ### Attachments > This guide shows how easy it is to test email attachments and properties like name, content type, size, images, and fetching attachments in various languages. > [!LINK](/docs/automation/images) > ### Images > This guide shows how easy it is to test images, including web beacons, within a HTML email using Mailosaur. > [!LINK](/docs/automation/message-properties) > ### Message properties > This guide shows how easy it is to test the common properties of an email or SMS message including subject line, recipients, senders and email headers. > [!LINK](/docs/automation/spam) > ### Spam > This guide shows how easy it is to test your email spam score with Mailosaur's deliverability report and SpamAssassin checks. --- Source: https://mailosaur.com/docs/automation/cucumber # Using Mailosaur with Cucumber All the guides you need to make the most of your Mailosaur subscription. Mailosaur integrates simply and effectively into Cucumber testing frameworks. To make the most of Mailosaur’s key features within Cucumber, you can follow our guides on integration, email testing, and more. ## Overview - Start by reading our [quickstart guide](/docs/automation/cucumber/quickstart) for Cucumber users. - Read our guide on Cucumber [email testing](/docs/automation/cucumber/email-testing). - Learn how to test [SMS messages](/docs/automation/cucumber/sms-testing) with Cucumber. ## Getting started with Mailosaur The quickest way to get started is by generating a basic Mailosaur starter project. Our [quickstart guide](/docs/automation/cucumber/quickstart) shows you how to do this for Node.js, Java, Ruby, Python and .NET. ## Learn more - Find out how to use [Cucumber](https://cucumber.io/). - Check out the API reference for detailed [API documentation](/docs/api). - Read the [Java API library](https://github.com/mailosaur/mailosaur-java) documentation on GitHub. - Read the [Python API library](https://github.com/mailosaur/mailosaur-python) documentation on GitHub. - Read the [.NET API library](https://github.com/mailosaur/mailosaur-dotnet) documentation on GitHub. - Read the [Ruby API library](https://github.com/mailosaur/mailosaur-ruby) documentation on GitHub. - Read the [Node.js API library](https://github.com/mailosaur/mailosaur-node) documentation on GitHub. - [API client libraries](/docs/automation) - check out the other Mailosaur API clients. --- Source: https://mailosaur.com/docs/automation/cucumber/email-testing # Email testing with Cucumber Learn how to integrate Mailosaur Email Testing into Cucumber. ## What you’ll find in this guide - How to test various aspects of emails - Testing links and codes - Managing email tests ## What you’ll need - An understanding of [Cucumber](https://cucumber.io/) and how it works. - A Mailosaur account with the email feature enabled. You can [start a free trial](/app/signup) if you don’t have one. - A Cucumber project with Mailosaur’s API client configured [(refer to our quickstart guide)](/docs/automation/cucumber/quickstart) - Your Mailosaur account's API key and Server ID. To learn about Server IDs and what to replace “SERVER_ID” with, see our guide on [sending test emails to Mailosaur](/docs/email-testing/sending-to-mailosaur). ## Basic usage To perform email testing with Cucumber, you will: 1. Send an email message to your Mailosaur inbox (for example, by requesting a password reset). 2. Write a Gherkin scenario using Given, When, and Then steps, such as: - Connect to the Mailosaur API with the official client library. - Search for the email you sent in step 1. 3. Verify that the sender is correct. 4. Implement each Given, When and Then step in code, including assertions. Cucumber tests are BDD (behavior-driven development) tests and have two parts: 1. **Feature files:** These define testing scenarios with Given, When, and Then steps to define the journey being tested. 2. **Step definition files:** These contain the code that implements each step from the feature files, including the test setup, actions, and assertions. Create a scenario in a feature file, replacing `"test"` with the subject of the email you sent earlier and replacing `"Support"` with your name and `"no-reply@acme.com"` with your email address. ``` Scenario: Basic email usage Given the Mailosaur API client is setup for email When I search for the "test" email I sent earlier Then that email should be sent from "Support" at "no-reply@acme.com" ``` Next, implement these steps in a step definition file: ```js Given('the Mailosaur API client is setup for email', function () { const apiKey = process.env.MAILOSAUR_API_KEY; serverId = process.env.MAILOSAUR_SERVER_ID; assert.ok(apiKey, 'MAILOSAUR_API_KEY must be set'); assert.ok(serverId, 'MAILOSAUR_SERVER_ID must be set'); mailosaurClient = new MailosaurClient(apiKey); }); When('I search for the {string} email I sent earlier', async function (subject) { const criteria = { subject }; message = await mailosaurClient.messages.get(serverId, criteria); assert.ok(message, 'Message not found'); }); Then('that email should be sent from {string} at {string}', function (name, emailAddress) { assert.strictEqual(message.from[0].name, name, 'Email sender name does not match'); assert.strictEqual(message.from[0].email, emailAddress, 'Email sender email address does not match'); }); ``` ```java @Given("the Mailosaur API client is setup for email") public void the_mailosaur_api_client_is_setup() { Dotenv dotenv = Dotenv.load(); String apiKey = dotenv.get("MAILOSAUR_API_KEY"); serverId = dotenv.get("MAILOSAUR_SERVER_ID"); assertNotNull("MAILOSAUR_API_KEY must be set", apiKey); assertNotNull("MAILOSAUR_SERVER_ID must be set", serverId); assertFalse("MAILOSAUR_API_KEY must not be empty", apiKey.isEmpty()); assertFalse("MAILOSAUR_SERVER_ID must not be empty", serverId.isEmpty()); mailosaurClient = new MailosaurClient(apiKey); assertNotNull("Client should be initialized", client); } @When("I search for the {string} email I sent earlier") public void i_search_for_the_email_i_sent_earlier(String subject) throws Exception { SearchCriteria criteria = new SearchCriteria().withSubject(subject); message = mailosaurClient.messages().get(serverId, criteria); assertNotNull("Message not found", message); } @Then("that email should be sent from {string} at {string}") public void that_email_should_be_sent_from_at(String name, String emailAddress) { assertEquals(name, message.from().get(0).name()); assertEquals(emailAddress, message.from().get(0).email()); } ``` ```ruby Given('the Mailosaur API key and server ID are set for email test') do api_key = ENV['MAILOSAUR_API_KEY'] @server_id = ENV['MAILOSAUR_SERVER_ID'] expect(api_key).not_to be_nil, 'MAILOSAUR_API_KEY must be set' expect(api_key.strip).not_to be_empty, 'MAILOSAUR_API_KEY must not be empty' expect(@server_id).not_to be_nil, 'MAILOSAUR_SERVER_ID must be set' expect(@server_id.strip).not_to be_empty, 'MAILOSAUR_SERVER_ID must not be empty' @mailosaurClient = Mailosaur::MailosaurClient.new(api_key) expect(@client).not_to be_nil end When('I search for the {string} email I sent earlier') do |subject| criteria = Mailosaur::Models::SearchCriteria.new criteria.subject = subject @message = @mailosaurClient.messages.get(@server_id, criteria) expect(@message).not_to be_nil end Then('that email should be sent from {string} at {string}') do |name, email| expect(@message.from.first.name).to eq(name) expect(@message.from.first.email).to eq(email) end ``` ```py @given('the Mailosaur API client is setup for email') def step_impl(context): global apiKey global serverId global mailosaurClient apiKey = os.getenv('MAILOSAUR_API_KEY') serverId = os.getenv('MAILOSAUR_SERVER_ID') assert apiKey, 'MAILOSAUR_API_KEY environment variable must be set' assert serverId, 'MAILOSAUR_SERVER_ID environment variable must be set' mailosaurClient = MailosaurClient(apiKey) @when('I search for the "{subject}" email I sent earlier') def step_impl(context, subject): global message criteria = SearchCriteria() criteria.subject = subject message = mailosaurClient.messages.get(serverId, criteria) assert message, 'Message not found' @then('that email should be sent from "{name}" at "{email}"') def step_impl(context, name, email): assert message.sender[0].name == name, 'Email sender name does not match' assert message.sender[0].email == email, 'Email sender email address does not match' ``` ```dotnet [Given("the Mailosaur API client is setup for email")] public void GivenTheMailosaurApiClientIsSetupForEmail() { var apiKey = _config["appSettings:MAILOSAUR_API_KEY"]; serverId = _config["appSettings:MAILOSAUR_SERVER_ID"]; Assert.NotNull(apiKey); Assert.NotNull(serverId); Assert.NotEmpty(apiKey); Assert.NotEmpty(serverId); mailosaurClient = new MailosaurClient(apiKey); } [When("I search for the {string} email I sent earlier")] public void WhenISearchForTheEmailISentEarlier(string subject) { var criteria = new SearchCriteria() { Subject = subject }; message = mailosaurClient!.Messages.Get(serverId, criteria); Assert.NotNull(message); } [Then("that email should be sent from {string} at {string}")] public void ThenTheEmailShouldBeSentFromAt(string name, string emailAddress) { Assert.Equal(name, message!.From[0].Name); Assert.Equal(emailAddress, message.From[0].Email); } ``` This example will search for the email address that a message was sent to, but you can also search using any of the following criteria: | Parameter | Description | |-----------|-------------| | sentTo | The full email address to which the target message was sent | | sentFrom | The full email address from which the target message was sent | | subject | Finds messages where the subject line contains this text | | body | Finds messages where the message body contains this text | ### Test email addresses Each inbox in your account (also known as a server) has a unique identifier, referred to as a Server ID. This ID is used to give your inbox a domain name like this: `SERVER_ID.mailosaur.net`. This domain supports a wildcard email pattern, meaning any email address ending with `@SERVER_ID.mailosaur.net` works out of the box. **You don’t need to create email addresses** before using them — they just work! However, if you need help thinking of a unique email address, you can use this helper method: ```js const emailAddress = mailosaurClient.servers.generateEmailAddress("SERVER_ID"); console.log(emailAddress); // "bgwqj@SERVER_ID.mailosaur.net" ``` ```java String emailAddress = mailosaurClient.servers().generateEmailAddress("SERVER_ID"); System.out.println(emailAddress); // "bgwqj@SERVER_ID.mailosaur.net" ``` ```ruby email_address = mailosaurClient.servers.generate_email_address("SERVER_ID") puts(email_address) # "bgwqj@SERVER_ID.mailosaur.net" ``` ```py email_address = mailosaurClient.servers.generate_email_address("SERVER_ID") print(email_address) # "bgwqj@SERVER_ID.mailosaur.net" ``` ```dotnet var emailAddress = mailosaurClient.Servers.GenerateEmailAddress("SERVER_ID"); Console.WriteLine(emailAddress); // "bgwqj@SERVER_ID.mailosaur.net" ``` ### Find an email When searching for a specific message within your inbox, it’s always better to use `messages.get()` , as it will automatically wait for messages to arrive and return the full message result. ```js // Search for the message const message = await mailosaurClient.messages.get("SERVER_ID", { sentTo: "my-test@SERVER_ID.mailosaur.net", }); console.log(message.html.body); ``` ```java MessageSearchParams params = new MessageSearchParams(); params.withServer("SERVER_ID"); SearchCriteria searchCriteria = new SearchCriteria(); searchCriteria.withSentTo("test123@SERVER_ID.mailosaur.net"); Message message = mailosaurClient.messages().get(params, searchCriteria); System.out.println(message.html().body()); ``` ```ruby criteria = Mailosaur::Models::SearchCriteria.new() criteria.sent_to = "test123@SERVER_ID.mailosaur.net" message = mailosaurClient.messages.get("SERVER_ID", criteria) puts(message.html.body) ``` ```py criteria = SearchCriteria() criteria.sent_to = "test123@SERVER_ID.mailosaur.net" message = mailosaurClient.messages.get("SERVER_ID", criteria) print(message.html.body) ``` ```dotnet var criteria = new SearchCriteria() { SentTo = "test123@SERVER_ID.mailosaur.net" }; var message = mailosaurClient.Messages.Get("SERVER_ID", criteria); Console.WriteLine(message.Html.Body); ``` ## Time range for searching By default, searches only look for messages received in the last hour. To look back further in your message history, set the “received after” parameter. ```js // Calculate a datetime for yesterday const yesterday = new Date(Date.now() - 24 * 60 * 60 * 1000); // Use this timestamp in the search const message = await mailosaurClient.messages.get("SERVER_ID", { sentTo: "my-test@SERVER_ID.mailosaur.net", }, { receivedAfter: yesterday }); ``` ```java // Calculate a timestamp for yesterday Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_YEAR, -1); long yesterday = calendar.getTimeInMillis(); // Use this timestamp in the search MessageSearchParams params = new MessageSearchParams(); params.withServer("SERVER_ID"); params.withReceivedAfter(yesterday); SearchCriteria searchCriteria = new SearchCriteria(); searchCriteria.withSentTo("test123@SERVER_ID.mailosaur.net"); Message message = mailosaurClient.messages().get(params, searchCriteria); ``` ```ruby # Calculate a datetime for yesterday yesterday = Date.today - 1 criteria = Mailosaur::Models::SearchCriteria.new() criteria.sent_to = "test123@SERVER_ID.mailosaur.net" # Use this timestamp in the search message = mailosaurClient.messages.get("SERVER_ID", criteria, received_after: yesterday) ``` ```py # Calculate a datetime for yesterday yesterday = datetime.today() - timedelta(days=1) criteria = SearchCriteria() criteria.sent_to = "test123@SERVER_ID.mailosaur.net" # Use this timestamp in the search message = mailosaurClient.messages.get("SERVER_ID", criteria, received_after=yesterday) ``` ```dotnet // Calculate a datetime for yesterday var yesterday = DateTime.Today.AddDays(-1); var criteria = new SearchCriteria() { SentTo = "test123@SERVER_ID.mailosaur.net" }; // Use this timestamp in the search var message = mailosaurClient.Messages.Get("SERVER_ID", criteria, receivedAfter: yesterday); ``` ## “No matching messages” troubleshooting If you see the error “No matching messages found in time” when searching for messages: - Ensure that the target email or SMS message is visible in the Mailosaur Dashboard, as it may not have arrived at all. - Check when the message arrived. By default, searches only include messages received within the last hour. See “time range for searching” above on how to override this. - Check that you have correctly set the **sent to** parameter in your search criteria. ### List current inbox contents See a full list of everything currently in your inbox. ```js // List the most recent messages const result = await mailosaurClient.messages.list("SERVER_ID"); // Get the most recent message (the first one in the list) const latestMessage = result.items[0]; // Get the full message object const message = await mailosaurClient.messages.getById(latestMessage.id); console.log(message.html.body); ``` ```java // List the most recent messages MessageListParams params = new MessageListParams(); params.withServer("SERVER_ID"); MessageListResult result = mailosaurClient.messages().list(params); // Get the most recent message (the first one in the list) MessageSummary latestMessage = result.items().get(0); // Get the full message object Message message = mailosaurClient.messages().getById(latestMessage.id()); System.out.println(message.html().body()); ``` ```ruby # List the most recent messages result = mailosaurClient.messages.list("SERVER_ID") # Get the most recent message (the first one in the list) latest_message = result.items[0] # Get the full message object message = mailosaurClient.messages.get_by_id(latest_message.id) puts(message.html.body) ``` ```py # List the most recent messages result = mailosaurClient.messages.list("SERVER_ID") # Get the most recent message (the first one in the list) latest_message = result.items[0] # Get the full message object message = mailosaurClient.messages.get_by_id(latest_message.id) print(message.html.body) ``` ```dotnet // List the most recent messages var result = mailosaurClient.Messages.List(serverId); // Get the most recent message (the first one in the list) var latestMessage = result.Items[0]; // Get the full message object message = mailosaurClient.Messages.GetById(latestMessage.Id); ``` ### Searching for multiple messages Identify if multiple messages meet the same criteria. ```js // Search for all messages sent to someone@SERVER_ID.mailosaur.net. // Limit results to the first 10 matches only. const result = await mailosaurClient.messages.search( "SERVER_ID", { sentTo: "someone@SERVER_ID.mailosaur.net", }, { page: 0, itemsPerPage: 10, } ); // Get the most recent message (the first one in the list) const latestMessage = result.items[0]; // Get the full message object const message = await mailosaurClient.messages.getById(latestMessage.id); console.log(message.html.body); ``` ```java // Search for all messages sent to someone@SERVER_ID.mailosaur.net. SearchCriteria criteria = new SearchCriteria(); criteria.withSentTo("someone@SERVER_ID.mailosaur.net"); // Limit results to the first 10 matches only. MessageSearchParams params = new MessageSearchParams(); params.withServer("SERVER_ID") .withPage(0) .withItemsPerPage(10); MessageListResult result = mailosaurClient.messages().search(params, criteria); // Get the most recent message (the first one in the list) MessageSummary latestMessage = result.items().get(0); // Get the full message object Message message = mailosaurClient.messages().getById(latestMessage.id()); System.out.println(message.html().body()); ``` ```ruby # Search for all messages sent to someone@SERVER_ID.mailosaur.net. criteria = Mailosaur::Models::SearchCriteria.new() criteria.sent_to = "someone@SERVER_ID.mailosaur.net" # Limit results to the first 10 matches only. result = mailosaurClient.messages.search("SERVER_ID", criteria, page: 0, items_per_page: 10) # Get the most recent message (the first one in the list) latest_message = result.items[0] # Get the full message object message = mailosaurClient.messages.get_by_id(latest_message.id) puts(message.html.body) ``` ```py # Search for all messages sent to someone@SERVER_ID.mailosaur.net. criteria = SearchCriteria() criteria.sent_to = "someone@SERVER_ID.mailosaur.net" # Limit results to the first 10 matches only. result = mailosaurClient.messages.search("SERVER_ID", criteria, page=0, items_per_page=10) # Get the most recent message (the first one in the list) latest_message = result.items[0] # Get the full message object message = mailosaurClient.messages.get_by_id(latest_message.id) print(message.html.body) ``` ```dotnet // Search for all messages sent to someone@SERVER_ID.mailosaur.net var criteria = new SearchCriteria() { SentTo = "someone@SERVER_ID.mailosaur.net" }; // Limit results to the first 10 matches only. var result = mailosaurClient.Messages.Search("SERVER_ID", criteria, page: 0, itemsPerPage: 10); // Get the most recent message (the first one in the list) var latestMessage = result.Items[0]; // Get the full message object var message = mailosaurClient.Messages.GetById(latestMessage.Id); Console.WriteLine(message.Html.Body); ``` ## Common test scenarios ### Testing basic properties Once an email has been retrieved, test the properties of that email: ```js // Test sender information expect(message.from[0].name).toEqual("Support"); expect(message.from[0].phone).toEqual("654321"); // Test recipient information expect(message.to[0].name).toEqual("John Smith"); expect(message.to[0].phone).toEqual("1234567890"); ``` ### Testing email contents Email content is available via the `text.body` property: ```js console.log(message.text.body); // "Hi Jason, ..." ``` ### Testing links Any links in the content of your email are automatically available via the `text.links` array: ```js // How many links? console.log(message.text.links.length); // 2 const firstLink = message.text.links[0]; expect(firstLink.text).toEqual("Google Search"); expect(firstLink.href).toEqual("https://www.google.com/"); ``` ### Testing verification codes Codes are automatically extracted from the content of your email. They are available via the `text.codes` array: ```js const otp = message.text.codes[0]; expect(otp.value).toEqual("456812"); ``` ### Replying to an email If your product handles email replies, the Mailosaur reply feature simulates this. When you reply, the message is sent back to the original account: ```js await mailosaur.messages.reply("MESSAGE_ID", { text: "FYI", }); ``` | Parameter | Description | | ----------- | ------------------------------------------------------ | | text | Any additional text content to include in the reply | | html | Any additional HTML content to include in the reply | | subject | Optionally override the default subject line | | attachments | Optional attachments (see 'include attachments' above) | ### Forwarding a message to email You can forward messages from your Mailosaur account to external email addresses via the creation of automated forwarding rules, or one at a time. Before you can forward messages, **you must set up a [verified external email address](/docs/managing-your-account/external-email-addresses)**, so you can send email to it: ```js await mailosaur.messages.forward("MESSAGE_ID", { to: "verified-address@example.com", text: "FYI", }); ``` | Parameter | Description | | --------- | ------------------------------------------------------------------------------------- | | to | The email address to which the message will be sent. Must be a verified email address | | text | Any additional text content to forward the message with | | html | Any additional HTML content to forward the message with | | subject | Optionally override the default subject line | ## Deleting messages ### Deleting an individual message Permanently deletes a single message and attachments. This operation cannot be undone: ```js await mailosaur.messages.del("MESSAGE_ID"); ``` ### Delete all messages Permanently deletes all messages held in the specified inbox. Also deletes any attachments related to each message. This operation cannot be undone: ```js await mailosaurClient.messages.deleteAll("SERVER_ID"); ``` ```java mailosaurClient.messages().deleteAll("SERVER_ID"); ``` ```ruby mailosaurClient.messages.delete_all("SERVER_ID") ``` ```py mailosaurClient.messages.delete_all("SERVER_ID") ``` ```dotnet mailosaurClient.Messages.DeleteAll("SERVER_ID"); ``` ## See also - [SMS testing guide](/docs/automation/cucumber/sms-testing) - [Authenticator (TOTP)](/docs/authenticator) --- Source: https://mailosaur.com/docs/automation/cucumber/quickstart # Quickstart guide for Mailosaur and Cucumber Get Mailosaur up and running within your Cucumber project in a few steps. ## What you’ll need - You’ll need a Mailosaur account. If you don’t already have one, just [create a free trial account first](/app/signup). - Log in to your account and generate an API key, which you will need to run automated tests. - Finally, make sure you know how to send emails (or SMS) into your account. ## Create a Cucumber starter project Create a new project for your programming language, then run the following commands to install [Cucumber](https://cucumber.io/) and any testing libraries you need. ### Create and initialize a Node.js project ```js mkdir mailosaur-nodejs-cucumber cd mailosaur-nodejs-cucumber npm init -y ``` ### Install Cucumber Use npm to install [Cucumber](https://www.npmjs.com/package/@cucumber/cucumber). There's no need to also install an assertion library, as you can just use Node.js's built-in [Assert](https://nodejs.org/api/assert.html#assert) module. ```js npm install --save-dev @cucumber/cucumber ``` ### Create a Java project ```java mkdir mailosaur-java-cucumber cd mailosaur-java-cucumber ``` ### Install Cucumber and JUnit Gradle users can add these dependencies to their project’s build file: ```java // Cucumber for Java testImplementation "io.cucumber:cucumber-java:CUCUMBER_JAVA_VERSION" // Cucumber JUnit integration testImplementation "io.cucumber:cucumber-junit:CUCUMBER_JUNIT_VERSION" // JUnit testImplementation "junit:junit:JUNIT_VERSION" ``` Maven users should add these dependencies to their project’s POM: ```java io.cucumber cucumber-java CUCUMBER_JAVA_VERSION test io.cucumber cucumber-junit CUCUMBER_JUNIT_VERSION test junit junit JUNIT_VERSION test ``` If you don’t use Gradle or Maven, refer to the README within the GitHub repository. ### Create a Ruby project ```ruby mkdir mailosaur-ruby-cucumber cd mailosaur-ruby-cucumber ``` ### Install Cucumber and RSpec testing libraries Add the following lines to your Gemfile: ```ruby gem "cucumber" gem "rspec-expectations" ``` ### Create a Python project ```py mkdir mailosaur-python-cucumber cd mailosaur-python-cucumber ``` ### Create a virtual environment ```py python -m venv venv source venv/bin/activate ``` ### Install Behave Behave is Python’s answer to Cucumber. It uses the same Gherkin syntax for feature files and a similar step definition concept. There's no need to install an assertion library, as you can use Python's built-in [assert statement](https://docs.python.org/3/reference/simple_stmts.html#the-assert-statement). ```py pip install behave ``` ### Create a .NET XUnit project using the XUnit project template ```dotnet dotnet new xunit -n mailosaur-dotnet-cucumber cd mailosaur-dotnet-cucumber ``` ### Install Reqnroll and XUnit testing libraries Reqnroll is .NET's answer to Cucumber. It uses the same Gherkin syntax for feature files and a similar step definition concept. ```dotnet dotnet add package Reqnroll dotnet add package Reqnroll.Xunit dotnet add package xunit.core ``` ## Integrate Mailosaur with an existing Cucumber project If you have an existing Cucumber project (or created one just now), here is how to install and configure Mailosaur's API client library: ### Install the Mailosaur Node.js library Use npm to install the [Mailosaur Node.js](https://www.npmjs.com/package/mailosaur) library. ```js npm install --save-dev mailosaur ``` ### Install the Mailosaur Java library Gradle users can add this dependency to their project’s build file: ``` // MAILOSAUR_JAVA_VERSION available at: // https://github.com/mailosaur/mailosaur-java/releases/latest) implementation "com.mailosaur:mailosaur-java:MAILOSAUR_JAVA_VERSION" ``` Maven users should add this dependency to their project’s POM: ``` com.mailosaur mailosaur-java MAILOSAUR_JAVA_VERSION ``` If you don’t use Gradle or Maven, refer to the README within the [GitHub repository](https://github.com/mailosaur/mailosaur-java). ### Install the Mailosaur Ruby library Run this command to install the Mailosaur Ruby package: ``` gem install mailosaur ``` ### Install the Mailosaur Python library Run this command to install the Mailosaur Python package: ``` pip install mailosaur ``` ### Install the Mailosaur .NET library Run this command to install the [Mailosaur NuGet package](https://github.com/mailosaur/mailosaur-dotnet): ``` dotnet add package mailosaur ``` ## Write your first Cucumber test Cucumber tests are BDD (behavior-driven development) tests and have two parts: 1. **Feature files:** Cucumber groups its tests by feature, and a feature file consists of lists of scenarios made up of steps, all written in human-like Gherkin syntax in the form of Given, When, and Then statements. 2. **Step definition files:** These contain the code that implements each step from the feature files, including the test setup, actions, and assertions. Your first test is to check that the Mailosaur library is able to connect to the Mailosaur API and see at least one inbox. This includes: 1. Writing a Gherkin scenario in a feature file using Given, When, and Then steps, such as: - Retrieving the Mailosaur API key - Connecting to the Mailosaur API using the Mailosaur library - Confirming that at least one inbox is present Create the following scenario in a `Quickstart.feature` file: ``` Feature: Quick start testing with Mailosaur Scenario: Check the Mailosaur API works by checking we can access an email inbox Given the Mailosaur API client is setup When I connect to the Mailosaur API Then I should see at least one inbox ``` To implement the scenario, define the step definitions for each Cucumber step. ```js let apiKey; let mailosaurClient; let emailServers; Given('the Mailosaur API client is setup', function () { apiKey = process.env.MAILOSAUR_API_KEY; assert.ok(apiKey, 'MAILOSAUR_API_KEY environment variable must be set'); }); When('I connect to the Mailosaur API', async function () { mailosaurClient = new MailosaurClient(apiKey); // Make a simple API call to get a list of inboxes const result = await mailosaurClient.servers.list(); emailServers = result.items; }); Then('I should see at least one inbox', function () { assert.ok(emailServers, 'Expected emailServers to be defined'); assert.ok(emailServers.length > 0, 'Expected at least one inbox'); }); ``` ```java private String apiKey; private MailosaurClient client; private List emailServers; @Given("the Mailosaur API client is setup") public void a_mailosaur_api_key_is_configured() { Dotenv dotenv = Dotenv.load(); apiKey = dotenv.get("MAILOSAUR_API_KEY"); assertNotNull("MAILOSAUR_API_KEY must be set", apiKey); assertFalse("MAILOSAUR_API_KEY must not be empty", apiKey.isEmpty()); } @When("I connect to the Mailosaur API") public void i_connect_to_the_mailosaur_api() throws Exception { mailosaurClient = new MailosaurClient(apiKey); // Make a simple API call to get a list of inboxes emailServers = mailosaurClient.servers().list().items(); } @Then("I should see at least one inbox") public void i_should_see_at_least_one_inbox() { assertNotNull("Server list should not be null", emailServers); assertFalse("Expected at least one inbox", emailServers.isEmpty()); } ``` ```ruby @client = nil @email_servers = nil Given('the Mailosaur API client is setup') do @api_key = ENV['MAILOSAUR_API_KEY'] expect(@api_key).not_to be_nil expect(@api_key.strip).not_to be_empty, 'MAILOSAUR_API_KEY must not be empty' end When('I connect to the Mailosaur API') do @mailosaurClient = Mailosaur::MailosaurClient.new(@api_key) @email_servers = @mailosaurClient.servers.list.items end Then('I should see at least one inbox') do expect(@email_servers).not_to be_nil expect(@email_servers).not_to be_empty end ``` ```py @given('the Mailosaur API client is setup') def step_impl(context): global apiKey apiKey = os.getenv('MAILOSAUR_API_KEY') assert apiKey, 'MAILOSAUR_API_KEY environment variable must be set' @when('I connect to the Mailosaur API') def step_impl(context): global mailosaurClient global emailServers mailosaurClient = MailosaurClient(apiKey) result = mailosaurClient.servers.list() emailServers = result.items @then('I should see at least one inbox') def step_impl(context): assert emailServers, 'Expected emailServers to be defined' assert len(emailServers) > 0, 'Expected at least one inbox' ``` ```dotnet private String apiKey; public MailosaurClient? mailosaurClient; private IList? emailServers; [Given("the Mailosaur API client is setup")] public void GivenTheApiKeyIsSetForMailosaur() { apiKey = _config["appSettings:MAILOSAUR_API_KEY"]!; Assert.NotNull(apiKey); Assert.NotEmpty(apiKey); } [When("I connect to the Mailosaur API")] public void WhenIConnectToTheMailosaurApi() { mailosaurClient = new MailosaurClient(apiKey); // Make a simple API call to get a list of inboxes emailServers = mailosaurClient.Servers.List().Items; } [Then("I should see at least one inbox")] public void ThenIShouldSeeAtLeastOneInbox() { Assert.NotNull(emailServers); Assert.True(emailServers.Any(), "Expected at least one inbox"); } ``` ### Start testing Now that you have a project connected to the Mailosaur API, you can start creating all kinds of tests: - [Email testing with Cucumber](/docs/automation/cucumber/email-testing) - [SMS testing with Cucumber](/docs/automation/cucumber/sms-testing) - [Email Testing](/docs/email-testing) — test password resets, account verification, order confirmations, etc. - [SMS Testing](/docs/sms-testing) — test alerts, notifications, and 2FA logins - [2FA app testing](/docs/authenticator) — mimic the functionality of apps like Google Authenticator and Auth0 - [Email deliverability testing](/docs/api) --- Source: https://mailosaur.com/docs/automation/cucumber/sms-testing # SMS testing with Cucumber Learn how to test every element of your SMS communication within Cucumber. ## What you’ll find in this guide - How to test various aspects of SMS - Testing links and codes - Managing SMS tests ## What you’ll need - An understanding of [Cucumber](https://cucumber.io/) and how it works. - A Mailosaur account with the SMS feature enabled. You can [start a free trial](/app/signup) if you don’t have one. - A Cucumber project with Mailosaur’s API client configured. [See our quickstart guide](/docs/automation/cucumber/quickstart) on this. - Your Mailosaur account's API key and Server ID. To learn about Server IDs and what to replace “SERVER_ID” with, see our guide on [sending test emails to Mailosaur](/docs/email-testing/sending-to-mailosaur). ## Basic usage To perform SMS testing with Cucumber, all you need to do is: 1. Send an SMS message to your dedicated Mailosaur phone number. (You can use your own mobile device to do this.)\ 2. Write a Gherkin scenario using Given, When, and Then steps, such as: - Connect to the Mailosaur API with the official client library. - Search for the SMS you sent in step 1. - Verify that the sender's phone number is correct. 3. Implement each Given, When and Then step in code, including assertions. Cucumber tests are BDD (behavior-driven development) tests and have two parts: 1. **Feature files**: These define testing scenarios with Given, When, and Then steps to define the journey being tested. 2. **Step definition files**: These contain the code that implements each step from the feature files, including the test setup, actions, and assertions. Create a scenario in a feature file, replacing `"123456789"` with the number of the SMS mailbox you messaged earlier and replacing `"123456787"` with your own phone number. Phone numbers should be entered in [E.164](https://en.wikipedia.org/wiki/E.164) format without the plus sign: ✅ 14155550000 ❌ +14155550000 ❌ 0014155550000 ❌ 4155550000 ``` Scenario: Basic SMS usage Given the Mailosaur API client is setup for SMS When I search for an SMS sent to "123456789" Then that SMS should be sent from "123456787" ``` Next, implement these steps in a step definition file: ```js Given('the Mailosaur API client is setup for SMS', function () { const apiKey = process.env.MAILOSAUR_API_KEY; serverId = process.env.MAILOSAUR_SERVER_ID; assert.ok(apiKey, 'MAILOSAUR_API_KEY must be set in .env'); assert.ok(serverId, 'MAILOSAUR_SERVER_ID must be set in .env'); assert.notStrictEqual(apiKey, '', 'MAILOSAUR_API_KEY must not be empty'); assert.notStrictEqual(serverId, '', 'MAILOSAUR_SERVER_ID must not be empty'); mailosaurClient = new MailosaurClient(apiKey); }); When('I search for an SMS sent to {string}', async function (toNumber) { const searchCriteria = { sentTo: toNumber }; message = await mailosaurClient.messages.get(serverId, searchCriteria); }); Then('that SMS should be sent from {string}', function (fromNumber) { assert.strictEqual(message.from[0].phone, fromNumber, 'Sender phone number does not match'); }); ``` ```java @Given("the Mailosaur API client is setup for SMS") public void the_mailosaur_api_client_is_setup() { Dotenv dotenv = Dotenv.load(); String apiKey = dotenv.get("MAILOSAUR_API_KEY"); serverId = dotenv.get("MAILOSAUR_SERVER_ID"); assertNotNull("MAILOSAUR_API_KEY must be set", apiKey); assertNotNull("MAILOSAUR_SERVER_ID must be set", serverId); assertFalse("MAILOSAUR_API_KEY must not be empty", apiKey.isEmpty()); assertFalse("MAILOSAUR_SERVER_ID must not be empty", serverId.isEmpty()); mailosaurClient = new MailosaurClient(apiKey); assertNotNull("Client should be initialized", client); } @When("I search for an SMS sent to {string}") public void i_search_for_an_sms_sent_to(String phoneNumber) throws Exception { // Setup search criteria SearchCriteria searchCriteria = new SearchCriteria(); searchCriteria.withSentTo(phoneNumber); // Search for the message message = mailosaurClient.messages().get(serverId, searchCriteria); } @Then("that SMS should be sent from {string}") public void that_sms_should_be_sent_from(String phoneNumber) { assertNotNull("Expected to find a message", message); assertNotNull("Message sender should not be null", message.from()); assertEquals(phoneNumber, message.from().get(0).phone()); } ``` ```ruby Given("the Mailosaur API client is setup for SMS") do api_key = ENV['MAILOSAUR_API_KEY'] @server_id = ENV['MAILOSAUR_SERVER_ID'] expect(api_key).not_to be_nil, 'MAILOSAUR_API_KEY must be set' expect(api_key.strip).not_to be_empty, 'MAILOSAUR_API_KEY must not be empty' expect(@server_id).not_to be_nil, 'MAILOSAUR_SERVER_ID must be set' expect(@server_id.strip).not_to be_empty, 'MAILOSAUR_SERVER_ID must not be empty' @mailosaurClient = Mailosaur::MailosaurClient.new(api_key) expect(@client).not_to be_nil end When("I search for an SMS sent to {string}") do |phone_number| criteria = Mailosaur::Models::SearchCriteria.new criteria.sent_to = phone_number @message = @client.messages.get(@server_id, criteria) end Then("that SMS should be sent from {string}") do |expected_number| expect(@message).not_to be_nil expect(@message.from.first.phone).to eq(expected_number) end ``` ```py @given('the Mailosaur API client is setup for SMS') def step_impl(context): global apiKey global serverId global mailosaurClient apiKey = os.getenv('MAILOSAUR_API_KEY') serverId = os.getenv('MAILOSAUR_SERVER_ID') assert apiKey, 'MAILOSAUR_API_KEY environment variable must be set' assert serverId, 'MAILOSAUR_SERVER_ID environment variable must be set' mailosaurClient = MailosaurClient(apiKey) @when('I search for an SMS sent to "{toNumber}"') def step_impl(context, toNumber): global message criteria = SearchCriteria() criteria.sent_to = toNumber message = mailosaurClient.messages.get(serverId, criteria) assert message, 'Message not found' @then('that SMS should be sent from "{fromNumber}"') def step_impl(context, fromNumber): assert message.sender[0].phone == fromNumber, 'Sender phone number does not match' ``` ```dotnet [Given("the Mailosaur API client is setup for SMS")] public void GivenTheMailosaurApiClientIsSetup() { var apiKey = _config["appSettings:MAILOSAUR_API_KEY"]; serverId = _config["appSettings:MAILOSAUR_SERVER_ID"]; Assert.NotNull(apiKey); Assert.NotNull(serverId); Assert.NotEmpty(apiKey); Assert.NotEmpty(serverId); mailosaurClient = new MailosaurClient(apiKey); } [When("I search for an SMS sent to {string}")] public void WhenISearchForAnSmsSentTo(string toNumber) { // Setup search criteria var searchCriteria = new SearchCriteria() { SentTo = toNumber }; // Search for the message message = mailosaurClient!.Messages.Get(serverId, searchCriteria); } [Then("that SMS should be sent from {string}")] public void ThenThatSmsShouldBeSentFrom(string fromNumber) { Assert.Equal(fromNumber, message.From[0].Phone); } ``` This example will search for the phone number that a message was sent to, but you can also search using any of the below criteria: | Parameter | Description | | --------- | ------------------------------------------------------------------------------------- | | sentTo | The full phone number to which the target message was sent | | sentFrom | The full phone number from which the target message was sent | | body | Finds messages where the message body contains this text | ## Find an SMS message When searching for a specific message within your inbox, it’s always better to use `messages.get()`, as it will automatically wait for messages to arrive and return the full message result. ```js // Search for the message const message = await mailosaurClient.messages.get("SERVER_ID", { sentTo: "123456789", // Phone number }); console.log(message.text.body); ``` ```java MessageSearchParams params = new MessageSearchParams(); params.withServer("SERVER_ID"); SearchCriteria searchCriteria = new SearchCriteria(); searchCriteria.withSentTo("123456789"); // Phone number Message message = mailosaurClient.messages().get(params, searchCriteria); System.out.println(message.text().body()); ``` ```ruby criteria = Mailosaur::Models::SearchCriteria.new() criteria.sent_to = "123456789" # Phone number message = mailosaurClient.messages.get("SERVER_ID", criteria) puts(message.text.body) ``` ```py criteria = SearchCriteria() criteria.sent_to = "123456789" # Phone number message = mailosaurClient.messages.get("SERVER_ID", criteria) print(message.text.body) ``` ```dotnet var criteria = new SearchCriteria() { SentTo = "123456789" // Phone number }; var message = mailosaurClient.Messages.Get("SERVER_ID", criteria); Console.WriteLine(message.Text.Body); ``` ## Time range for searching By default, searches only look for messages received in the last hour. To look back further in your message history, set the “received after” parameter. ```js // Calculate a datetime for yesterday const yesterday = new Date(Date.now() - 24 * 60 * 60 * 1000); // Use this timestamp in the search const message = await mailosaurClient.messages.get("SERVER_ID", { sentTo: "123456789", }, { receivedAfter: yesterday }); ``` ```java // Calculate a timestamp for yesterday Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_YEAR, -1); long yesterday = calendar.getTimeInMillis(); // Use this timestamp in the search MessageSearchParams params = new MessageSearchParams(); params.withServer("SERVER_ID"); params.withReceivedAfter(yesterday); SearchCriteria searchCriteria = new SearchCriteria(); searchCriteria.withSentTo("123456789"); Message message = mailosaurClient.messages().get(params, searchCriteria); ``` ```ruby # Calculate a datetime for yesterday yesterday = Date.today - 1 criteria = Mailosaur::Models::SearchCriteria.new() criteria.sent_to = "123456789" # Use this timestamp in the search message = mailosaurClient.messages.get("SERVER_ID", criteria, received_after: yesterday) ``` ```py # Calculate a datetime for yesterday yesterday = datetime.today() - timedelta(days=1) criteria = SearchCriteria() criteria.sent_to = "123456789" # Use this timestamp in the search message = mailosaurClient.messages.get("SERVER_ID", criteria, received_after=yesterday) ``` ```dotnet // Calculate a datetime for yesterday var yesterday = DateTime.Today.AddDays(-1); var criteria = new SearchCriteria() { SentTo = "123456789" }; // Use this timestamp in the search var message = mailosaurClient.Messages.Get("SERVER_ID", criteria, receivedAfter: yesterday); ``` ## “No matching messages” troubleshooting If you see the error “No matching messages found in time” when searching for messages: - Ensure that the target email or SMS message is visible in the Mailosaur Dashboard, as it may not have arrived at all. - Check when the message arrived. By default, searches only include messages received within the last hour. See “Time range for searching” above to learn how to override this. - Check that you have correctly set the **sent to** parameter in your search criteria. > [!WARNING] > #### It is usually better to use `messages.get()` > > The `list` and `search` methods will only return basic summaries, meaning several properties (including the message body) are not included. To get this data, you need to use [`.getById()`](#6-messagesgetbyidid). Instead, we recommend using the [`messages.get()`](#2-messagesgetserver-criteria-options) as this automatically waits for a matching result and returns the message in the result. ## Search for multiple messages Identify if multiple messages meet the same criteria. ```js // Search for all messages sent to 123456789. // Limit results to the first 10 matches only. const result = await mailosaurClient.messages.search( "SERVER_ID", { sentTo: "123456789", }, { page: 0, itemsPerPage: 10, } ); // Get the most recent message (the first one in the list) const latestMessage = result.items[0]; // Get the full message object const message = await mailosaurClient.messages.getById(latestMessage.id); console.log(message.text.body); ``` ```java // Search for all messages sent to 123456789. SearchCriteria criteria = new SearchCriteria(); criteria.withSentTo("123456789"); // Limit results to the first 10 matches only. MessageSearchParams params = new MessageSearchParams(); params.withServer("SERVER_ID") .withPage(0) .withItemsPerPage(10); MessageListResult result = mailosaurClient.messages().search(params, criteria); // Get the most recent message (the first one in the list) MessageSummary latestMessage = result.items().get(0); // Get the full message object Message message = mailosaurClient.messages().getById(latestMessage.id()); System.out.println(message.text().body()); ``` ```ruby # Search for all messages sent to 123456789. criteria = Mailosaur::Models::SearchCriteria.new() criteria.sent_to = "123456789" # Limit results to the first 10 matches only. result = mailosaurClient.messages.search("SERVER_ID", criteria, page: 0, items_per_page: 10) # Get the most recent message (the first one in the list) latest_message = result.items[0] # Get the full message object message = mailosaurClient.messages.get_by_id(latest_message.id) puts(message.text.body) ``` ```py # Search for all messages sent to 123456789. criteria = SearchCriteria() criteria.sent_to = "123456789" # Limit results to the first 10 matches only. result = mailosaurClient.messages.search("SERVER_ID", criteria, page=0, items_per_page=10) # Get the most recent message (the first one in the list) latest_message = result.items[0] # Get the full message object message = mailosaurClient.messages.get_by_id(latest_message.id) print(message.text.body) ``` ```dotnet // Search for all messages sent to 123456789. var criteria = new SearchCriteria() { SentTo = "123456789" }; // Limit results to the first 10 matches only. var result = mailosaurClient.Messages.Search("SERVER_ID", criteria, page: 0, itemsPerPage: 10); // Get the most recent message (the first one in the list) var latestMessage = result.Items[0]; // Get the full message object var message = mailosaurClient.Messages.GetById(latestMessage.Id); Console.WriteLine(message.Text.Body); ``` ## List current inbox contents See a full list of everything currently in your inbox. ```js // List the most recent messages const result = await mailosaurClient.messages.list("SERVER_ID"); // Get the most recent message (the first one in the list) const latestMessage = result.items[0]; // Get the full message object const message = await mailosaurClient.messages.getById(latestMessage.id); console.log(message.text.body); ``` ```java // List the most recent messages MessageListParams params = new MessageListParams(); params.withServer("SERVER_ID"); MessageListResult result = mailosaurClient.messages().list(params); // Get the most recent message (the first one in the list) MessageSummary latestMessage = result.items().get(0); // Get the full message object Message message = mailosaurClient.messages().getById(latestMessage.id()); System.out.println(message.text().body()); ``` ```ruby # List the most recent messages result = mailosaurClient.messages.list("SERVER_ID") # Get the most recent message (the first one in the list) latest_message = result.items[0] # Get the full message object message = mailosaurClient.messages.get_by_id(latest_message.id) puts(message.text.body) ``` ```py # List the most recent messages result = mailosaurClient.messages.list("SERVER_ID") # Get the most recent message (the first one in the list) latest_message = result.items[0] # Get the full message object message = mailosaurClient.messages.get_by_id(latest_message.id) print(message.text.body) ``` ```dotnet // List the most recent messages var result = mailosaurClient.Messages.List("SERVER_ID"); // Get the most recent message (the first one in the list) var latestMessage = result.Items[0]; // Get the full message object var message = mailosaurClient.Messages.GetById(latestMessage.Id); Console.WriteLine(message.Text.Body); ``` ## Common test scenarios ### Testing basic properties Once you have fetched an SMS, you can simply test the properties of that text: ```java // Test sender information assertEquals("Support", message.from().get(0).name()); assertEquals("654321", message.from().get(0).phone()); // Test recipient information assertEquals("John Smith", message.to().get(0).name()); assertEquals("1234567890", message.to().get(0).phone()); ``` ```py # Test sender information self.assertEqual("Support", message.sender[0].name) self.assertEqual("654321", message.sender[0].phone) # Test recipient information self.assertEqual("John Smith", message.to[0].name) self.assertEqual("1234567890", message.to[0].phone) ``` ```csharp // Test sender information Assert.Equal("Support", message.From[0].Name); Assert.Equal("654321", message.From[0].Phone); // Test recipient information Assert.Equal("John Smith", message.To[0].Name); Assert.Equal("1234567890", message.To[0].Phone); ``` ```ruby # Test sender information assert_equal("Support", message.from[0].name) assert_equal("654321", message.from[0].phone) # Test recipient information assert_equal("John Smith", message.to[0].name) assert_equal("1234567890", message.to[0].phone) ``` ```js // Test sender information expect(message.from[0].name).toBe("Support"); expect(message.from[0].phone).toBe("654321"); // Test recipient information expect(message.from[0].name).toBe("John Smith"); expect(message.from[0].phone).toBe("1234567890"); ``` ### Testing SMS contents The content of an SMS message is available via the `text.body` property: ```java System.out.println(message.text().body()); // "Hi Jason, ..." ``` ```py print(message.text.body) # "Hi Jason, ..." ``` ```csharp Console.WriteLine(message.Text.Body); // "Hi Jason, ..." ``` ```ruby puts(message.text.body) # "Hi Jason, ..." ``` ```js console.log(message.text.body); // "Hi Jason, ..." ``` ### Testing links Any links that are found in the content of your SMS are automatically available via the `text.links` array: ```java // How many links? System.out.println(message.text().links().size()); // 2 Link firstLink = message.text().links().get(0); assertEquals("Google Search", firstLink.text()); assertEquals("https://www.google.com/", firstLink.href()); ``` ```py # How many links? print(len(message.text.links)) # 2 first_link = message.text.links[0] self.assertEqual("Google Search", first_link.text) self.assertEqual("https://www.google.com/", first_link.href) ``` ```csharp // How many links? Console.WriteLine(message.Text.Links.Count); // 2 var firstLink = message.Text.Links[0]; Assert.Equal("Google Search", firstLink.Text); Assert.Equal("https://www.google.com/", firstLink.Href); ``` ```ruby # How many links? puts(message.text.links.length) # 2 first_link = message.text.links[0] assert_equal("Google Search", first_link.text) assert_equal("https://www.google.com/", first_link.href) ``` ```js // How many links? console.log(message.text.links.length); // 2 const firstLink = message.text.links[0]; expect(firstLink.text).toBe("Google Search"); expect(firstLink.href).toBe("https://www.google.com/"); ``` ### Testing verification codes Codes are automatically extracted from the content of your SMS message. They are then made available via the `text.codes` array: ```java Code otp = message.text().codes().get(0); assertEquals("456812", otp.value()); ``` ```py otp = message.text.codes[0] self.assertEqual("456812", otp.value) ``` ```csharp var otp = message.Text.Codes[0]; Assert.Equal("456812", otp.Value); ``` ```ruby otp = message.text.codes[0] assert_equal("456812", otp.value) ``` ```js const otp = message.text.codes[0]; expect(otp.value).toBe("456812"); ``` ### Replying to an SMS message If your product is capable of handling SMS replies from your customers, you can use Mailosaur’s reply feature to simulate this. When you reply, the SMS is sent back to the phone number it was originally sent to Mailosaur from: ```java MessageReplyOptions options = new MessageReplyOptions(); options.withText("FYI"); mailosaur.messages().reply("MESSAGE_ID", options); ``` ```py options = MessageReplyOptions(text="FYI") mailosaur.messages.reply("MESSAGE_ID", options) ``` ```csharp mailosaur.Messages.Reply("MESSAGE_ID", new MessageReplyOptions() { Text = "FYI" } ); ``` ```ruby options = Mailosaur::Models::MessageReplyOptions.new() options.text = "FYI" mailosaur.messages.reply("MESSAGE_ID", options) ``` ```js await mailosaur.messages.reply("MESSAGE_ID", { text: "FYI", }); ``` | Parameter | Description | | ----------- | ------------------------------------------------------ | | text | Any additional text content to include in the reply | | html | Any additional HTML content to include in the reply | | subject | Optionally override the default subject line | | attachments | Optional attachments (see 'include attachments' above) | ### Forwarding a message to email You can forward messages from your Mailosaur account to external email addresses either one-by-one, or via the creation of automated forwarding rules. Before you can forward messages, **you must set up a [verified external email address](/docs/managing-your-account/external-email-addresses)**, so you can send email to it: ```java MessageForwardOptions options = new MessageForwardOptions(); options.withTo("verified-address@example.com") .withText("FYI"); mailosaur.messages().forward("MESSAGE_ID", options); ``` ```py recipient = "verified-address@example.com" options = MessageForwardOptions(recipient, text="FYI") mailosaur.messages.forward("MESSAGE_ID", options) ``` ```csharp mailosaur.Messages.Forward("MESSAGE_ID", new MessageForwardOptions() { To = "verified-address@example.com", Text = "FYI" } ); ``` ```ruby options = Mailosaur::Models::MessageForwardOptions.new() options.to = 'verified-address@example.com' options.text = 'FYI' mailosaur.messages.forward('MESSAGE_ID', options) ``` ```js await mailosaur.messages.forward("MESSAGE_ID", { to: "verified-address@example.com", text: "FYI", }); ``` | Parameter | Description | | --------- | ------------------------------------------------------------------------------------- | | to | The email address to which the message will be sent. Must be a verified email address | | text | Any additional text content to forward the message with | | html | Any additional HTML content to forward the message with | | subject | Optionally override the default subject line | ## Deleting messages ### Deleting an individual message Permanently deletes a single message. Also deletes any attachments related to the message. This operation cannot be undone: ```js await mailosaurClient.messages.del("MESSAGE_ID"); ``` ```java mailosaurClient.messages().delete("MESSAGE_ID"); ``` ```ruby mailosaurClient.messages.delete("MESSAGE_ID") ``` ```py mailosaurClient.messages.delete("MESSAGE_ID") ``` ```dotnet mailosaurClient.Messages.Delete("MESSAGE_ID"); ``` ### Delete all messages Permanently deletes all messages held in the specified inbox. Also deletes any attachments related to each message. This operation cannot be undone: ```js await mailosaurClient.messages.deleteAll("SERVER_ID"); ``` ```java mailosaurClient.messages().deleteAll("SERVER_ID"); ``` ```ruby mailosaurClient.messages.delete_all("SERVER_ID") ``` ```py mailosaurClient.messages.delete_all("SERVER_ID") ``` ```dotnet mailosaurClient.Messages.DeleteAll("SERVER_ID"); ``` ## See also - [Cucumber quickstart guide](/docs/automation/cucumber/quickstart) - [Cucumber email testing guide](/docs/automation/cucumber/email-testing) - [MFA/2FA guide](/docs/authenticator) --- Source: https://mailosaur.com/docs/automation/cypress # Using Mailosaur with Cypress All the guides you need to make the most of your Mailosaur subscription. Mailosaur is simple to integrate into Cypress. To make the most of Mailosaur's key features within Cypress, try our guides on email and SMS testing, integration, and more. ## Overview - Start by reading our [quickstart guide](/docs/automation/cypress/quickstart) for Cypress users - Read our guide on [Cypress email testing](/docs/automation/cypress/email-testing) - Learn how to test [SMS messages with Cypress](/docs/automation/cypress/sms-testing) ![YouTube Video](https://youtu.be/A8uXAu6j5pw?si=Ml6X547TkRZHUkHE) ## Generating a starter project If you have **npm** installed, you can generate a basic starter project for Cypress via the command line: ```sh npm create mailosaur@latest ``` ## Learn more - Try some [sample code](https://github.com/mailosaur/examples/tree/main/cypress) on GitHub. - Check out the [API reference](/docs/api) - detailed API documentation. - Read the documentation for [Mailosaur's Cypress plugin](https://github.com/mailosaur/cypress-mailosaur) on GitHub. - [API client libraries](/docs/automation) - Check out the other Mailosaur API clients. --- Source: https://mailosaur.com/docs/automation/cypress/email-testing # Email testing for Cypress Learn how to integrate Mailosaur Email Testing into Cypress. ## What you'll find in this guide - How to test various aspects of emails - Testing links and codes - Managing email tests ## What you'll need - An understanding of how to use Cypress. - A Mailosaur account. [Start a free trial](/app/signup) if you don't have one. - A Cypress project with Mailosaur's API client configured. [See our short guide](/docs/automation/cypress/quickstart) to get started. ## Basic usage To use Cypress for email testing, you need to: 1. Send an email message to your Mailosaur inbox (e.g. by requesting a password reset) 2. Connect to the Mailosaur API using our official client library. 3. Search for the email sent in step 1. 4. Perform assertions in the same way as any other test. To learn about Server IDs, and what to replace SERVER_ID with, [see sending test emails to Mailosaur](/docs/email-testing/sending-to-mailosaur). ```js // Search for the message cy.mailosaurGetMessage("SERVER_ID", { sentTo: "my-test@SERVER_ID.mailosaur.net", }).then((message) => { // Perform test assertions expect(message.from[0].name).to.equal("Support"); expect(message.from[0].email).to.equal("noreply@acme.com"); }); ``` This example searches for the email address that a message was sent to. You can also search using any of the below criteria: | **Parameter** | **Description** | | ------------- | ------------------------------------------------------------- | | sentTo | The full email address to which the target message was sent | | sentFrom | The full email address from which the target message was sent | | subject | Finds messages where the subject line contains this text | | body | Finds messages where the message body contains this text | ### Test email addresses Each inbox in your account (known as a server) has an identifier, referred to as a **Server ID**. Use this ID to give your inbox a domain name like this: `SERVER_ID.mailosaur.net`. This domain supports a wildcard email pattern, meaning any email address ending `@SERVER_ID.mailosaur.net` works immediately. **You don't need to create email addresses** before using them. If you need support creating unique email addresses, you can use this method: ```js cy.mailosaurGenerateEmailAddress("SERVER_ID").then((emailAddress) => { cy.log(emailAddress); // "bgwqj@SERVER_ID.mailosaur.net" }); ``` ## Find an email Search for a specific message within your inbox. We recommend using `cy.mailosaurGetMessage()`, as it will automatically wait for messages to arrive, and will return the full message result. ```js cy.mailosaurGetMessage("SERVER_ID", { sentTo: "test123@SERVER_ID.mailosaur.net", }).then((message) => { cy.log(message.html.body); }); ``` ### Time range for searching By default searches only look for messages received in the last hour. If you want to look further back than this, just set the 'received after' parameter. ```js // Calculate a datetime for yesterday const yesterday = new Date(Date.now() - 24 * 60 * 60 * 1000); // Use this timestamp in the search cy.mailosaurGetMessage("SERVER_ID", { sentTo: "test123@SERVER_ID.mailosaur.net", }, { receivedAfter: yesterday }).then((message) => { }); ``` ### "No matching messages" troubleshooting If you see the error "No matching messages found in time" when searching for messages: - Ensure that the target email or SMS message is visible in the Mailosaur Dashboard, as it may not have arrived at all. - Check when the message arrived. By default, searches only include messages received within the last hour. See "time range for searching" above on how to override this. - Check you have correctly set the **sent to** parameter in your search criteria. ## Alternate ways to fetch emails > [!WARNING] > > #### It is often preferable to use `cy.mailosaurGetMessage()` > > The `mailosaurListMessages` and `mailosaurSearchMessages` methods will only return basic summaries, meaning properties like the message body are not included. To get this data, you need to use `cy.mailosaurGetMessageById()`. We recommend using `cy.mailosaurGetMessage()` as it automatically waits for a matching result and returns the message. ### List current inbox contents See a full list of everything currently in your inbox. ```js // List the most recent messages cy.mailosaurListMessages("SERVER_ID") .then((result) => { // Get the most recent message (the first one in the list) const latestMessage = result.items[0]; // Get the full message object return cy.mailosaurGetMessageById(latestMessage.id); }) .then((message) => { cy.log(message.html.body); }); ``` ### Searching for multiple messages Identify if multiple messages meet the same criteria. ```js // Search for all messages sent to someone@SERVER_ID.mailosaur.net. // Limit results to the first 10 matches only. cy.mailosaurSearchMessages( "SERVER_ID", { sentTo: "someone@SERVER_ID.mailosaur.net", }, { page: 0, itemsPerPage: 10, } ) .then((result) => { // Get the most recent message (the first one in the list) const latestMessage = result.items[0]; // Get the full message object return cy.mailosaurGetMessageById(latestMessage.id); }) .then((message) => { cy.log(message.html.body); }); ``` ## Common test scenarios ### Testing basic properties Once you have an email (e.g. using `messages.get`), you can test the properties of that email: ```js // Test the email subject line expect(message.subject).to.equal("Password reset"); // Test sender information expect(message.from[0].name).to.equal("Support"); expect(message.from[0].email).to.equal("noreply@acme.com"); // Test recipient information expect(message.to[0].name).to.equal("John Smith"); expect(message.to[0].email).to.equal("john@SERVER.mailosaur.net"); ``` #### Testing carbon-copy recipients ```js // Carbon copy (CC) recipients expect(message.cc[0].name).to.equal("Jane Smith"); expect(message.cc[0].email).to.equal("jane@SERVER.mailosaur.net"); // Blind carbon copy (BCC) recipients expect(message.bcc[0].name).to.equal("Jill Smith"); expect(message.bcc[0].email).to.equal("jill@SERVER.mailosaur.net"); ``` ### Testing email contents Most emails will contain separate HTML and plain text content. Here's how to test each type: #### Plain text content ```js // Check that the email contains some text cy.log(message.text.body); // "Hi Jason, ..." ``` #### HTML content With HTML, you can perform basic contains or equals assertions in the same way as plain text content: ```js // Check that raw HTML contains some expected content cy.log(message.html.body); // "Hello world" ``` ### Testing links Any links in the content of your email are instantly available via the `html.links` or `text.links` arrays, depending on which content the link was found in: ```js // Working with links in HTML content const linkInHtml = message.html.links[0]; expect(linkInHtml.text).to.equal("Google Search"); expect(linkInHtml.href).to.equal("https://www.google.com/"); // Working with links in plain text content const linkInPlainText = message.text.links[0]; expect(linkInPlainText.href).to.equal("https://www.google.com/"); ``` #### Clicking a link To simulate a link being clicked, without needing to do anything on the target page, use `HttpClient`: ```js const https = require("https"); // ... const href = message.html.links[0].href; // Make an HTTP call to simulate someone clicking a link https.get(href, (r) => cy.log(r.statusCode)); // 200 ``` ### Testing verification codes Codes are automatically extracted from the content of your message and made available via the `html.codes` or `text.codes` arrays: ```js // Working with codes in HTML content const codeInHtml = message.html.codes[0]; expect(codeInHtml.value).to.equal("456812"); // Working with codes in plain text content const codeInText = message.text.codes[0]; expect(codeInText.value).to.equal("456812"); ``` ### Testing attachments Any email attachments are made available via the attachments array: ```js // Number of attachments found cy.log(message.attachments.length); // 2 // Get the first attachment const attachment = message.attachments[0]; // Check attachment attributes expect(attachment.fileName).to.equal("example.pdf"); expect(attachment.contentType).to.equal("application/pdf"); expect(attachment.length).to.equal(4028); ``` #### Save an attachment to disk You can download and save attachments using the `files.getAttachment` and `fs` methods: ```js const firstAttachment = message.attachments[0]; const file = await mailosaur.files.getAttachment(firstAttachment.id); fs.writeFileSync(firstAttachment.fileName, file); ``` #### Encoding attachments In some scenarios you may need a base64-encoded copy of an attachment: ```js const firstAttachment = message.attachments[0]; const file = await mailosaur.files.getAttachment(firstAttachment.id); const base64 = file.toString("base64"); console.log(base64); ``` ### Testing images and web beacons Any images found within the HTML content of an email are made available via the `html.images` array: ```js // Number of images found cy.log(message.html.images.length); // Get the first image const image = message.html.images[0]; // Check image attributes expect(image.src).to.equal("https://example.com/balloon.png"); expect(image.alt).to.equal("A hot air balloon"); ``` To test whether an image is accessible online, or that a [web beacon](https://en.wikipedia.org/wiki/Web_beacon) is working correctly, you can perform an HTTP request: ```js const https = require("https"); // ... const image = message.html.images[0]; cy.log(image.src); // "https://example.com/s.png?abc123" // Make an HTTP call to trigger the web beacon https.get(image.src, (r) => cy.log(r.statusCode)); // 200 ``` ### Sending an email If your product is capable of handling inbound emails, use Mailosaur's sending feature to trigger this functionality in your product. The `messages.create` command creates and sends an email to a verified external email address: ```js cy.mailosaurCreateMessage("SERVER_ID", { to: "verified-address@example.com", send: true, subject: "Request", text: "Please can you give us a call back?", }); ``` The options available to use with this method are: | Parameter | Description | | ----------- | ------------------------------------------------------------------------------------ | | send | This must be set to true if you are sending an outbound email | | to | The email address to which the email will be sent. Must be a verified email address. | | subject | The email subject line | | text | The plain text body of the email. | | html | The HTML body of the email. | | attachments | Optional attachments (see 'include attachments' below) | #### Include attachments You can include attachments in emails sent via the API, by including an array of base64-encoded attachment objects: ```js const attachments = [ { fileName: "cat.png", contentType: "image/png", content: "{BASE64_ENCODED_FILE}", }, ]; cy.mailosaurCreateMessage("SERVER_ID", { to: "verified-address@example.com", send: true, subject: "Email from Mailosaur", html: "

Hello world.

", attachments: attachments, }); ``` ### Replying to an email If your product is capable of handling customer replies, Mailosaur's reply feature can simulate this. Any reply is sent back to the address it was originally sent from: ```js cy.mailosaurReplyToMessage("MESSAGE_ID", { text: "FYI", }); ``` | Parameter | Description | | ----------- | ------------------------------------------------------ | | text | Any additional text content to include in the reply | | html | Any additional HTML content to include in the reply | | subject | Optionally override the default subject line | | attachments | Optional attachments (see 'include attachments' above) | ### Forwarding a message to email You can forward messages from your Mailosaur account to external email addresses one-by-one, or via the creation of automated forwarding rules. Before you do this, **you must set up a [verified external email address](/docs/managing-your-account/external-email-addresses)**: ```js cy.mailosaurForwardMessage("MESSAGE_ID", { to: "verified-address@example.com", text: "FYI", }); ``` | Parameter | Description | | --------- | ------------------------------------------------------------------------------------- | | to | The email address to which the message will be sent. Must be a verified email address | | text | Any additional text content to forward the message with | | html | Any additional HTML content to forward the message with | | subject | Optionally override the default subject line | ## Deleting messages ### Deleting an individual message Permanently deletes a single message and associated attachments. This operation cannot be undone: ```js cy.mailosaurDeleteMessage("MESSAGE_ID"); ``` ### Delete all messages Permanently deletes all messages and attachments held in the specified inbox. This operation cannot be undone: ```js cy.mailosaurDeleteAllMessages("SERVER_ID"); ``` ## See also - [SMS testing guide](/docs/automation/cypress/sms-testing) - [MFA/2FA guide](/docs/authenticator) --- Source: https://mailosaur.com/docs/automation/cypress/quickstart # Mailosaur and Cypress - Quickstart guide Get Mailosaur up and running within your Cypress project in a few steps. ## What you'll need - A Mailosaur account. If you don't already have one, [create a free trial account](/app/signup). - [An API key](/app/keys). Log in to your account and generate one in order to run automated tests. - Knowledge of how to send emails (or SMS) into your account. ## Express: Generate a sample project If you have **npm** installed, you can generate a basic starter project for Cypress via the command line: ```sh npm create mailosaur@latest ``` This will give you a simple Cypress project with Mailosaur already configured, along with some basic tests that show how a project would typically work. You can also see similar [sample code](https://github.com/mailosaur/examples/tree/main/cypress) on GitHub. ## Integrate with an existing Cypress project If you have an existing Cypress project, or have just created one, you'll need to install and configure Mailosaur's API client library: ### Install the Mailosaur plugin Mailosaur provides an official set of custom commands for automating email testing in Cypress. Extend Cypress by installing Mailosaur’s custom commands package: [cypress-mailosaur](https://github.com/mailosaur/cypress-mailosaur). 1. Install the plugin via `npm`: ```bash npm install cypress-mailosaur ``` 2. Open `cypress/support/e2e.js` in your project folder, and add the following line of code to it: ```js import "cypress-mailosaur"; ``` 3. Add your [Mailosaur API key](/app/keys) to `cypress.config.js`, in your project folder: ```js module.exports = defineConfig({ env: { MAILOSAUR_API_KEY: "YOUR_API_KEY", }, // ... }); ``` **Note:** We strongly recommend against storing API keys in source control. Therefore you can also set your API key using the environment variable `CYPRESS_MAILOSAUR_API_KEY`. ### Make your first API call ```js // Make a simple API call to find the name of your inbox cy.mailosaurListServers().then((result) => { cy.log(`Inbox name is ${result.items[0].name}`); }); ``` ## Start testing Now that you have a project connected to the Mailosaur API, you can start creating a variety of tests: - [Email testing](/docs/automation/cypress/email-testing) - test password resets, account verification, order confirmations, etc. - [SMS testing](/docs/automation/cypress/sms-testing) - test alerts, notifications, and 2FA logins - [2FA app testing](/docs/authenticator) - mimic the functionality of apps like Google Authenticator and Auth0 - [Email deliverability testing](/docs/api) --- Source: https://mailosaur.com/docs/automation/cypress/sms-testing # SMS testing for Cypress Learn how to test every element of your SMS communication within Cypress. ## What you'll find in this guide - How to test various aspects of SMS - Testing links and codes - Managing SMS tests ## What you'll need - An understanding of how to use Cypress. - A Mailosaur account with the SMS feature enabled. If you don't have one already, you can [start a free trial](/app/signup). - A Cypress project with Mailosaur's API client configured. [See our short guide](/docs/automation/cypress/quickstart) on this. ## Basic usage To perform SMS testing with Cypress, all you need to do is: 1. Send an SMS message to your dedicated Mailosaur phone number. 2. Connect to the Mailosaur API with the official client library. 3. Search for the message you sent in step 1. 4. Perform assertions in the same way you would for any other test. If you would like to learn about Server IDs, and what to replace SERVER_ID with, [see sending test emails to Mailosaur](/docs/email-testing/sending-to-mailosaur). ```js // Search for the message cy.mailosaurGetMessage("SERVER_ID", { sentTo: "123456789", // Phone number }).then((message) => { // Perform test assertions expect(message.from[0].name).to.equal("Support"); expect(message.from[0].phone).to.equal("654321"); }); ``` The above example will search for the phone number that a message was sent to. You can also use any of the below criteria to search: | **Parameter** | **Description** | | ------------- | ------------------------------------------------------------ | | sentTo | The full phone number to which the target message was sent | | sentFrom | The full phone number from which the target message was sent | | body | Finds messages where the message body contains this text | ## Find an SMS message Search for a specific message in your inbox. We recommend using `cy.mailosaurGetMessage()`, as this will automatically wait for messages to arrive, and then return the full message result. ```js cy.mailosaurGetMessage("SERVER_ID", { sentTo: "123456789", }).then((message) => { cy.log(message.text.body); }); ``` ### Time range for searching By default searches only look for messages received in the last hour. If you want to look further back than this, just set the 'received after' parameter. ```js // Calculate a datetime for yesterday const yesterday = new Date(Date.now() - 24 * 60 * 60 * 1000); // Use this timestamp in the search cy.mailosaurGetMessage("SERVER_ID", { sentTo: "123456789", }, { receivedAfter: yesterday }).then((message) => { }); ``` ### "No matching messages" troubleshooting If you see the error "No matching messages found in time" when searching for messages: - Ensure that the target email or SMS message is visible in the Mailosaur Dashboard, as it may not have arrived at all. - Check when the message arrived. By default, searches only include messages received within the last hour. See "time range for searching" above on how to override this. - Check you have correctly set the **sent to** parameter in your search criteria. ## Other methods of fetching SMS messages > [!WARNING] > > #### It is usually better to use `cy.mailosaurGetMessage()` > > The `mailosaurListMessages` and `mailosaurSearchMessages` methods will only return basic summaries, leaving certain properties, such as the message body, out. To get this data, use `cy.mailosaurGetMessageById()`. We recommend using the `cy.mailosaurGetMessage()` as this automatically waits for a matching result and returns the message. ### Search for multiple messages Identify if multiple messages meet the same criteria. ```js // Search for all messages sent to 123456789. // Limit results to the first 10 matches only. cy.mailosaurSearchMessages( "SERVER_ID", { sentTo: "123456789", }, { page: 0, itemsPerPage: 10, } ) .then((result) => { // Get the most recent message (the first one in the list) const latestMessage = result.items[0]; // Get the full message object return cy.mailosaurGetMessageById(latestMessage.id); }) .then((message) => { cy.log(message.text.body); }); ``` ### List current inbox contents List everything that is currently in your inbox. ```js // List the most recent messages cy.mailosaurListMessages("SERVER_ID") .then((result) => { // Get the most recent message (the first one in the list) const latestMessage = result.items[0]; // Get the full message object return cy.mailosaurGetMessageById(latestMessage.id); }) .then((message) => { cy.log(message.text.body); }); ``` ## Common test scenarios ### Testing basic properties Once an SMS has been retrieved, you can effectively test the properties of that text: ```js // Test sender information expect(message.from[0].name).to.equal("Support"); expect(message.from[0].phone).to.equal("654321"); // Test recipient information expect(message.to[0].name).to.equal("John Smith"); expect(message.to[0].phone).to.equal("1234567890"); ``` ### Testing SMS contents The content of an SMS message is available via the `text.body` property: ```js cy.log(message.text.body); // "Hi Jason, ..." ``` ### Testing links Any links found in SMS content are automatically available via the `text.links` array: ```js // How many links? cy.log(message.text.links.length); // 2 const firstLink = message.text.links[0]; expect(firstLink.text).to.equal("Google Search"); expect(firstLink.href).to.equal("https://www.google.com/"); ``` ### Testing verification codes Codes are automatically extracted from the content of your SMS message. They are available via the `text.codes` array: ```js const otp = message.text.codes[0]; expect(otp.value).to.equal("456812"); ``` ### Replying to an SMS message If your product handles SMS replies from your customers, you can use Mailosaur’s reply feature to simulate responses. The SMS is sent back to the phone number it was originally sent to Mailosaur from: ```js cy.mailosaurReplyToMessage("MESSAGE_ID", { text: "FYI", }); ``` | Parameter | Description | | ----------- | ------------------------------------------------------ | | text | Any additional text content to include in the reply | | html | Any additional HTML content to include in the reply | | subject | Optionally override the default subject line | | attachments | Optional attachments (see 'include attachments' above) | ### Forwarding a message to email You can forward messages from your Mailosaur account to external email addresses either one-by-one, or via automated forwarding rules. However, to forward messages, **you must set up a [verified external email address](/docs/managing-your-account/external-email-addresses)**: ```js cy.mailosaurForwardMessage("MESSAGE_ID", { to: "verified-address@example.com", text: "FYI", }); ``` | Parameter | Description | | --------- | ------------------------------------------------------------------------------------- | | to | The email address to which the message will be sent. Must be a verified email address | | text | Any additional text content to forward the message with | | html | Any additional HTML content to forward the message with | | subject | Optionally override the default subject line | ## Deleting messages ### Deleting an individual message Permanently deletes a single message and any attachments related to it. This operation cannot be undone: ```js cy.mailosaurDeleteMessage("MESSAGE_ID"); ``` ### Delete all messages Permanently deletes all messages held in the specified inbox, along with all related attachments. This operation cannot be undone: ```js cy.mailosaurDeleteAllMessages("SERVER_ID"); ``` ## See also - [Email testing guide](/docs/automation/cypress/email-testing) - [MFA/2FA guide](/docs/authenticator) --- Source: https://mailosaur.com/docs/automation/dotnet # How to test email and SMS in .NET Learn how to automate testing of email and SMS messages in .NET, using Mailosaur. ## 1. Create a Mailosaur account If you already have an account, skip to step 2. To create a new trial account, [sign up here](/app/signup). ## 2. Create a sample project ### Install .NET To see if you already have .NET installed, open a terminal window and run this command: ```bash dotnet --version ``` If .NET is installed, you’ll see a version number. If you see an error instead, then [download .NET from Microsoft](https://dotnet.microsoft.com/en-us) and install it. ### Create a new project Run each of these commands to create a new .NET project: ```bash mkdir EmailTests cd EmailTests dotnet new console ``` ### Install the Mailosaur .NET library Run this command to install the [Mailosaur NuGet package](https://github.com/mailosaur/mailosaur-dotnet): ```bash dotnet add package mailosaur ``` ## 3. Send email to your Mailosaur inbox Inboxes allow you to group tests, permissions, and other settings together. Each inbox has an **Inbox ID** and a **domain name**. You need these values to both send email to Mailosaur, and to set up automated testing. You also need an [API key](/docs/managing-your-account/api-keys) to use. You can learn more about [creating API keys here](/docs/managing-your-account/api-keys). ### Retrieve your inbox’s attributes 1. In the left-hand navigation, locate the **Inboxes** section. 2. Click on the name of the inbox you want to test with. 3. Click the **Settings** tab. 4. Make a note of the **Inbox ID** and **Domain**. 5. Get an API key from the [API Keys](/app/keys) page. ### Send an email to your inbox If the **domain name** of your inbox above was: ```bash example.mailosaur.net ``` Then you can send an email to it with these steps: 1. Open up an email client and send an email to `anything@example.mailosaur.net` 2. In the left-hand navigation, locate the **Inboxes** section. 3. Click on the name of the inbox you sent an email to. 4. Confirm the email is there. Note that some services (like Gmail) may take 10-20 seconds to send a message through. To learn more, read our guide on [sending email to Mailosaur](/docs/email-testing/sending-to-mailosaur). ## 4. Find an email for automated testing Now that you have a sample project, your inbox’s credentials, and an email to test, then you’re ready to continue. Open the file in your new project called `Program.cs` and type or paste in this code sample, replacing the template code with the values from step 3 above: ```csharp using System; using Mailosaur; using Mailosaur.Models; namespace EmailTests { class Program { static void Main(string[] args) { // Find these on the API Keys page and your inbox's Settings tab var apiKey = "YOUR_API_KEY"; var serverId = "SERVER_ID"; var serverDomain = "SERVER_DOMAIN"; var mailosaur = new MailosaurClient(apiKey); // Wait for an email to arrive, matching this search criteria var criteria = new SearchCriteria() { SentTo = "anything@" + serverDomain }; var email = mailosaur.Messages.Get(serverId, criteria); // If we have an email, print the subject Console.WriteLine("Subject: " + email.Subject); } } } ``` This code connects to Mailosaur and looks for any email that has been sent to the address provided in the search criteria. Save your changes and run the code: ```bash dotnet run ``` If everything is set up correctly, you should see the subject line of the last email you sent, printed to screen: ```bash Subject: My example email ``` ### Troubleshooting If you see an error, e.g. ‘No matching messages found in time’: - Make sure you have set the **sent to** address correctly in your code. - Ensure that you have sent an email to the **sent to** address (check this is visible in the Mailosaur Dashboard). - Note that by default, the **get** method will only look for messages that were received by Mailosaur within the last hour. You can override this using the `receivedAfter` option (see library reference below). ## 5. Narrowing your search results ### Only find messages received after a certain time By default, searches include messages received in the last hour, but you can customise the search window with the `receivedAfter` option. This example shows you how to only include emails received after your test started: ```csharp var testStart = DateTime.UtcNow; // Perform the steps that send a message here var criteria = new SearchCriteria() { SentTo = "..." }; var message = mailosaur.Messages.Get( "SERVER_ID", criteria, receivedAfter: testStart ); ``` ### Search criteria As you can see in the examples so far, you can search for the email address or phone number a message was sent to, but you can also search using these criteria: | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **SentFrom** | The full email address from which the target message was sent. | | **SentTo** | The full email address to which the target message was sent. | | **Subject** | Find emails where the subject line contains this text. | | **Body** | Finds messages where the message body contains this text. | ## 6. Start writing tests Now that you have a working project that fetches an email, you can use this to begin writing tests for various pieces of functionality. Check out these guides on the most common test cases: > [!LINK](/docs/automation/text-content) > ### How to test the text content of email or SMS > Learn how to test the text content of email or SMS with Mailosaur. > [!LINK](/docs/automation/html-content) > ### HTML content of an email > Learn how to work with the HTML content found within your emails. > [!LINK](/docs/automation/codes) > ### Extracting codes from email and SMS > Learn how to test verification codes found in email and SMS messages with Mailosaur. > [!LINK](/docs/automation/links) > ### Extracting links from email and SMS > Learn how to test hyperlinks found in email and SMS messages with Mailosaur. > [!LINK](/docs/automation/attachments) > ### Email attachments > Learn how to test the email attachments with Mailosaur. > [!LINK](/docs/automation/images) > ### Images and web beacons > Learn how to work with images, including web beacons, within an HTML email. > [!LINK](/docs/automation/message-properties) > ### Message properties > Learn how to test the common properties of an email or SMS message with Mailosaur. > [!LINK](/docs/automation/spam) > ### How to test email spam score > Learn how to test the SpamAssassin score of an email with Mailosaur. ## SMS Testing You can test SMS messages in much the same way as email. Take a look at our [guide on testing SMS messages](/docs/sms-testing) for more information. ## Library reference The .NET client library gives you access to several other methods. ### Messages Messages is the collective name given to the email and/or SMS messages that are sent into Mailosaur for testing. The [message object](/docs/api) contains everything you need to perform in-depth automated testing. #### Messages.Get(server, criteria, options) Waits for a message to be found. Returns as soon as a message matching the specified search criteria is found. This is the most efficient method of looking up a message, therefore we recommend using it whenever possible. ```csharp var message = mailosaur.Messages.Get("SERVER_ID", new SearchCriteria() { SentTo = "someone@SERVER_ID.mailosaur.net" }); ``` To learn about inbox IDs, and what to replace `SERVER_ID` with, see [sending email to Mailosaur](/docs/email-testing/sending-to-mailosaur). ##### Criteria | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **SentFrom** | The full email address from which the target message was sent. | | **SentTo** | The full email address to which the target message was sent. | | **Subject** | The subject line of the target email. | | **Body** | Search for part of the message body. | | **Match** | If set to `ALL` (default), then only results that match all specified criteria will be returned. If set to `ANY`, results that match any of the specified criteria will be returned. | ##### Options | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **timeout** | Specify how long to wait for a matching result (in milliseconds, _default value is 10 seconds_). | | **receivedAfter** | Limits results to only messages received after this date/time (_default 1 hour ago_). | ```csharp // Search all messages received after midnight on a specific var message = mailosaur.Messages.Get("SERVER_ID", new SearchCriteria() { SentTo = "someone@SERVER_ID.mailosaur.net" }, receivedAfter: new DateTime(2020, 1, 5)); ``` #### Messages.List(server, options) Returns a list of your messages in summary form. The summaries are returned sorted by received date, with the most recently-received messages appearing first. > [!SUCCESS] > The method returns a message summary, rather than the full message object. This means that several properties, like the message body, are not included. To get this data, you’ll need to call [`GetById`](#messagesgetbyidid). Alternatively, we recommend using the [`Get`](#messagesgetserver-criteria-options) method, which is a far more efficient approach. ```csharp // List the most recent messages var result = mailosaur.Messages.List("SERVER_ID"); // Get the most recent message (the first one in the list) var message = result.Items[0]; Console.WriteLine("Subject: " + message.Subject); ``` ##### Options - **receivedAfter** Allows you to customise how far back to look for messages. - **page** Used alongside `itemsPerPage` to paginate through results. This is zero-based, meaning `0` is the first page of results. - **itemsPerPage** A limit on the number of results to be returned. This can be set between 1 to 1000, with the default being 50. - **dir** Optionally limits results based on the direction (`Sent` or `Received`), with the default being `Received`. ```csharp // List all results received after midnight on a specific date // Limit results to the first 10 matches only. var result = mailosaur.Messages.List("SERVER_ID", 0, 10, new DateTime(2020, 1, 3)); ``` #### Messages.Search(server, criteria, options) Returns a list of messages matching the specified search criteria, in summary form. The messages are returned sorted by received date, with the most recently-received messages appearing first. > [!SUCCESS] > The method returns a message summary, rather than the full message object. This means that several properties, like the message body, are not included. To get this data, you’ll need to call [`GetById`](#messagesgetbyidid). Alternatively, we recommend using the [`Get`](#messagesgetserver-criteria-options) method, which is a far more efficient approach. ```csharp var result = mailosaur.Messages.Search("SERVER_ID", new SearchCriteria() { SentTo = "someone@SERVER_ID.mailosaur.net" }); // Get the most recent match var message = result.Items[0]; Console.WriteLine("Subject: " + message.Subject); ``` ##### Criteria | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **SentFrom** | The full email address from which the target message was sent. | | **SentTo** | The full email address to which the target message was sent. | | **Subject** | The subject line of the target email. | | **Body** | Search for part of the message body. | | **Match** | If set to `ALL` (default), then only results that match all specified criteria will be returned. If set to `ANY`, results that match any of the specified criteria will be returned. | ##### Options | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **timeout** | If provided, determines how long to wait for a matching result (provided in milliseconds). | | **errorOnTimeout** | When set to `false`, an error will not be thrown if timeout is reached (default: `true`). | | **receivedAfter** | Allows you to customise how far back to look for messages. | | **page** | Used alongside `itemsPerPage` to paginate through results. This is zero-based, meaning `0` is the first page of results. | | **itemsPerPage** | A limit on the number of results to be returned. This can be set between 1 to 1000, with the default being 50. | | **dir** | Optionally limits results based on the direction (`Sent` or `Received`), with the default being `Received`. | ```csharp // Search for all messages sent to someone@SERVER_ID.mailosaur.net, // received after midnight on a specific date. Limit results to // the first 10 matches only. var result = mailosaur.Messages.Search("SERVER_ID", new SearchCriteria() { SentTo = "someone@SERVER_ID.mailosaur.net" }, page: 0, itemsPerPage: 10, receivedAfter: new DateTime(2020, 1, 3)); ``` #### Messages.GetById(id) Retrieves the detail for a single email message. Must be used in conjunction with either [`List`](#messageslistserver-options) or [`Search`](#messagessearchserver-criteria-options) in order to get the unique identifier for the required message. **We always recommend using the** [`Get`](#messagesgetserver-criteria-options) **method instead**. ```csharp var result = mailosaur.Messages.List("SERVER_ID"); var messageId = result.Items[0].Id; var message = mailosaur.Messages.GetById(messageId); Console.WriteLine("Subject: " + message.Subject); ``` #### Messages.Delete(id) Permanently deletes a message. Also deletes any attachments related to the message. This operation cannot be undone. ```csharp mailosaur.Messages.Delete(messageId); ``` #### Messages.DeleteAll(server) Permanently deletes all messages held in the specified inbox. Also deletes any attachments related to each message. This operation cannot be undone. ```csharp mailosaur.Messages.DeleteAll("SERVER_ID"); ``` #### Messages.Create(server, messageCreateOptions) Creates a new message that can be sent to a verified email address. This is useful in scenarios where you want an email to trigger a workflow in your product. ```csharp mailosaur.Messages.Create("SERVER_ID", new MessageCreateOptions() { To = "verified-address@example.com", Send = true, Subject = "Request" Text = "Please can you give us a call back?" }); ``` ##### Options - **to** The email address to which the email will be sent. Must be a verified email address. - **send** If true, email will be sent upon creation. - **subject** The email subject line. - **text** The plain text body of the email. - **html** The HTML body of the email. #### Messages.Forward(messageId, messageForwardOptions) Forwards the specified email to a verified email address. ```csharp mailosaur.Messages.Forward("MESSAGE_ID", new MessageForwardOptions() { To = "verified-address@example.com", Text = "FYI" }); ``` ##### Options - **to** The email address to which the email will be sent. Must be a verified email address. - **text** Any additional plain text content to forward the email with. - **html** Any additional HTML content to forward the email with. #### Messages.Reply(messageId, messageReplyOptions) Sends a reply to the specified email. This is useful for when simulating a user replying to one of your emails. ```csharp mailosaur.Messages.Reply("MESSAGE_ID", new MessageReplyOptions() { Text = "FYI" }); ``` ##### Options - **text** Any additional plain text content to include in the reply. - **html** Any additional HTML content to include in the reply. ### Servers Inboxes capture emails and SMS messages, group your tests and settings, and manage access for your team. #### Servers.List() Returns a list of your inboxes. Inboxes are returned sorted in alphabetical order. ```csharp ServerListResult result = mailosaur.Servers.List(); Console.WriteLine("You have an inbox called: " + result.Items[0].Name); ``` #### Servers.Create(server) Creates a new inbox. Only the `name` property is required to create a new inbox via the API. ```csharp var options = new ServerCreateOptions("My email tests"); mailosaur.Servers.Create(options); ``` #### Servers.Get(id) Retrieves the detail for a single inbox. Simply supply the unique identifier for the required inbox. ```csharp var server = mailosaur.Servers.Get("SERVER_ID"); ``` #### Servers.GetPassword(id) Retrieves the password, for use with SMTP and POP3, for a single inbox. Simply supply the unique identifier for the required inbox. ```csharp var password = mailosaur.Servers.GetPassword("SERVER_ID"); ``` #### Servers.Update(id, server) Updates a single inbox. ```csharp var retrievedServer = mailosaur.Servers.Get("SERVER_ID"); retrievedServer.Name = "Updated inbox name"; mailosaur.Servers.Update(retrievedServer.Id, retrievedServer); ``` #### Servers.Delete(id) Permanently deletes an inbox. Also deletes all messages and associated attachments within the inbox. This operation cannot be undone. ```csharp mailosaur.Servers.Delete("SERVER_ID"); ``` #### Servers.GenerateEmailAddress(id) Utility method to help you generate a random email address for a given inbox. ```csharp var emailAddress = mailosaur.Servers.GenerateEmailAddress("SERVER_ID"); Console.WriteLine(emailAddress); // "bgwqj@SERVER_ID.mailosaur.net" ``` To learn about inbox IDs, and what to replace `SERVER_ID` with, see [sending email to Mailosaur](/docs/email-testing/sending-to-mailosaur). ### Files #### Files.GetEmail(messageId) Downloads an EML file representing the specified email. Simply supply the unique identifier for the required email. #### Files.GetAttachment(attachmentId) Downloads a single attachment. Simply supply the unique identifier for the required attachment. ### Analysis #### Analysis.Spam(messageId) Perform spam testing on the specified email. ### Usage #### Usage.Limits() Retrieve account usage limits. Details the current limits and usage for your account. This endpoint requires authentication with an account-level API key. #### Usage.Transactions() Retrieves the last 31 days of transactional usage. This endpoint requires authentication with an account-level API key. --- Source: https://mailosaur.com/docs/automation/ghost-inspector # How to test email and SMS using Ghost Inspector Test email and SMS with Ghost Inspector - the all-in-one website test and monitoring service and Mailosaur, the number one email and SMS testing service. ## What is Ghost Inspector? [Ghost Inspector](https://ghostinspector.com) lets you create automated website tests and set up monitoring suites. It makes automated testing for websites and web apps easier, especially with its [web test recorder](https://docs.ghostinspector.com/test-recorder), which allows you to easily record tests from right within your web browser. As you're here, there is a good chance you know about Ghost Inspector already, but if you don't, we highly recommend their [official getting started guide and video](https://ghostinspector.com/docs/getting-started). ## What is Mailosaur? Mailosaur lets you test email and SMS messages as part of your end-to-end automated testing. This is particularly important for websites and web apps that send an email (password resets, account setup, marketing emails, etc.) or SMS message (multi-factor authentication, verification, etc.). If you don’t already have one, you’ll need to [create a free trial account](/app/signup). Once you’re in, familiarize yourself with [sending email into Mailosaur](/docs/email-testing/sending-to-mailosaur). Once you have this working, you’re ready to start testing! ## 1. Get Started ### Creating an account Create a [free trial account](/app/signup) for Mailosaur via the website. Once you have this, open your inbox from the **Inboxes** section of the left-hand navigation, then click the **Settings** tab. You need the following values: - **Inbox ID** - Every [inbox](/docs/inboxes) has a unique ID. You need this ID whenever you interact with an inbox via the API. - **Inbox Domain** - Every inbox has its own domain name. You'll need this to send email to your inbox. - **API Key** - Get one from the [API Keys](/app/keys) page. You can create an API key per inbox (recommended), or an account-level API key to use across your whole account. [Learn more about API keys](/docs/managing-your-account/api-keys). ### Test email addresses with Mailosaur Mailosaur gives you an unlimited number of test email addresses - with no setup or coding required! This is because every inbox uses a catch-all/wildcard pattern. Here's what that means: - When you create an account, you are given an inbox. - Every inbox has its own **Inbox Domain** name (e.g. `abc123.mailosaur.net`) - Any email address that ends with `@{YOUR_SERVER_DOMAIN}` will work with Mailosaur without any special setup. For example: - `build-423@abc123.mailosaur.net` - `john.smith@abc123.mailosaur.net` - `rAnDoM63423@abc123.mailosaur.net` - You can create more inboxes when you need them. Each one will have its own domain name. > [!INFO] > You can also [use SMTP to test email](/docs/email-testing/sending-to-mailosaur#0-sending-directly-via-smtp). By connecting your product or website to Mailosaur via SMTP, Mailosaur will catch all email your application sends, regardless of the email address. ### Understanding the API Because Ghost Inspector runs all your tests in the browser, we’re going to use [Mailosaur.js](/docs/automation/javascript) (our client-side API library). This guide will take you through all the key use cases, but it’s worth remembering that the library is powered by the Mailosaur [Email & SMS Testing API](/docs/api). You can easily check out the API itself by looking at our [API reference documentation](/docs/api) or via our Postman or Insomnia collections: ![Postman](https://app.getpostman.com/run-collection/6961255-6cc72dff-f576-451a-9023-b82dec84f95d?action=collection%2Ffork&collection-url=entityId%3D6961255-6cc72dff-f576-451a-9023-b82dec84f95d%26entityType%3Dcollection%26workspaceId%3D386a4af1-4293-4197-8f40-0eb49f831325) ![Insomnia](https://insomnia.rest/run/?label=Mailosaur&uri=https%3A%2F%2Fmailosaur.com%2Finsomnia.json) ## 2. Create a new Ghost Inspector test suite Navigate to [Ghost Inspector](https://app.ghostinspector.com), and create a new test suite. This is done by clicking **New > New suite** in the top-right of the page. Give your suite a name and click **Create Suite**. ## 3. Add steps that trigger an email You now need some test steps that will cause an email to be sent from your website or product. As discussed above, you have an unlimited number of [test email addresses](#0-test-email-addresses-with-mailosaur) with Mailosaur. In this example, we will navigate to the [Mailosaur Playground](https://example.mailosaur.com) to mimic a real world product that has a password reset feature. Ghost Inspector has an awesome browser extension to allow you to quickly record these steps yourself in the browser, but in this guide we’re going to do this manually, because that’s how we roll… 💪 1. Under **Create new test**, on the right of the screen, we type “Request Password Reset”. 2. Next, input the starting URL (in our example, that's `https://example.mailosaur.com/password-reset`). 3. Click **Create**. 4. Next, add a step to fill in the email address on the password reset form. In the screenshot below you can see we use an **Assign** step to set the input field (`#email`) to our test email address of `ghost-inspector@abc123.mailosaur.net`. Note that `abc123.mailosaur.net` is our Inbox Domain (from step 1 above), and `ghost-inspector` is any string we want (you don’t need to create email addresses with Mailosaur). 5. Finally, add a step to submit the password reset request - a simple button click is all we need. Running this test allows us to successfully _request_ a password reset. But to complete the process, we need to find that email and follow the link inside it. ## 4. Find the email ### Using Mailosaur.js in a web browser Mailosaur has libraries to write tests in [various languages](/docs/automation). As Ghost Inspector runs in the browser, we need to use [Mailosaur.js](/docs/automation/javascript) which allows us to do email and SMS testing from within a web browser. To do this, **you must first** [verify your website or web app's domain name](/docs/managing-your-account/managing-domains). Go to the [Domains](/app/account/domains) section of the Mailosaur Dashboard, and follow the on-screen instructions to add a new verified domain. ### Execute JavaScript to import the Mailosaur.js library To pull [Mailosaur.js](/docs/automation/javascript) into our Ghost Inspector test, add an **Execute JavaScript** step, with the following code: ```js (function (e, m, a, i, l) { i = e.createElement(m), l = e.getElementsByTagName(m)[0]; i.async = 1; i.src = a; e.body.appendChild(i) })(document, 'script', 'https://mailosaur.com/v1/mailosaur.js'); ``` ### Extract the email into a variable Next, we need to find our email and extract the result into a variable that we can use else where in our Ghost Inspector suite. To do this, add an **Extract from JavaScript** step, with the following code (note that we [discussed the values](#0-creating-an-account) to use for `apiKey` and `serverId` [above](#0-creating-an-account)): ```js return new Promise(function (resolve, reject) { const apiKey = 'YOUR_API_KEY'; const serverId = 'abc123'; const mailosaur = Mailosaur(apiKey); const promise = mailosaur.messages.get(serverId, { sentTo: 'ghost-inspector@abc123.mailosaur.net' }); promise.then(resolve).catch(reject); }) ``` In the **Variable name** field, type “message”. Let’s break down what the code above actually does: - First, it is an async method, so Ghost Inspector requires that we first return a Promise. - Inside that, we set variables for our `apiKey` and `serverId`, the values for which we [discussed above](/docs/automation/ghost-inspector#0-creating-an-account). - Finally, we have an async method that searches for the email we sent (using `mailosaur.messages.get`) and resolves the result. In this example we are searching for our message using the `sentTo` option. You can search using any of the criteria [described in the API reference](/docs/api#4-search-for-messages). ## 5. Create an assertion step Now that we have our email in a variable, we can start creating assertions. This can be done by adding a **JavaScript returns true** step in Ghost Inspector. For example, this will test the email’s subject line: ```js const email = {{message}}; return email.subject === 'Set your new password for ACME Product'; ``` You’re now ready to write whatever tests you need. The rest of this guide will take you through some of the most common things you might want to test. ## Testing plain text content Most emails, and all SMS messages, should have a plain text body. Mailosaur exposes this content via the `text.body` property on an email or SMS message: ```js console.log(message.text.body) // "Hi Jason, ..." if (message.text.body.indexOf('Jason') > -1) { console.log('Email contains "Jason"') } ``` ### Extracting verification codes from plain text You may have an email or SMS message that contains an account verification code, or some other one-time passcode. You can extract content like this using a simple regex. Here is how to extract a 6-digit numeric code: ```js console.log(message.text.body) // "Your access code is 243546." const regEx = new RegExp('([0-9]{6})') const matches = regEx.exec(message.text.body) console.log(matches[0]) // "243546" ``` ## Testing HTML content Most emails also have an HTML body, as well as the plain text content. You can access HTML content in a very similar way to plain text: ```js console.log(message.html.body) // "`) and area (``) elements and makes these available via the `html.links` array. Each link has a text property, representing the display text of the hyperlink within the body, and an href property containing the target URL: ```js // How many links? console.log(message.html.links.length) // 2 const firstLink = message.html.links[0] console.log(firstLink.text) // "Google Search" console.log(firstLink.href) // "https://www.google.com/" ``` **Important:** To ensure you always have valid emails, Mailosaur only extracts links that have been correctly marked up with `` or `` tags. ### Links in plain text (including SMS messages) Mailosaur auto-detects links in plain text content too, which is especially useful for SMS testing: ```js // How many links? console.log(message.text.links.length) // 2 const firstLink = message.text.links[0] console.log(firstLink.href) // "https://www.google.com/" ``` ## Working with attachments If your email includes attachments, you can access these via the attachments property: ```js // How many attachments? console.log(message.attachments.length) // 2 ``` Each attachment contains metadata on the file name and content type: ```js const firstAttachment = message.attachments[0] console.log(firstAttachment.fileName) // "contract.pdf" console.log(firstAttachment.contentType) // "application/pdf" ``` The `length` property returns the size of the attached file (in bytes): ```js const firstAttachment = message.attachments[0] console.log(firstAttachment.length) // 4028 ``` ## Working with images and web beacons The `html.images` property of a message contains an array of images found within the HTML content of an email. The length of this array corresponds to the number of images found within an email: ```js // How many images in the email? console.log(message.html.images.length) // 1 ``` ### Remotely-hosted images Emails will often contain many images that are hosted elsewhere, such as on your website or product. It is recommended to check that these images are accessible by your recipients. All images should have an alternative text description, which can be checked using the `alt` attribute. ```js const image = message.html.images[0] console.log(image.alt) // "Hot air balloon" ``` ### Triggering web beacons A web beacon is a small image that can be used to track whether an email has been opened by a recipient. Because a web beacon is simply another form of remotely-hosted image, you can export the `src` attribute via an **Extract from JavaScript** step, then navigate to that URL using Ghost Inspector: ```js const image = message.html.images[0] return image.src // Extract this value, so you can navigate to it ``` ## Spam checking You can perform a [SpamAssassin](https://spamassassin.apache.org) check against an email. The structure returned matches the [spam test object](/docs/api#0-perform-a-spam-test): ```js const result = await mailosaur.analysis.spam(message.id) console.log(result.score) // 0.5 result.spamFilterResults.spamAssassin.forEach(r => { console.log(r.rule) console.log(r.description) console.log(r.score) }) ``` --- Source: https://mailosaur.com/docs/automation/go # How to test email and SMS in Go Learn how to automate testing of email and SMS messages in Golang, using Mailosaur. ## 1. Create a Mailosaur account If you already have an account, skip to step 2. To create a new trial account, [sign up here](/app/signup). ## 2. Create a sample project ### Install Go To see if you already have Go installed, open a terminal window and run this command: ```bash go version ``` If Go is installed, you’ll see a version number. If you see an error instead, then [download Go from its official site](https://go.dev) and install it. ### Create a new project Run each of these commands to create a new project: ```bash mkdir EmailTests cd EmailTests go mod init example.com/emailtests ``` ### Install the Mailosaur Go library Run this command to install the [Mailosaur Go package](https://github.com/mailosaur/mailosaur-go): ```bash go get -u github.com/mailosaur/mailosaur-go ``` ## 3. Send email to your Mailosaur inbox Inboxes allow you to group tests, permissions, and other settings together. Each inbox has an **Inbox ID** and a **domain name**. You need these values to both send email to Mailosaur, and to set up automated testing. You also need an [API key](/docs/managing-your-account/api-keys) to use. You can learn more about [creating API keys here](/docs/managing-your-account/api-keys). ### Retrieve your inbox’s attributes 1. In the left-hand navigation, locate the **Inboxes** section. 2. Click on the name of the inbox you want to test with. 3. Click the **Settings** tab. 4. Make a note of the **Inbox ID** and **Domain**. 5. Get an API key from the [API Keys](/app/keys) page. ### Send an email to your inbox If the **domain name** of your inbox above was: ```bash example.mailosaur.net ``` Then you can send an email to it with these steps: 1. Open up an email client and send an email to `anything@example.mailosaur.net` 2. In the left-hand navigation, locate the **Inboxes** section. 3. Click on the name of the inbox you sent an email to. 4. Confirm the email is there. Note that some services (like Gmail) may take 10-20 seconds to send a message through. To learn more, read our guide on [sending email to Mailosaur](/docs/email-testing/sending-to-mailosaur). ## 4. Find an email for automated testing Now that you have a sample project, your inbox’s credentials, and an email to test, then you’re ready to continue. Create a file named `hello_test.go` and type or paste in this code sample, replacing the template code with the values from step 3 above: ```go package emailtests import ( "fmt" "testing" "github.com/mailosaur/mailosaur-go" ) func TestExample(t *testing.T) { // Find these on the API Keys page and your inbox's Settings tab apiKey := "YOUR_API_KEY"; serverId := "SERVER_ID"; serverDomain := "SERVER_DOMAIN"; m := mailosaur.New(apiKey); params := &mailosaur.MessageSearchParams { Server: serverId, } criteria := &mailosaur.SearchCriteria { SentTo: "anything@" + serverDomain, } email, err := m.Messages.Get(params, criteria) if (err != nil) { t.Error(err) } // If we have an email, print the subject fmt.Println("Subject: " + email.Subject) } ``` This code connects to Mailosaur and looks for any email that has been sent to the address provided in the search criteria. Save your changes and run the code: ```bash go test ``` If everything is set up correctly, you should see the subject line of the last email you sent, printed to screen: ```bash Subject: My example email ``` ### Troubleshooting If you see an error, e.g. ‘No matching messages found in time’: - Make sure you have set the **sent to** address correctly in your code. - Ensure that you have sent an email to the **sent to** address (check this is visible in the Mailosaur Dashboard). - Note that by default, the **get** method will only look for messages that were received by Mailosaur within the last hour. You can override this using the `ReceivedAfter` option (see library reference below). ## 5. Narrowing your search results ### Only find messages received after a certain time By default, searches include messages received in the last hour, but you can customise the search window with the `ReceivedAfter` option. This example shows you how to only include emails received after your test started: ```go testStart := time.Now() // Perform the steps that send a message here message, _ := client.Messages.Get(&MessageSearchParams{ Server: "SERVER_ID", ReceivedAfter: testStart, }, &SearchCriteria{ SentTo: "...", }) ``` ### Search criteria As you can see in the examples so far, you can search for the email address or phone number a message was sent to, but you can also search using these criteria: | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **SentFrom** | The full email address from which the target message was sent. | | **SentTo** | The full email address to which the target message was sent. | | **Subject** | Find emails where the subject line contains this text. | | **Body** | Finds messages where the message body contains this text. | ## 6. Start writing tests Now that you have a working project that fetches an email, you can use this to begin writing tests for various pieces of functionality. Check out these guides on the most common test cases: > [!LINK](/docs/automation/text-content) > ### How to test the text content of email or SMS > Learn how to test the text content of email or SMS with Mailosaur. > [!LINK](/docs/automation/html-content) > ### HTML content of an email > Learn how to work with the HTML content found within your emails. > [!LINK](/docs/automation/codes) > ### Extracting codes from email and SMS > Learn how to test verification codes found in email and SMS messages with Mailosaur. > [!LINK](/docs/automation/links) > ### Extracting links from email and SMS > Learn how to test hyperlinks found in email and SMS messages with Mailosaur. > [!LINK](/docs/automation/attachments) > ### Email attachments > Learn how to test the email attachments with Mailosaur. > [!LINK](/docs/automation/images) > ### Images and web beacons > Learn how to work with images, including web beacons, within an HTML email. > [!LINK](/docs/automation/message-properties) > ### Message properties > Learn how to test the common properties of an email or SMS message with Mailosaur. > [!LINK](/docs/automation/spam) > ### How to test email spam score > Learn how to test the SpamAssassin score of an email with Mailosaur. ## SMS Testing You can test SMS messages in much the same way as email. Take a look at our [guide on testing SMS messages](/docs/sms-testing) for more information. ## Library reference The Go client library gives you access to several other methods. ### Messages Messages is the collective name given to the email and/or SMS messages that are sent into Mailosaur for testing. The [message object](/docs/api) contains everything you need to perform in-depth automated testing. #### Messages.Get(params, criteria, options) Waits for a message to be found. Returns as soon as a message matching the specified search criteria is found. **Recommended:** This is the most efficient method of looking up a message, therefore we recommend using it wherever possible. ```go params := &mailosaur.MessageSearchParams { Server: "SERVER_ID", } criteria := &mailosaur.SearchCriteria { SentTo: "something@{SERVER_ID}.mailosaur.net", } message, err := m.Messages.Get(params, criteria) ``` To learn about inbox IDs, and what to replace `SERVER_ID` with, see [sending email to Mailosaur](/docs/email-testing/sending-to-mailosaur). ##### Parameters In addition to the inbox, you can also set the following… | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **Server** | The unique identifier for your Mailosaur inbox. | | **Timeout** | Specify how long to wait for a matching result (in seconds, _default value is 10 seconds_). | | **ReceivedAfter** | Limits results to only messages received after this date/time (_default 1 hour ago_). | ##### Criteria | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **SentFrom** | The full email address from which the target message was sent. | | **SentTo** | The full email address to which the target message was sent. | | **Subject** | The subject line of the target email. | | **Body** | Search for part of the message body. | | **Match** | If set to `ALL` (default), then only results that match all specified criteria will be returned. If set to `ANY`, results that match any of the specified criteria will be returned. | ```go // Search all messages received after midnight on a specific date params := &mailosaur.MessageSearchParams { Server: "SERVER_ID", ReceivedAfter: time.Date(2020, 1, 5, 0, 0, 0, 0, time.UTC), } criteria := &mailosaur.SearchCriteria { SentTo: "something@{SERVER_ID}.mailosaur.net", } message, err := m.Messages.Get(params, criteria) ``` #### Messages.List(params) Returns a list of your messages in summary form. The summaries are returned sorted by received date, with the most recently-received messages appearing first. > [!SUCCESS] > The method returns a message summary, rather than the full message object. This means that several properties, like the message body, are not included. To get this data, you’ll need to call [`GetById`](#messagesgetbyidid). Alternatively, we recommend using the [`Get`](#messagesgetparams-criteria-options) method, which is a far more efficient approach. ```go // List the most recent messages params := &mailosaur.MessageListParams { Server: server } result, err := m.Messages.List(params) if (err != nil) { // Handle err } // Get the most recent message (the first one in the list) message = result.Items[0] fmt.Println("Subject: " + message.Subject) ``` ##### Parameters - **Server** The unique identifier for your Mailosaur inbox. - **ReceivedAfter** Allows you to customise how far back to look for messages. - **Page** Used alongside `ItemsPerPage` to paginate through results. This is zero-based, meaning `0` is the first page of results. - **ItemsPerPage** A limit on the number of results to be returned. This can be set between 1 to 1000, with the default being 50. - **Dir** Optionally limits results based on the direction (`Sent` or `Received`), with the default being `Received`. ```go // List all results received after midnight on a specific date // Limit results to the first 10 matches only. params := &mailosaur.MessageListParams { Server: server, ReceivedAfter: time.Date(2020, 1, 3, 0, 0, 0, 0, time.UTC), Page: 0, ItemsPerPage: 50, } result, err = m.Messages.List(params) ``` #### Messages.Search(params, criteria) Returns a list of messages matching the specified search criteria, in summary form. The messages are returned sorted by received date, with the most recently-received messages appearing first. > [!SUCCESS] > The method returns a message summary, rather than the full message object. This means that several properties, like the message body, are not included. To get this data, you’ll need to call [`GetById`](#messagesgetbyidid). Alternatively, we recommend using the [`Get`](#messagesgetparams-criteria-options) method, which is a far more efficient approach. ```go params := &mailosaur.MessageListParams { Server: server, } criteria := &mailosaur.SearchCriteria { SentTo: "someone@SERVER_ID.mailosaur.net", } result, err := m.Messages.Search(params, criteria) if (err != nil) { // Handle err } // Get the most recent match message := result.Items[0] fmt.Println("Subject: " + message.Subject) ``` ##### Parameters - **Server** The unique identifier for your Mailosaur inbox. - **Timeout** If provided, determines how long to wait for a matching result (provided in milliseconds). - **ErrorOnTimeout** When set to `false`, an error will not be thrown if timeout is reached (default: `true`). Note the data type is `*bool`, therefore you must set this using a variable (e.g. `f := false` followed by `params.ErrorOnTimeout = &f`) - **ReceivedAfter** Allows you to customise how far back to look for messages. - **Page** Used alongside `ItemsPerPage` to paginate through results. This is zero-based, meaning `0` is the first page of results. - **ItemsPerPage** A limit on the number of results to be returned. This can be set between 1 to 1000, with the default being 50. - **Dir** Optionally limits results based on the direction (`Sent` or `Received`), with the default being `Received`. ##### Criteria - **SentFrom** The full email address from which the target message was sent. - **SentTo** The full email address to which the target message was sent. - **Subject** The subject line of the target email. - **Body** Search for part of the message body. - **Match** If set to `ALL` (default), then only results that match all specified criteria will be returned. If set to `ANY`, results that match any of the specified criteria will be returned. ```go // Search for all messages sent to someone@SERVER_ID.mailosaur.net, // received after midnight on a specific date. Limit results to // the first 10 matches only. params := &mailosaur.MessageListParams { Server: server, Page: 0, ItemsPerPage: 10, ReceivedAfter: time.Date(2020, 1, 3, 0, 0, 0, 0, time.UTC), } criteria := &mailosaur.SearchCriteria { SentTo: "someone@SERVER_ID.mailosaur.net", } result, err := m.Messages.Search(params, criteria) ``` #### Messages.GetById(id) Retrieves the detail for a single email message. Must be used in conjunction with either [`List`](#messageslistparams) or [`Search`](#messagessearchparams-criteria) in order to get the unique identifier for the required message. **We always recommend using the** [`Get`](#messagesgetparams-criteria-options) **method instead**. ```go result, err = m.Messages.List(&mailosaur.MessageListParams { Server: server, }) if (err != nil) { // Handle err } messageId := result.Items[0].Id message := m.Messages.GetById(messageId) fmt.Println("Subject: " + message.Subject) ``` #### Messages.Delete(id) Permanently deletes a message. Also deletes any attachments related to the message. This operation cannot be undone. ```go m.Messages.Delete(messageId) ``` #### Messages.DeleteAll(server) Permanently deletes all messages held in the specified inbox. Also deletes any attachments related to each message. This operation cannot be undone. ```go m.Messages.DeleteAll("SERVER_ID") ``` #### Messages.Create(server, messageCreateOptions) Creates a new message that can be sent to a verified email address. This is useful in scenarios where you want an email to trigger a workflow in your product. ```go options := &mailosaur.MessageCreateOptions { To: "verified-address@example.com", Send: true, Subject: "Request", Text: "Please can you give us a call back?", } m.Messages.Create("SERVER_ID", options) ``` ##### Options - **To** The email address to which the email will be sent. Must be a verified email address. - **Send** If true, email will be sent upon creation. - **Subject** The email subject line. - **Text** The plain text body of the email. - **Html** The HTML body of the email. #### Messages.Forward(messageId, messageForwardOptions) Forwards the specified email to a verified email address. ```go options := &mailosaur.MessageForwardOptions { To: "verified-address@example.com", Text: "FYI", } m.Messages.Forward("MESSAGE_ID", options) ``` ##### Options - **To** The email address to which the email will be sent. Must be a verified email address. - **Text** Any additional plain text content to forward the email with. - **Html** Any additional HTML content to forward the email with. #### Messages.Reply(messageId, messageReplyOptions) Sends a reply to the specified email. This is useful for when simulating a user replying to one of your emails. ```go options := &mailosaur.MessageReplyOptions { Text: "FYI", } m.Messages.Reply("MESSAGE_ID", options) ``` ##### Options - **Text** Any additional plain text content to include in the reply. - **Html** Any additional HTML content to include in the reply. ### Servers Inboxes capture emails and SMS messages, group your tests and settings, and manage access for your team. #### Servers.List() Returns a list of your inboxes. Inboxes are returned sorted in alphabetical order. ```go result, err := m.Servers.List() if (err != nil) { // Handle err } fmt.Println("You have an inbox called: " + result.Items[0].Name) ``` #### Servers.Create(options) Creates a new inbox. Only the `name` property is required to create a new inbox via the API. ```go options := &mailosaur.ServerCreateOptions { Name: "My email tests", } m.Servers.Create(options) ``` #### Servers.Get(id) Retrieves the detail for a single inbox. Simply supply the unique identifier for the required inbox. ```go server, err := m.Servers.Get("SERVER_ID") ``` #### Servers.GetPassword(id) Retrieves the password, for use with SMTP and POP3, for a single inbox. Simply supply the unique identifier for the required inbox. ```go password, err := m.Servers.GetPassword("SERVER_ID") ``` #### Servers.Update(id, server) Updates a single inbox. ```go retrievedServer, err := m.Servers.Get("SERVER_ID") if (err != nil) { // Handle err } retrievedServer.Name = "Updated inbox name" m.Servers.Update(retrievedServer.Id, retrievedServer); ``` #### Servers.Delete(id) Permanently deletes an inbox. Also deletes all messages and associated attachments within the inbox. This operation cannot be undone. ```go m.Servers.Delete("SERVER_ID") ``` #### Servers.GenerateEmailAddress(id) Utility method to help you generate a random email address for a given inbox. ```go emailAddress := m.Servers.GenerateEmailAddress("SERVER_ID") fmt.Println(emailAddress) // "bgwqj@SERVER_ID.mailosaur.net" ``` To learn about inbox IDs, and what to replace `SERVER_ID` with, see [sending email to Mailosaur](/docs/email-testing/sending-to-mailosaur). ### Files #### Files.GetEmail(messageId) Downloads an EML file representing the specified email. Simply supply the unique identifier for the required email. #### Files.GetAttachment(attachmentId) Downloads a single attachment. Simply supply the unique identifier for the required attachment. ### Analysis #### Analysis.Spam(messageId) Perform spam testing on the specified email. ### Usage #### Usage.Limits() Retrieve account usage limits. Details the current limits and usage for your account. This endpoint requires authentication with an account-level API key. #### Usage.Transactions() Retrieves the last 31 days of transactional usage. This endpoint requires authentication with an account-level API key. --- Source: https://mailosaur.com/docs/automation/html-content # HTML content of an email > [!WARNING] > Most email sent today is HTML-based, however, an email may also contain a plain text alternative for older mail clients. Learn how to work with text content of an email. ## Before you begin The examples shown below are based on two key assumptions: 1. You have already created a basic automated test using our [getting started guides](/docs/automation). 2. You have a chosen assertion library that you will use to test the values shown below. ## Accessing the HTML content An email’s HTML body can be accessed via the `html.body` property of a message. ```nodejs console.log(message.html.body) // "html->body); // " org.jsoup jsoup 1.13.1 ``` ```csharp dotnet add package HtmlAgilityPack ``` ```ruby gem install nokogiri ``` ```php // Not required, skip to next step ``` ```go go get github.com/PuerkitoBio/goquery ``` ### Import the library in your code Next, reference the library in your code: ```nodejs const { JSDOM } = require('jsdom') ``` ```python from bs4 import BeautifulSoup ``` ```java import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.select.Elements; ``` ```csharp using HtmlAgilityPack; ``` ```ruby require 'nokogiri' ``` ```php // Not required, skip to next step ``` ```go import ( "github.com/PuerkitoBio/goquery" ) ``` ### Find the target element In this example, we want to extract the verification code from the HTML below: ```html

To activate your account, enter this code:

542163

``` To do this, we pass the email’s HTML body into our library, then find the element we need and access the 6-digit access code within: ```nodejs const dom = new JSDOM(message.html.body); const el = dom.window.document.querySelector('.verify-code'); const verificationCode = el.textContent; console.log(verificationCode); // "542163" ``` ```python dom = BeautifulSoup(message.html.body, 'html.parser') el = dom.find('.verify-code') verification_code = el.text print(verification_code) # "542163" ``` ```java Document doc = Jsoup.parse(message.html().body()); Elements elements = doc.getElementsByTag(".verify-code"); String verificationCode = elements.get(0).text(); System.out.println(verificationCode); // "542163" ``` ```csharp var doc = new HtmlDocument(); doc.LoadHtml(message.Html.Body); // Find element using xpath var node = doc.DocumentNode.SelectSingleNode("//*[contains(@class, 'verify-code')]") var verificationCode = node.InnerText; Console.WriteLine(verificationCode); // "542163" ``` ```ruby @doc = Nokogiri::HTML(message.html.body) el = @doc.css(".verify-code") verification_code = el.text puts verification_code # "542163" ``` ```php $doc = new DOMDocument(); $doc->loadHTML($message->html->body); $cssClass = 'verify-code'; $xpath = new DomXPath($doc); $matches = $xpath->query("//*[contains(concat(' ', normalize-space(@class), ' '), ' $cssClass ')]"); $verificationCode = $matches[0]->textContent; print($verificationCode); // "542163" ``` ```go htmlBytes := strings.NewReader(email.Html.Body) doc, _ := goquery.NewDocumentFromReader(htmlBytes) sel := doc.Find(".verify-code") for i := range sel.Nodes { single := sel.Eq(i) verificationCode := single.Text() fmt.Print(verificationCode) // "542163" } ``` #### See also - [Plain text content](/docs/automation/text-content) --- Source: https://mailosaur.com/docs/automation/images # Images and web beacons Learn how to work with images, including web beacons, within a HTML email. ## Before you begin The examples shown below are based on two key assumptions: 1. You have already created a basic automated test using our [getting started guides](/docs/automation). 2. You have a chosen assertion library that you will use to test the values shown below. ## How many images The `html.images` property of a message contains an array of images. The length of this array corresponds to the number of images found within an email. ```nodejs console.log(message.html.images.length) // 2 ``` ```python print(len(message.html.images)) # 2 ``` ```java System.out.println(message.html().images().size()); // 2 ``` ```csharp Console.WriteLine(message.Html.Images.Count); // 2 ``` ```ruby puts(message.html.images.length) # 2 ``` ```php print(count($message->html->images)); // 2 ``` ```go fmt.Println(len(message.Html.Images)) // 2 ``` Each image contains both a `src` attribute, which contains the location of the image, as well as an `alt` attribute holding the alternative text description of the image. ## Remotely-hosted images Emails will often contain many images that are hosted elsewhere, such as on your website or product. It is recommended to check that these images are accessible by your recipients. All images should have an alternative text description, which can be checked using the `alt` attribute. ```nodejs const image = message.html.images[0] console.log(image.alt) // "Hot air balloon" ``` ```python image = message.html.images[0] print(image.alt) # "Hot air balloon" ``` ```java Image image = message.html().images().get(0); System.out.println(image.alt()); // "Hot air balloon" ``` ```csharp var image = message.Html.Images[0]; Console.WriteLine(image.Alt); // "Hot air balloon" ``` ```ruby image = message.html.images[0] puts(image.alt) # "Hot air balloon" ``` ```php $image = $message->html->images[0]; print($image->alt); // "Hot air balloon" ``` ```go image := message.Html.Images[0] fmt.Println(image.Alt) // "Hot air balloon" ``` In addition, to check that the image itself is accessible, you can use the `src` attribute to perform an HTTP request to that address. ```nodejs const https = require('https') // ... const image = message.html.images[0] console.log(image.src) // "https://example.com/s.png?abc123" // Make an HTTP call to trigger the web beacon https.get(image.src, r => console.log(r.statusCode)) // 200 ``` ```python import requests # ... const image = message.html.images[0] print(image.src) # "https://example.com/s.png?abc123" # Make an HTTP call to trigger the web beacon response = requests.get(image.src) print(response.status_code) # 200 ``` ```java Image image = message.html().images().get(0); System.out.println(image.src()); // "https://example.com/s.png?abc123" // Make an HTTP call to trigger the web beacon var client = HttpClient.newHttpClient(); var request = HttpRequest.newBuilder(URI.create(image.src())).build(); var response = client.send(request, null); System.out.println(response.statusCode()); // 200 ``` ```csharp var image = message.Html.Images[0]; Console.WriteLine(image.Src); // "https://example.com/s.png?abc123" // Make an HTTP call to trigger the web beacon using (var client = new HttpClient()) { var result = await client.GetAsync(image.Src); Console.WriteLine(result.StatusCode); // 200 } ``` ```ruby image = message.html.images[0] puts(image.src) # "https://example.com/s.png?abc123" # Make an HTTP call to trigger the web beacon uri = URI(image.src) Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http| request = Net::HTTP::Get.new uri response = http.request request # Net::HTTPResponse object puts(response.code) # 200 end ``` ```php $image = $message->html->images[0]; print($image->src); // "https://example.com/s.png?abc123" // Make an HTTP call to trigger the web beacon $ch = curl_init($image->src); curl_setopt($ch, CURLOPT_NOBODY, true); curl_exec($ch); $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); print($statusCode); // 200 ``` ```go image := message.Html.Images[0] fmt.Println(image.Src) // "https://example.com/s.png?abc123" // Make an HTTP call to trigger the web beacon resp, _ := http.Get(image.Src) fmt.Println(resp.StatusCode) // 200 ``` ## Web beacons A web beacon is a small image that can be used to track whether an email has been opened by a recipient. Because a web beacon is simply another form of remotely-hosted image, you can use the same code shown above to trigger an open email event. ## Embedded images When an image is embedded within the content of an email, its `src` attribute will contain a “content ID” (e.g. `cid:ii_1435fadb31d523f6`). Where a content ID is present, the image itself will be attached to the email, and so can be accessed in the same way as any other [attachment](/docs/automation/attachments#6-embedded-images). Note that the `contentId` attribute of the attachment will match the value found in the `src` attribute, excluding the `cid:` prefix. ```nodejs const embeddedImage = message.html.images[0] console.log(embeddedImage.src) // "cid:ii_1435fadb31d523f6" console.log(embeddedImage.alt) // "Hot air balloon" ``` ```python embedded_image = message.html.images[0] print(embedded_image.src) # "cid:ii_1435fadb31d523f6" print(embedded_image.alt) # "Hot air balloon" ``` ```java Image embeddedImage = message.html().images().get(0); System.out.println(embeddedImage.src()); // "cid:ii_1435fadb31d523f6" System.out.println(embeddedImage.alt()); // "Hot air balloon" ``` ```csharp var embeddedImage = message.Html.Images[0]; Console.WriteLine(embeddedImage.Src); // "cid:ii_1435fadb31d523f6" Console.WriteLine(embeddedImage.Alt); // "Hot air balloon" ``` ```ruby embedded_image = message.html.images[0] puts(embedded_image.src) # "cid:ii_1435fadb31d523f6" puts(embedded_image.alt) # "Hot air balloon" ``` ```php $embeddedImage = $message->html->images[0]; print($embeddedImage->src); // "cid:ii_1435fadb31d523f6" print($embeddedImage->alt); // "Hot air balloon" ``` ```go embeddedImage := message.Html.Images[0] fmt.Println(embeddedImage.Src) // "cid:ii_1435fadb31d523f6" fmt.Println(embeddedImage.Alt) // "Hot air balloon" ``` --- Source: https://mailosaur.com/docs/automation/insomnia # How to test email and SMS with Insomnia This article shows you how to test email and test SMS using Insomnia and the Mailosaur API. ## What is Insomnia? Insomnia is a free, cross-platform desktop application that makes it easy to test, interact with and design HTTP-based APIs. At this stage, we assume that you already know how to use Insomnia, however, if not, you can learn more on [Insomnia’s website](https://insomnia.rest). ## What is Mailosaur? Mailosaur is a service that captures email and SMS messages and lets you test them, via its web dashboard and the Mailosaur Email/SMS Testing API. If you don’t already have one, [create a free trial account](/app/signup) now, and [send an email into Mailosaur](/docs/email-testing/sending-to-mailosaur) first. Once you have this working, you’re ready to start testing! ## 1. Create an API key Account-level API keys allow you to access all the functions described in the API reference, and have access to all the inboxes in your account. To create an account-level API key, you must be an Administrator or Account Owner on the account in question. 1. Go to the **Settings** page in the Mailosaur Dashboard. 2. Go to the **API Keys** page. 3. Click the **Create a Key** button. 4. In the dialog that appears, enter a name for your key. 5. When you are finished, click **Create**. For more information, see our guide on [managing API keys](/docs/managing-your-account/api-keys). ## 2. Import the Insomnia Collection Mailosaur has a public Insomnia Collection which you can access by clicking the button below: ![Insomnia](https://insomnia.rest/run/?label=Mailosaur&uri=https%3A%2F%2Fmailosaur.com%2Finsomnia.json) Alternatively, you can import the collection and start testing email and SMS by following these steps: 1. Open Insomnia. 2. Click the **Import** button. 3. Select **URL**. 4. Enter the URL `https://mailosaur.com/insomnia.json`, click **Scan**, then click **Import**. ## 3. Make API requests using your API key Once you have the collection loaded, you just need to add your Mailosaur API key to your base environment variables. This can be done by opening the **Environments** section, selecting your environment, and adding your Mailosaur API key as a key-value variable. That’s it, you’re ready to start testing email and SMS messages with Mailosaur and Insomnia! --- Source: https://mailosaur.com/docs/automation/java # How to test email and SMS in Java Learn how to automate testing of email and SMS messages in Java, using Mailosaur. ## 1. Create a Mailosaur account If you already have an account, skip to step 2. To create a new trial account, [sign up here](/app/signup). ## 2. Create a sample project This guide makes use of JUnit, therefore create an empty Java & JUnit project to begin. ### Install the Mailosaur Java library **Gradle users** can add this dependency to their project’s build file: ```java // MAILOSAUR_JAVA_VERSION available at: // https://github.com/mailosaur/mailosaur-java/releases/latest) implementation "com.mailosaur:mailosaur-java:MAILOSAUR_JAVA_VERSION" ``` **Maven users** should add this dependency to your project’s POM: ```xml com.mailosaur mailosaur-java MAILOSAUR_JAVA_VERSION ``` If you don’t use Gradle or Maven, refer to the README within the [GitHub repository](https://github.com/mailosaur/mailosaur-java). ## 3. Send email to your Mailosaur inbox Inboxes allow you to group tests, permissions, and other settings together. Each inbox has an **Inbox ID** and a **domain name**. You need these values to both send email to Mailosaur, and to set up automated testing. You also need an [API key](/docs/managing-your-account/api-keys) to use. You can learn more about [creating API keys here](/docs/managing-your-account/api-keys). ### Retrieve your inbox’s attributes 1. In the left-hand navigation, locate the **Inboxes** section. 2. Click on the name of the inbox you want to test with. 3. Click the **Settings** tab. 4. Make a note of the **Inbox ID** and **Domain**. 5. Get an API key from the [API Keys](/app/keys) page. ### Send an email to your inbox If the **domain name** of your inbox above was: ```bash example.mailosaur.net ``` Then you can send an email to it with these steps: 1. Open up an email client and send an email to `anything@example.mailosaur.net` 2. In the left-hand navigation, locate the **Inboxes** section. 3. Click on the name of the inbox you sent an email to. 4. Confirm the email is there. Note that some services (like Gmail) may take 10-20 seconds to send a message through. To learn more, read our guide on [sending email to Mailosaur](/docs/email-testing/sending-to-mailosaur). ## 4. Find an email for automated testing Now that you have a sample project, your inbox’s credentials, and an email to test, then you’re ready to continue. Open the file containing tests in your new, sample project (e.g. `AppTest.java`) and type or paste in this code sample, replacing the template code with the values from step 3 above: ```java package demo; import org.junit.Test; import static org.junit.Assert.*; import com.mailosaur.MailosaurClient; import com.mailosaur.MailosaurException; import com.mailosaur.models.*; import java.io.IOException; public class AppTest { @Test public void testExample() throws IOException, MailosaurException { // Find these on the API Keys page and your inbox's Settings tab String apiKey = "YOUR_API_KEY"; String serverId = "SERVER_ID"; String serverDomain = "SERVER_DOMAIN"; MailosaurClient mailosaur = new MailosaurClient(apiKey); MessageSearchParams params = new MessageSearchParams(); params.withServer(serverId); SearchCriteria criteria = new SearchCriteria(); criteria.withSentTo("asdas@" + serverDomain); Message message = mailosaur.messages().get(params, criteria); assertNotNull(message); assertEquals("My email subject", message.subject()); } } ``` This code connects to Mailosaur and looks for any email that has been sent to the address provided in the search criteria. Save your changes and run your tests. If everything is set up correctly, you should see tests run and the subject line of the last email you sent will be checked. ### Troubleshooting If you see an error, e.g. ‘No matching messages found in time’: - Make sure you have set the **sent to** address correctly in your code. - Ensure that you have sent an email to the **sent to** address (check this is visible in the Mailosaur Dashboard). - Note that by default, the **get** method will only look for messages that were received by Mailosaur within the last hour. You can override this using the `receivedAfter` option (see library reference below). ## 5. Narrowing your search results ### Only find messages received after a certain time By default, searches include messages received in the last hour, but you can customise the search window with the `receivedAfter` option. This example shows you how to only include emails received after your test started: ```java Date testStart = System.currentTimeMillis(); // Perform the steps that send a message here MessageSearchParams params = new MessageSearchParams(); params.withServer(serverId) .withReceivedAfter(testStart); SearchCriteria criteria = new SearchCriteria(); criteria.withSentTo("..."); Message message = mailosaur.messages().get(params, criteria); ``` ### Search criteria As you can see in the examples so far, you can search for the email address or phone number a message was sent to, but you can also search using these criteria: | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **withSentFrom** | The full email address from which the target message was sent. | | **withSentTo** | The full email address to which the target message was sent. | | **withSubject** | Find emails where the subject line contains this text. | | **withBody** | Finds messages where the message body contains this text. | ## 6. Start writing tests Now that you have a working project that fetches an email, you can use this to begin writing tests for various pieces of functionality. Check out these guides on the most common test cases: > [!LINK](/docs/automation/text-content) > ### How to test the text content of email or SMS > Learn how to test the text content of email or SMS with Mailosaur. > [!LINK](/docs/automation/html-content) > ### HTML content of an email > Learn how to work with the HTML content found within your emails. > [!LINK](/docs/automation/codes) > ### Extracting codes from email and SMS > Learn how to test verification codes found in email and SMS messages with Mailosaur. > [!LINK](/docs/automation/links) > ### Extracting links from email and SMS > Learn how to test hyperlinks found in email and SMS messages with Mailosaur. > [!LINK](/docs/automation/attachments) > ### Email attachments > Learn how to test the email attachments with Mailosaur. > [!LINK](/docs/automation/images) > ### Images and web beacons > Learn how to work with images, including web beacons, within an HTML email. > [!LINK](/docs/automation/message-properties) > ### Message properties > Learn how to test the common properties of an email or SMS message with Mailosaur. > [!LINK](/docs/automation/spam) > ### How to test email spam score > Learn how to test the SpamAssassin score of an email with Mailosaur. ## SMS Testing You can test SMS messages in much the same way as email. Take a look at our [guide on testing SMS messages](/docs/sms-testing) for more information. ## Library reference The Java client library gives you access to several other methods. ### Messages Messages is the collective name given to the email and/or SMS messages that are sent into Mailosaur for testing. The [message object](/docs/api) contains everything you need to perform in-depth automated testing. #### messages.get(MessageSearchParams, SearchCriteria) Waits for a message to be found. Returns as soon as a message matching the specified search criteria is found. **Recommended:** This is the most efficient method of looking up a message, therefore we recommend using it wherever possible. ```java MessageSearchParams params = new MessageSearchParams(); params.withServer("SERVER_ID"); SearchCriteria criteria = new SearchCriteria(); criteria.withSentTo("someone@SERVER_ID.mailosaur.net"); Message message = mailosaur.messages().get(params, criteria); ``` To learn about inbox IDs, and what to replace `SERVER_ID` with, see [sending email to Mailosaur](/docs/email-testing/sending-to-mailosaur). ##### Criteria | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **sentFrom** | The full email address from which the target message was sent. | | **sentTo** | The full email address to which the target message was sent. | | **subject** | The subject line of the target email. | | **body** | Search for part of the message body. | | **match** | If set to `ALL` (default), then only results that match all specified criteria will be returned. If set to `ANY`, results that match any of the specified criteria will be returned. | ##### Options | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **timeout** | Specify how long to wait for a matching result (in milliseconds, _default value is 10 seconds_). | | **receivedAfter** | Limits results to only messages received after this date/time (_default 1 hour ago_). | ```java MessageSearchParams params = new MessageSearchParams(); params.withServer("SERVER_ID") .withReceivedAfter(1578182400000L); SearchCriteria criteria = new SearchCriteria(); criteria.withSentTo("someone@SERVER_ID.mailosaur.net"); // Search all messages received after midnight on a specific date Message message = mailosaur.messages().get(params, criteria); ``` #### messages.list(MessageListParams) Returns a list of your messages in summary form. The summaries are returned sorted by received date, with the most recently-received messages appearing first. > [!SUCCESS] > The method returns a message summary, rather than the full message object. This means that several properties, like the message body, are not included. To get this data, you’ll need to call [`getById`](#messagesgetbyidid). Alternatively, we recommend using the [`get`](#messagesgetserver-criteria-options) method, which is a far more efficient approach. ```java // List the most recent messages MessageListParams params = new MessageListParams(); params.withServer("SERVER_ID"); MessageListResult result = mailosaur.messages().list(params); // Get the most recent message (the first one in the list) MessageSummary message = result.items().get(0); System.out.println("Subject: " + message.subject()); ``` ##### Options - **receivedAfter** Allows you to customise how far back to look for messages (time in milliseconds). - **page** Used alongside `itemsPerPage` to paginate through results. This is zero-based, meaning `0` is the first page of results. - **itemsPerPage** A limit on the number of results to be returned. This can be set between 1 to 1000, with the default being 50. - **dir** Optionally limits results based on the direction (`Sent` or `Received`), with the default being `Received`. ```java // List all results received after midnight on a specific date MessageListParams params = new MessageListParams(); params.withServer("SERVER_ID").withReceivedAfter(1577836800000L); MessageListResult result = mailosaur.messages().list(params); ``` #### messages.search(MessageSearchParams, SearchCriteria) Returns a list of messages matching the specified search criteria, in summary form. The messages are returned sorted by received date, with the most recently-received messages appearing first. > [!SUCCESS] > The method returns a message summary, rather than the full message object. This means that several properties, like the message body, are not included. To get this data, you’ll need to call [`getById`](#messagesgetbyidid). Alternatively, we recommend using the [`get`](#messagesgetserver-criteria-options) method, which is a far more efficient approach. ```java MessageSearchParams params = new MessageSearchParams(); params.withServer("SERVER_ID"); SearchCriteria criteria = new SearchCriteria(); criteria.withSentTo("someone@SERVER_ID.mailosaur.net"); MessageListResult result = mailosaur.messages().search(params, criteria); // Get the most recent match MessageSummary message = result.items().get(0); System.out.println("Subject: " + message.subject()); ``` ##### Criteria - **sentFrom** The full email address from which the target message was sent. - **sentTo** The full email address to which the target message was sent. - **subject** The subject line of the target email. - **body** Search for part of the message body. - **match** If set to `ALL` (default), then only results that match all specified criteria will be returned. If set to `ANY`, results that match any of the specified criteria will be returned. ##### Options - **timeout** If provided, determines how long to wait for a matching result (provided in milliseconds). - **errorOnTimeout** When set to `false`, an error will not be thrown if timeout is reached (default: `true`). - **receivedAfter** Allows you to customise how far back to look for messages (time in milliseconds). - **page** Used alongside `itemsPerPage` to paginate through results. This is zero-based, meaning `0` is the first page of results. - **itemsPerPage** A limit on the number of results to be returned. This can be set between 1 to 1000, with the default being 50. - **dir** Optionally limits results based on the direction (`Sent` or `Received`), with the default being `Received`. ```java // Search for all messages sent to someone@SERVER_ID.mailosaur.net. // Limit results to the first 10 matches only. MessageSearchParams params = new MessageSearchParams(); params.withServer("SERVER_ID") .withPage(0) .withItemsPerPage(10); MessageListResult result = mailosaur.messages().search(params, criteria); ``` #### messages.getById(id) Retrieves the detail for a single email message. Must be used in conjunction with either [`list`](#messageslistserver-options) or [`search`](#messagessearchserver-criteria-options) in order to get the unique identifier for the required message. **We always recommend using the** [`get`](#messagesgetserver-criteria-options) **method instead**. ```java MessageListParams params = new MessageListParams(); params.withServer("SERVER_ID"); MessageListResult result = mailosaur.messages().list(params); String messageId = result.items().get(0).id(); Message message = mailosaur.messages().getById(messageId); System.out.println("Subject: " + message.subject()); ``` #### messages.delete(id) Permanently deletes a message. Also deletes any attachments related to the message. This operation cannot be undone. ```java mailosaur.messages().delete(messageId); ``` #### messages.deleteAll(server) Permanently deletes all messages held in the specified inbox. Also deletes any attachments related to each message. This operation cannot be undone. ```java mailosaur.messages().deleteAll("SERVER_ID"); ``` #### messages.create(server, messageCreateOptions) Creates a new message that can be sent to a verified email address. This is useful in scenarios where you want an email to trigger a workflow in your product. ```java MessageCreateOptions options = new MessageCreateOptions(); options.withTo("verified-address@example.com") .withSend(true) .withSubject("Request") .withText("Please can you give us a call back?"); mailosaur.messages().create("SERVER_ID", options); ``` ##### Options - **to** The email address to which the email will be sent. Must be a verified email address. - **send** If true, email will be sent upon creation. - **subject** The email subject line. - **text** The plain text body of the email. - **html** The HTML body of the email. #### messages.forward(messageId, messageForwardOptions) Forwards the specified email to a verified email address. ```java MessageForwardOptions options = new MessageForwardOptions(); options.withTo("verified-address@example.com") .withText("FYI"); mailosaur.messages().forward("MESSAGE_ID", options); ``` ##### Options - **to** The email address to which the email will be sent. Must be a verified email address. - **text** Any additional plain text content to forward the email with. - **html** Any additional HTML content to forward the email with. #### messages.reply(messageId, messageReplyOptions) Sends a reply to the specified email. This is useful for when simulating a user replying to one of your emails. ```java MessageReplyOptions options = new MessageReplyOptions(); options.withText("FYI"); mailosaur.messages().reply("MESSAGE_ID", options); ``` ##### Options - **text** Any additional plain text content to include in the reply. - **html** Any additional HTML content to include in the reply. ### Servers Inboxes capture emails and SMS messages, group your tests and settings, and manage access for your team. #### servers.list() Returns a list of your inboxes. Inboxes are returned sorted in alphabetical order. ```java ServerListResult result = mailosaur.servers().list(); System.out.println("You have an inbox called: " + result.items().get(0).name()); ``` #### servers.create(server) Creates a new inbox. Only the `name` property is required to create a new inbox via the API. ```java ServerCreateOptions options = new ServerCreateOptions().withName("My email tests"); mailosaur.servers().create(options); ``` #### servers.get(id) Retrieves the detail for a single inbox. Simply supply the unique identifier for the required inbox. ```java Server server = mailosaur.servers().get("SERVER_ID"); ``` #### servers.getPassword(id) Retrieves the password, for use with SMTP and POP3, for a single inbox. Simply supply the unique identifier for the required inbox. ```java String password = mailosaur.servers().getPassword("SERVER_ID"); ``` #### servers.update(id, server) Updates a single inbox. ```java Server retrievedServer = mailosaur.servers().get("SERVER_ID"); retrievedServer.withName("Updated inbox name"); mailosaur.servers().update(retrievedServer.id(), retrievedServer); ``` #### servers.del(id) Permanently deletes an inbox. Also deletes all messages and associated attachments within the inbox. This operation cannot be undone. ```java mailosaur.servers().delete("SERVER_ID"); ``` #### servers.generateEmailAddress(id) Utility method to help you generate a random email address for a given inbox. ```java String emailAddress = mailosaur.servers().generateEmailAddress("SERVER_ID"); System.out.println(emailAddress); // "bgwqj@SERVER_ID.mailosaur.net" ``` To learn about inbox IDs, and what to replace `SERVER_ID` with, see [sending email to Mailosaur](/docs/email-testing/sending-to-mailosaur). ### Files #### files.getEmail(messageId) Downloads an EML file representing the specified email. Simply supply the unique identifier for the required email. #### files.getAttachment(attachmentId) Downloads a single attachment. Simply supply the unique identifier for the required attachment. ### Analysis #### analysis.spam(messageId) Perform spam testing on the specified email. ### Usage #### usage.limits() Retrieve account usage limits. Details the current limits and usage for your account. This endpoint requires authentication with an account-level API key. #### usage.transactions() Retrieves the last 31 days of transactional usage. This endpoint requires authentication with an account-level API key. --- Source: https://mailosaur.com/docs/automation/javascript # How to test email and SMS with JavaScript Automate the testing of email and SMS messages within your web browser, using Mailosaur. ## Using Cypress, Playwright, WebdriverIO or similar? This guide shows how to perform email and SMS testing within a web browser session, but Mailosaur has an official [Node.js library](/docs/automation/nodejs) and [Cypress plugin](/docs/automation/cypress) which we strongly recommend for most testing cases. You should also check out our specific guides for [Cypress](/docs/automation/cypress), [Playwright](/docs/automation/playwright), and [WebdriverIO](/docs/automation/webdriverio) users. However, if you have a specific case where you can only test in-browser, read on. ## Introducing Mailosaur.js Mailosaur.js is the official client-side JavaScript library for testing email and SMS messages with Mailosaur. It’s perfect when you’re using tools like [Ghost Inspector](/docs/automation/ghost-inspector) that run fully client-side. ## 1. Create a Mailosaur account If you already have an account, skip to step 2. To create a new trial account, [sign up here](/app/signup). ## 2. Verify the domain you intend to run your tests from To protect your security, we only allow API calls to be made in a web browser from domains that you have verified. For example, if you are running your JavaScript code at `your-website.com`, then we need to know that you own `your-website.com` before your tests will work. **You must first** [verify your website or web app's domain name](/docs/managing-your-account/managing-domains). To do this, go to the [Domains](/app/account/domains) section of the Mailosaur Dashboard, and follow the on-screen instructions to add a new verified domain. ## 3. Send email to your Mailosaur inbox Inboxes allow you to group tests, permissions, and other settings together. Each inbox has an **Inbox ID** and a **domain name**. You need these values to both send email to Mailosaur, and to set up automated testing. You also need an [API key](/docs/managing-your-account/api-keys) to use. You can learn more about [creating API keys here](/docs/managing-your-account/api-keys). ### Retrieve your inbox’s attributes 1. In the left-hand navigation, locate the **Inboxes** section. 2. Click on the name of the inbox you want to test with. 3. Click the **Settings** tab. 4. Make a note of the **Inbox ID** and **Domain**. 5. Get an API key from the [API Keys](/app/keys) page. ### Send an email to your inbox If the **domain name** of your inbox above was: ```bash example.mailosaur.net ``` Then you can send an email to it with these steps: 1. Open up an email client and send an email to `anything@example.mailosaur.net` 2. In the left-hand navigation, locate the **Inboxes** section. 3. Click on the name of the inbox you sent an email to. 4. Confirm the email is there. Note that some services (like Gmail) may take 10-20 seconds to send a message through. To learn more, read our guide on [sending email to Mailosaur](/docs/email-testing/sending-to-mailosaur). ## 4. Initialize Mailosaur.js Once you have verified the domain you want to test from, you can run the following code to activate the Mailosaur API within your web browser: ```js (function (e, m, a, i, l) { i = e.createElement(m), l = e.getElementsByTagName(m)[0]; i.async = 1; i.src = a; e.body.appendChild(i) })(document, 'script', 'https://mailosaur.com/v1/mailosaur.js'); ``` ## 5. Find an email for automated testing Now that you have Mailosaur.js ready, your inbox’s credentials to hand, and an email to test, then you’re ready to continue. To fetch your message, type or paste in this code sample to your browser, replacing the template code with the values from step 3 above: ```js (async() => { const apiKey = 'YOUR_API_KEY' const serverId = 'SERVER_ID' const serverDomain = 'SERVER_DOMAIN' const mailosaur = Mailosaur(apiKey); const message = await mailosaur.messages.get(serverId, { sentTo: 'anything@' + serverDomain }); console.log(`Subject: ${message.subject}`); })(); ``` This code connects to Mailosaur and looks for any email that has been sent to the address provided in the search criteria. If everything is set up correctly, you should see the subject line of the last email you sent, printed to screen: ```bash Subject: My example email ``` ### Troubleshooting If you see an error, e.g. ‘No matching messages found in time’: - Make sure you have set the **sent to** address correctly in your code. - Ensure that you have sent an email to the **sent to** address (check this is visible in the Mailosaur Dashboard). - Note that by default, the **get** method will only look for messages that were received by Mailosaur within the last hour. You can override this using the `receivedAfter` option (see library reference below). ## 6. Narrowing your search results ### Only find messages received after a certain time By default, searches include messages received in the last hour, but you can customise the search window with the `receivedAfter` option. This example shows you how to only include emails received after your test started: ```js const testStart = new Date(); // Perform the steps that send a message here const message = await mailosaur.messages.get('SERVER_ID', { sentTo: '...' }, { receivedAfter: testStart }); ``` ### Search criteria As you can see in the examples so far, you can search for the email address or phone number a message was sent to, but you can also search using these criteria: | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **sentFrom** | The full email address from which the target message was sent. | | **sentTo** | The full email address to which the target message was sent. | | **subject** | Find emails where the subject line contains this text. | | **body** | Finds messages where the message body contains this text. | ## 7. Start writing tests Now that you have a working project that fetches an email, you can use this to begin writing tests for various pieces of functionality. Check out these guides on the most common test cases: > [!LINK](/docs/automation/text-content) > ### How to test the text content of email or SMS > Learn how to test the text content of email or SMS with Mailosaur. > [!LINK](/docs/automation/html-content) > ### HTML content of an email > Learn how to work with the HTML content found within your emails. > [!LINK](/docs/automation/codes) > ### Extracting codes from email and SMS > Learn how to test verification codes found in email and SMS messages with Mailosaur. > [!LINK](/docs/automation/links) > ### Extracting links from email and SMS > Learn how to test hyperlinks found in email and SMS messages with Mailosaur. > [!LINK](/docs/automation/attachments) > ### Email attachments > Learn how to test the email attachments with Mailosaur. > [!LINK](/docs/automation/images) > ### Images and web beacons > Learn how to work with images, including web beacons, within an HTML email. > [!LINK](/docs/automation/message-properties) > ### Message properties > Learn how to test the common properties of an email or SMS message with Mailosaur. > [!LINK](/docs/automation/spam) > ### How to test email spam score > Learn how to test the SpamAssassin score of an email with Mailosaur. ## SMS Testing You can test SMS messages in much the same way as email. Take a look at our [guide on testing SMS messages](/docs/sms-testing) for more information. ## Library reference This library gives you access to several other methods. ### Messages Messages is the collective name given to the email and/or SMS messages that are sent into Mailosaur for testing. The [message object](/docs/api) contains everything you need to perform in-depth automated testing. #### messages.get(server, criteria, options) Waits for a message to be found. Returns as soon as a message matching the specified search criteria is found. **Recommended:** This is the most efficient method of looking up a message, therefore we recommend using it wherever possible. ```js const message = await mailosaur.messages.get('SERVER_ID', { sentTo: 'someone@SERVER_ID.mailosaur.net' }); ``` To learn about inbox IDs, and what to replace `SERVER_ID` with, see [sending email to Mailosaur](/docs/email-testing/sending-to-mailosaur). ##### Criteria | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **sentFrom** | The full email address from which the target message was sent. | | **sentTo** | The full email address to which the target message was sent. | | **subject** | The subject line of the target email. | | **body** | Search for part of the message body. | | **match** | If set to `ALL` (default), then only results that match all specified criteria will be returned. If set to `ANY`, results that match any of the specified criteria will be returned. | ##### Options | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **timeout** | Specify how long to wait for a matching result (in milliseconds, _default value is 10 seconds_). | | **receivedAfter** | Limits results to only messages received after this date/time (_default 1 hour ago_). | ```js const message = await mailosaur.messages.get('SERVER_ID', { sentTo: 'someone@SERVER_ID.mailosaur.net' }, { // Search all messages received after midnight 5th Feb 2020 receivedAfter: new Date(2020, 1, 5) }); ``` #### messages.list(server, options) Returns a list of your messages in summary form. The summaries are returned sorted by received date, with the most recently-received messages appearing first. > [!SUCCESS] > The method returns a message summary, rather than the full message object. This means that several properties, like the message body, are not included. To get this data, you’ll need to call [`getById`](#messagesgetbyidid). Alternatively, we recommend using the [`get`](#messagesgetserver-criteria-options) method, which is a far more efficient approach. ```js // List the most recent messages const result = await mailosaur.messages.list('SERVER_ID'); // Get the most recent message (the first one in the list) const message = result.items[0]; console.log('Subject:', message.subject); ``` ##### Options - **receivedAfter** Allows you to customise how far back to look for messages. - **page** Used alongside `itemsPerPage` to paginate through results. This is zero-based, meaning `0` is the first page of results. - **itemsPerPage** A limit on the number of results to be returned. This can be set between 1 to 1000, with the default being 50. - **dir** Optionally limits results based on the direction (`Sent` or `Received`), with the default being `Received`. ```js // List all results received after midnight on 3rd Feb 2020 const result = await mailosaur.messages.list('SERVER_ID', { page: 0, itemsPerPage: 10, receivedAfter: new Date(2020, 1, 3) }); ``` #### messages.search(server, criteria, options) Returns a list of messages matching the specified search criteria, in summary form. The messages are returned sorted by received date, with the most recently-received messages appearing first. > [!SUCCESS] > The method returns a message summary, rather than the full message object. This means that several properties, like the message body, are not included. To get this data, you’ll need to call [`getById`](#messagesgetbyidid). Alternatively, we recommend using the [`get`](#messagesgetserver-criteria-options) method, which is a far more efficient approach. ```js const result = await mailosaur.messages.search('SERVER_ID', { sentTo: 'someone@SERVER_ID.mailosaur.net' }); // Get the most recent match const message = result.items[0]; console.log('Subject:', message.subject); ``` ##### Criteria | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **sentFrom** | The full email address from which the target message was sent. | | **sentTo** | The full email address to which the target message was sent. | | **subject** | The subject line of the target email. | | **body** | Search for part of the message body. | | **match** | If set to `ALL` (default), then only results that match all specified criteria will be returned. If set to `ANY`, results that match any of the specified criteria will be returned. | ##### Options | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **timeout** | If provided, determines how long to wait for a matching result (provided in milliseconds). | | **errorOnTimeout** | When set to `false`, an error will not be thrown if timeout is reached (default: `true`). | | **receivedAfter** | Allows you to customise how far back to look for messages. | | **page** | Used alongside `itemsPerPage` to paginate through results. This is zero-based, meaning `0` is the first page of results. | | **itemsPerPage** | A limit on the number of results to be returned. This can be set between 1 to 1000, with the default being 50. | | **dir** | Optionally limits results based on the direction (`Sent` or `Received`), with the default being `Received`. | ```js // Search for all messages sent to someone@SERVER_ID.mailosaur.net, // received after midnight on 3rd Feb 2020. Limit results to // the first 10 matches only. const result = await mailosaur.messages.search('SERVER_ID', { sentTo: 'someone@SERVER_ID.mailosaur.net' }, { page: 0, itemsPerPage: 10, receivedAfter: new Date(2020, 1, 3) }); ``` #### messages.getById(id) Retrieves the detail for a single email message. Must be used in conjunction with either [`list`](#messageslistserver-options) or [`search`](#messagessearchserver-criteria-options) in order to get the unique identifier for the required message. **We always recommend using the** [`get`](#messagesgetserver-criteria-options) **method instead**. ```js const result = await mailosaur.messages.list('SERVER_ID'); const messageId = result.items[0].id; const message = await mailosaur.messages.getById(messageId); console.log('Subject:', message.subject); ``` #### messages.del(id) Permanently deletes a message. Also deletes any attachments related to the message. This operation cannot be undone. ```js await mailosaur.messages.del(messageId) ``` #### messages.deleteAll(server) Permanently deletes all messages held in the specified inbox. Also deletes any attachments related to each message. This operation cannot be undone. ```js await mailosaur.messages.deleteAll('SERVER_ID') ``` #### messages.create(server, messageCreateOptions) Creates a new message that can be sent to a verified email address. This is useful in scenarios where you want an email to trigger a workflow in your product. ```js await mailosaur.messages.create('SERVER_ID', { to: 'verified-address@example.com', send: true, subject: 'Request', text: 'Please can you give us a call back?' }) ``` ##### Options - **to** The email address to which the email will be sent. Must be a verified email address. - **send** If true, email will be sent upon creation. - **subject** The email subject line. - **text** The plain text body of the email. - **html** The HTML body of the email. #### messages.forward(messageId, messageForwardOptions) Forwards the specified email to a verified email address. ```js await mailosaur.messages.forward('MESSAGE_ID', { to: 'verified-address@example.com', text: 'FYI' }) ``` ##### Options - **to** The email address to which the email will be sent. Must be a verified email address. - **text** Any additional plain text content to forward the email with. - **html** Any additional HTML content to forward the email with. #### messages.reply(messageId, messageReplyOptions) Sends a reply to the specified email. This is useful for when simulating a user replying to one of your emails. ```js await mailosaur.messages.reply('MESSAGE_ID', { text: 'FYI' }) ``` ##### Options - **text** Any additional plain text content to include in the reply. - **html** Any additional HTML content to include in the reply. ### Servers Inboxes capture emails and SMS messages, group your tests and settings, and manage access for your team. #### servers.list() Returns a list of your inboxes. Inboxes are returned sorted in alphabetical order. ```js const result = mailosaur.servers.list(); console.log('You have an inbox called:', result.items[0].name); ``` #### servers.create(server) Creates a new inbox. Only the `name` property is required to create a new inbox via the API. ```js await mailosaur.servers.create({ name: 'My email tests' }); ``` #### servers.get(id) Retrieves the detail for a single inbox. Simply supply the unique identifier for the required inbox. ```js const server = await mailosaur.servers.get('SERVER_ID'); ``` #### servers.getPassword(id) Retrieves the password, for use with SMTP and POP3, for a single inbox. Simply supply the unique identifier for the required inbox. ```js const password = await mailosaur.servers.getPassword('SERVER_ID'); ``` #### servers.update(id, server) Updates a single inbox. ```js await mailosaur.servers.update('SERVER_ID', { name: 'Updated inbox name' }); ``` #### servers.del(id) Permanently deletes an inbox. Also deletes all messages and associated attachments within the inbox. This operation cannot be undone. ```js await mailosaur.servers.del('SERVER_ID'); ``` #### servers.generateEmailAddress(id) Utility method to help you generate a random email address for a given inbox. ```js const emailAddress = mailosaur.servers.generateEmailAddress('SERVER_ID'); console.log(emailAddress); // "bgwqj@SERVER_ID.mailosaur.net" ``` To learn about inbox IDs, and what to replace `SERVER_ID` with, see [sending email to Mailosaur](/docs/email-testing/sending-to-mailosaur). ### Files #### files.getEmail(messageId) Downloads an EML file representing the specified email. Simply supply the unique identifier for the required email. #### files.getAttachment(attachmentId) Downloads a single attachment. Simply supply the unique identifier for the required attachment. ### Analysis #### analysis.spam(messageId) Perform spam testing on the specified email. ### Usage #### usage.limits() Retrieve account usage limits. Details the current limits and usage for your account. This endpoint requires authentication with an account-level API key. #### usage.transactions() Retrieves the last 31 days of transactional usage. This endpoint requires authentication with an account-level API key. --- Source: https://mailosaur.com/docs/automation/links # Extracting links from email and SMS Learn how to test hyperlinks found in email and SMS messages with Mailosaur. ## Before you begin The examples shown below are based on two key assumptions: 1. You have already created a basic automated test using our getting started guides. 2. You have a chosen assertion library that you will use to test the values shown below. ## Links within email HTML content When an email is sent with an HTML body, Mailosaur automatically extracts any hyperlinks found within anchor (`
`) and area (``) elements and makes these available via the `html.links` array. Each link has a `text` property, representing the display text of the hyperlink within the body, and an `href` property containing the target URL. Note that only links that have been correctly marked up in HTML will be detected. ```nodejs // How many links? console.log(message.html.links.length) // 2 const firstLink = message.html.links[0] console.log(firstLink.text) // "Google Search" console.log(firstLink.href) // "https://www.google.com/" ``` ```python # How many links? print(len(message.html.links)) # 2 first_link = message.html.links[0] print(first_link.text) # "Google Search" print(first_link.href) # "https://www.google.com/" ``` ```java // How many links? System.out.println(message.html().links().size()); // 2 Link firstLink = message.html().links().get(0); System.out.println(firstLink.text()); // "Google Search" System.out.println(firstLink.href()); // "https://www.google.com/" ``` ```csharp // How many links? Console.WriteLine(message.Html.Links.Count); // 2 var firstLink = message.Html.Links[0]; Console.WriteLine(firstLink.Text); // "Google Search" Console.WriteLine(firstLink.Href); // "https://www.google.com/" ``` ```ruby # How many links? puts(message.html.links.length) # 2 first_link = message.html.links[0] puts(first_link.text) # "Google Search" puts(first_link.href) # "https://www.google.com/" ``` ```php // How many links? print(count($message->html->links)); // 2 $firstLink = $message->html->links[0]; print($firstLink->text); // "Google Search" print($firstLink->href); // "https://www.google.com/" ``` ```go // How many links? fmt.Println(len(message.Html.Links)) // 2 firstLink := message.Html.Links[0] fmt.Println(firstLink.Text) // "Google Search" fmt.Println(firstLink.Href) // "https://www.google.com/" ``` ## Links within email and SMS text content As with links found within the HTML content of an email, Mailosaur also detects and extracts links found within the plain text of a message (both email and SMS). These are made available via the `text.links` array. Each link has an `href` property containing the target URL. Whilst each link also has a `text` property, this will always have the same value as `href`. ```nodejs // How many links? console.log(message.text.links.length) // 2 const firstLink = message.text.links[0] console.log(firstLink.href) // "https://www.google.com/" ``` ```python # How many links? print(len(message.text.links)) # 2 first_link = message.text.links[0] print(first_link.href) # "https://www.google.com/" ``` ```java // How many links? System.out.println(message.text().links().size()); // 2 Link firstLink = message.text().links().get(0); System.out.println(firstLink.text()); // "Google Search" System.out.println(firstLink.href()); // "https://www.google.com/" ``` ```csharp // How many links? Console.WriteLine(message.Text.Links.Count); // 2 var firstLink = message.Text.Links[0]; Console.WriteLine(firstLink.Href); // "https://www.google.com/" ``` ```ruby # How many links? puts(message.text.links.length) # 2 first_link = message.text.links[0] puts(first_link.href) # "https://www.google.com/" ``` ```php // How many links? print(count($message->text->links)); // 2 $firstLink = $message->text->links[0]; print($firstLink->href); // "https://www.google.com/" ``` ```go // How many links? fmt.Println(len(message.Text.Links)) // 2 firstLink := message.Text.Links[0] fmt.Println(firstLink.Href) // "https://www.google.com/" ``` #### See also - [Extracting codes](/docs/automation/codes) - [Testing email attachments](/docs/automation/attachments) --- Source: https://mailosaur.com/docs/automation/message-properties # Message properties Learn how to test the common properties of an email or SMS message with Mailosaur. ## Before you begin The examples shown below are based on two key assumptions: 1. You have already created a basic automated test using our [getting started guides](/docs/automation). 2. You have a chosen assertion library that you will use to test the values shown below. ## Email subject Allows you to check that the correct subject will be displayed in a recipient’s mail client. ```nodejs console.log(message.subject) // "Hello world" ``` ```python print(message.subject) # "Hello world" ``` ```java System.out.println(message.subject()); // "Hello world" ``` ```csharp Console.WriteLine(message.Subject); // "Hello world" ``` ```ruby puts(message.subject) # "Hello world" ``` ```php print($message->subject); // "Hello world" ``` ```go fmt.Println(message.Subject) // "Hello world" ``` ## Recipients The `to` property of a message contains an array of all recipients of a message (excluding those that have been carbon-copied on an email). ```nodejs console.log(message.to[0].name) // "Jill Smith" console.log(message.to[0].email) // "jill@example.com" // Phone number (for SMS tests only) console.log(message.to[0].phone) // "+15554532452" ``` ```python print(message.to[0].name) # "Jill Smith" print(message.to[0].email) # "jill@example.com" # Phone number (for SMS tests only) print(message.to[0].phone) # "+15554532452" ``` ```java System.out.println(message.to().get(0).name()); // "Jill Smith" System.out.println(message.to().get(0).email()); // "jill@example.com" // Phone number (for SMS tests only) System.out.println(message.to().get(0).phone()); // "+15554532452" ``` ```csharp Console.WriteLine(message.To[0].Name); // "Jill Smith" Console.WriteLine(message.To[0].Email); // "jill@example.com" // Phone number (for SMS tests only) Console.WriteLine(message.To[0].Phone); // "+15554532452" ``` ```ruby puts(message.to[0].name) # "Jill Smith" puts(message.to[0].email) # "jill@example.com" # Phone number (for SMS tests only) puts(message.to[0].phone) # "+15554532452" ``` ```php print($message->to[0]->name); # "Jill Smith" print($message->to[0]->email); # "jill@example.com" // Phone number (for SMS tests only) print($message->to[0]->phone); # "+15554532452" ``` ```go fmt.Println(message.To[0].Name) // "Jill Smith" fmt.Println(message.To[0].Email) // "jill@example.com" // Phone number (for SMS tests only) fmt.Println(message.To[0].Phone) // "+15554532452" ``` ### Carbon copy (CC) recipients ```nodejs console.log(message.cc[0].name) // "Jack Smith" console.log(message.cc[0].email) // "jack@example.com" ``` ```python print(message.cc[0].name) # "Jack Smith" print(message.cc[0].email) # "jack@example.com" ``` ```java System.out.println(message.cc().get(0).name()); // "Jack Smith" System.out.println(message.cc().get(0).email()); // "jack@example.com" ``` ```csharp Console.WriteLine(message.Cc[0].Name); // "Jack Smith" Console.WriteLine(message.Cc[0].Email); // "jack@example.com" ``` ```ruby puts(message.cc[0].name) # "Jack Smith" puts(message.cc[0].email) # "jack@example.com" ``` ```php print($message->cc[0]->name); # "Jack Smith" print($message->cc[0]->email); # "jack@example.com" ``` ```go fmt.Println(message.Cc[0].Name) // "Jack Smith" fmt.Println(message.Cc[0].Email) // "jack@example.com" ``` ### Blind carbon-copy (BCC) recipients ```nodejs console.log(message.bcc[0].name) // "Bob Smith" console.log(message.bcc[0].email) // "bob@example.com" ``` ```python print(message.bcc[0].name) # "Bob Smith" print(message.bcc[0].email) # "bob@example.com" ``` ```java System.out.println(message.bcc().get(0).name()); // "Bob Smith" System.out.println(message.bcc().get(0).email()); // "bob@example.com" ``` ```csharp Console.WriteLine(message.Bcc[0].Name); // "Bob Smith" Console.WriteLine(message.Bcc[0].Email); // "bob@example.com" ``` ```ruby puts(message.bcc[0].name) # "Bob Smith" puts(message.bcc[0].email) # "bob@example.com" ``` ```php print($message->cc[0]->name); # "Bob Smith" print($message->cc[0]->email); # "bob@example.com" ``` ```go fmt.Println(message.Bcc[0].Name) // "Bob Smith" fmt.Println(message.Bcc[0].Email) // "bob@example.com" ``` ## Sender The `from` property of a message contains an array of senders. In almost all cases there will only be 1, however, the email specification technically allows for multiple senders to exist. ```nodejs console.log(message.from[0].name) // "Customer Support" console.log(message.from[0].email) // "noreply@example.com" // Phone number (for SMS tests only) console.log(message.from[0].phone) // "+15554532452" ``` ```python print(message.sender[0].name) # "Customer Support" print(message.sender[0].email) # "noreply@example.com" # Phone number (for SMS tests only) print(message.sender[0].phone) # "+15554532452" ``` ```java System.out.println(message.from().get(0).name()); // "Customer Support" System.out.println(message.from().get(0).email()); // "noreply@example.com" // Phone number (for SMS tests only) System.out.println(message.from().get(0).phone()); // "+15554532452" ``` ```csharp Console.WriteLine(message.From[0].Name); // "Customer Support" Console.WriteLine(message.From[0].Email); // "noreply@example.com" // Phone number (for SMS tests only) Console.WriteLine(message.From[0].Phone); // "+15554532452" ``` ```ruby puts(message.from[0].name) # "Customer Support" puts(message.from[0].email) # "noreply@example.com" # Phone number (for SMS tests only) puts(message.from[0].phone) # "+15554532452" ``` ```php print($message->from[0]->name); # "Customer Support" print($message->from[0]->email); # "noreply@example.com" // Phone number (for SMS tests only) print($message->from[0]->phone); # "+15554532452" ``` ```go fmt.Println(message.From[0].Name) // "Customer Support" fmt.Println(message.From[0].Email) // "noreply@example.com" // Phone number (for SMS tests only) fmt.Println(message.From[0].Phone) // "+15554532452" ``` ## Email Headers Emails contain a set of headers that are used to transmit metadata which is typically not visible to the recipient. All email headers are available via the `metadata.headers` property of a message. Each header has both a `field` and `value` property. ```nodejs const headers = message.metadata.headers const returnPath = headers.find( h => h.field.toLowerCase() === 'return-path' ) console.log(returnPath.value); // "" ``` ```python headers = message.metadata.headers return_path = [h for h in headers if h.field.lower() == "return-path"] print(return_path[0].value) # "" ``` ```java List headers = message.metadata().headers(); Optional returnPath = headers.stream() .filter(h -> h.field().toLowerCase().equals("return-path")).findFirst(); System.out.println(returnPath.get().value()); // "" ``` ```csharp var headers = message.Metadata.Headers; var returnPath = headers.First(h => h.Field.ToLowerInvariant().Equals("return-path")); Console.WriteLine(returnPath.Value); // "" ``` ```ruby headers = message.metadata.headers idx = headers.find_index{ |h| h.field.downcase == "return-path" } puts(headers[idx].value) # "" ``` ```php $headers = $message->metadata->headers; $returnPath = array_values(array_filter($headers, function ($h) { return strtolower($h->field) === "return-path"; }))[0]; print($returnPath->value); ``` ```go headers := message.Metadata.Headers idx := sort.Search(len(headers), func(i int) bool { return strings.ToLower(headers[i].Field) == "return-path" }) fmt.Println(headers[idx].Value) // "" ``` --- Source: https://mailosaur.com/docs/automation/nodejs # Using Node.js to test email or SMS messages Learn how to test email and SMS in Node.js with Mailosaur. Whether you're using Playwright, Cypress, or any other Node.js setup, you can automate the testing of email, SMS, and multi-factor authentication with just a few lines of code. Mailosaur has official libraries for most languages, including Node.js, as well as a [Cypress plugin](/docs/automation/cypress). Increasing your end-to-end test coverage couldn't be simpler. ## Email and SMS testing guides > [!LINK](/docs/email-testing/nodejs) > ### Email testing with Node.js > Our guide on testing email with Mailosaur and Node.js > [!LINK](/docs/automation/cypress/email-testing) > ### Email testing with Cypress > If you're using Cypress, you'll want to follow this guide > [!LINK](/docs/automation/cypress/sms-testing) > ### SMS testing with Cypress > If you're using Cypress, you'll want to follow this guide --- Source: https://mailosaur.com/docs/automation/php # How to test email and SMS in PHP Learn how to automate testing of email and SMS messages in PHP, using Mailosaur. ## 1. Create a Mailosaur account If you already have an account, skip to step 2. To create a new trial account, [sign up here](/app/signup). ## 2. Create a sample project ### Install PHP To see if you already have PHP installed, open a terminal window and run this command: ```bash php --version ``` If PHP is installed, you’ll see a version number. If you see an error instead, then [download PHP](https://www.php.net) and install it. ### Create a new project Run each of these commands to create a new folder for your PHP project: ```bash mkdir EmailTests cd EmailTests ``` ### Install the Mailosaur PHP library Run this command to install the [Mailosaur PHP package](https://github.com/mailosaur/mailosaur-php): ```bash composer require mailosaur/mailosaur ``` If you don’t have composer installed, [download and install it here](https://getcomposer.org). ## 3. Send email to your Mailosaur inbox Inboxes allow you to group tests, permissions, and other settings together. Each inbox has an **Inbox ID** and a **domain name**. You need these values to both send email to Mailosaur, and to set up automated testing. You also need an [API key](/docs/managing-your-account/api-keys) to use. You can learn more about [creating API keys here](/docs/managing-your-account/api-keys). ### Retrieve your inbox’s attributes 1. In the left-hand navigation, locate the **Inboxes** section. 2. Click on the name of the inbox you want to test with. 3. Click the **Settings** tab. 4. Make a note of the **Inbox ID** and **Domain**. 5. Get an API key from the [API Keys](/app/keys) page. ### Send an email to your inbox If the **domain name** of your inbox above was: ```bash example.mailosaur.net ``` Then you can send an email to it with these steps: 1. Open up an email client and send an email to `anything@example.mailosaur.net` 2. In the left-hand navigation, locate the **Inboxes** section. 3. Click on the name of the inbox you sent an email to. 4. Confirm the email is there. Note that some services (like Gmail) may take 10-20 seconds to send a message through. To learn more, read our guide on [sending email to Mailosaur](/docs/email-testing/sending-to-mailosaur). ## 4. Find an email for automated testing Now that you have a sample project, your inbox’s credentials, and an email to test, then you’re ready to continue. Create a file named `hello.php` and type or paste in this code sample, replacing the template code with the values from step 3 above: ```php sentTo = 'anything@' . $serverDomain; $email = $mailosaur->messages->get($serverId, $criteria); print('Subject: ' . $email->subject); ?> ``` This code connects to Mailosaur and looks for any email that has been sent to the address provided in the search criteria. Save your changes and run the code: ```bash php hello.php ``` If everything is set up correctly, you should see the subject line of the last email you sent, printed to screen: ```bash Subject: My example email ``` ### Troubleshooting If you see an error, e.g. ‘No matching messages found in time’: - Make sure you have set the **sent to** address correctly in your code. - Ensure that you have sent an email to the **sent to** address (check this is visible in the Mailosaur Dashboard). - Note that by default, the **get** method will only look for messages that were received by Mailosaur within the last hour. You can override this using the `receivedAfter` option (see library reference below). ## 5. Narrowing your search results ### Only find messages received after a certain time By default, searches include messages received in the last hour, but you can customise the search window with the `receivedAfter` option. This example shows you how to only include emails received after your test started: ```php $testStart = new \DateTime(); // Perform the steps that send a message here $criteria = new SearchCriteria(); $criteria->sentTo = '...'; $message = $mailosaur->messages->get( '...', $criteria, 10000, // Wait for up to 10 seconds $testStart ); ``` ### Search criteria As you can see in the examples so far, you can search for the email address or phone number a message was sent to, but you can also search using these criteria: | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **sentFrom** | The full email address from which the target message was sent. | | **sentTo** | The full email address to which the target message was sent. | | **subject** | Find emails where the subject line contains this text. | | **body** | Finds messages where the message body contains this text. | ## 6. Start writing tests Now that you have a working project that fetches an email, you can use this to begin writing tests for various pieces of functionality. Check out these guides on the most common test cases: > [!LINK](/docs/automation/text-content) > ### How to test the text content of email or SMS > Learn how to test the text content of email or SMS with Mailosaur. > [!LINK](/docs/automation/html-content) > ### HTML content of an email > Learn how to work with the HTML content found within your emails. > [!LINK](/docs/automation/codes) > ### Extracting codes from email and SMS > Learn how to test verification codes found in email and SMS messages with Mailosaur. > [!LINK](/docs/automation/links) > ### Extracting links from email and SMS > Learn how to test hyperlinks found in email and SMS messages with Mailosaur. > [!LINK](/docs/automation/attachments) > ### Email attachments > Learn how to test the email attachments with Mailosaur. > [!LINK](/docs/automation/images) > ### Images and web beacons > Learn how to work with images, including web beacons, within an HTML email. > [!LINK](/docs/automation/message-properties) > ### Message properties > Learn how to test the common properties of an email or SMS message with Mailosaur. > [!LINK](/docs/automation/spam) > ### How to test email spam score > Learn how to test the SpamAssassin score of an email with Mailosaur. ## SMS Testing You can test SMS messages in much the same way as email. Take a look at our [guide on testing SMS messages](/docs/sms-testing) for more information. ## Library reference The PHP client library gives you access to several other methods. ### Messages Messages is the collective name given to the email and/or SMS messages that are sent into Mailosaur for testing. The [message object](/docs/api) contains everything you need to perform in-depth automated testing. #### messages->get(server, criteria, timeout, receivedAfter) Waits for a message to be found. Returns as soon as a message matching the specified search criteria is found. **Recommended:** This is the most efficient method of looking up a message, therefore we recommend using it wherever possible. ```php $criteria = new SearchCriteria(); $criteria->sentTo = 'someone@SERVER_ID.mailosaur.net'; $message = $mailosaur->messages->get('SERVER_ID', $criteria); ``` To learn about inbox IDs, and what to replace `SERVER_ID` with, see [sending email to Mailosaur](/docs/email-testing/sending-to-mailosaur). ##### Criteria | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **sentFrom** | The full email address from which the target message was sent. | | **sentTo** | The full email address to which the target message was sent. | | **subject** | The subject line of the target email. | | **body** | Search for part of the message body. | | **match** | If set to `ALL` (default), then only results that match all specified criteria will be returned. If set to `ANY`, results that match any of the specified criteria will be returned. | ##### Options | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **timeout** | Specify how long to wait for a matching result (in milliseconds, _default value is 10 seconds_). | | **receivedAfter** | Limits results to only messages received after this date/time (_default 1 hour ago_). | ```php $criteria = new SearchCriteria(); $criteria->sentTo = 'someone@SERVER_ID.mailosaur.net'; $tenMinutesAgo = new \DateTime(); $tenMinutesAgo->sub(new \DateInterval('PT10M')); # Search all messages received in the last 10 minutes (with 10s timeout) $message = $mailosaur->messages->get('SERVER_ID', $criteria, 10000, $tenMinutesAgo); ``` #### messages->all(server, page, itemsPerPage, receivedAfter) Returns a list of your messages in summary form. The summaries are returned sorted by received date, with the most recently-received messages appearing first. > [!SUCCESS] > The method returns a message summary, rather than the full message object. This means that several properties, like the message body, are not included. To get this data, you’ll need to call [`getById`](#messages-getbyidid). Alternatively, we recommend using the [`get`](#messages-getserver-criteria-timeout-receivedafter) method, which is a far more efficient approach. ```php # List the most recent messages $result = $mailosaur->messages->all('SERVER_ID'); # Get the most recent message (the first one in the list) $message = $result->items[0]; print('Subject: ' . $message->subject); ``` ##### Options - **receivedAfter** Allows you to customise how far back to look for messages. - **page** Used alongside `itemsPerPage` to paginate through results. This is zero-based, meaning `0` is the first page of results. - **itemsPerPage** A limit on the number of results to be returned. This can be set between 1 to 1000, with the default being 50. - **dir** Optionally limits results based on the direction (`Sent` or `Received`), with the default being `Received`. ```php $tenMinutesAgo = new \DateTime(); $tenMinutesAgo->sub(new \DateInterval('PT10M')); # List all results received in the last 10 minutes. # Limit results to the first 10 matches only. $result = $mailosaur->messages->all('SERVER_ID', 0, 10, $tenMinutesAgo); ``` #### messages->search(server, criteria, page, itemsPerPage, timeout, receivedAfter) Returns a list of messages matching the specified search criteria, in summary form. The messages are returned sorted by received date, with the most recently-received messages appearing first. > [!SUCCESS] > The method returns a message summary, rather than the full message object. This means that several properties, like the message body, are not included. To get this data, you’ll need to call [`getById`](#messages-getbyidid). Alternatively, we recommend using the [`get`](#messages-getserver-criteria-timeout-receivedafter) method, which is a far more efficient approach. ```php $criteria = new SearchCriteria(); $criteria->sentTo = 'someone@SERVER_ID.mailosaur.net'; $result = $mailosaur->messages->search('SERVER_ID', $criteria); # Get the most recent match $message = $result->items[0]; print('Subject: ' . $message->subject); ``` ##### Criteria | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **sentFrom** | The full email address from which the target message was sent. | | **sentTo** | The full email address to which the target message was sent. | | **subject** | The subject line of the target email. | | **body** | Search for part of the message body. | | **match** | If set to `ALL` (default), then only results that match all specified criteria will be returned. If set to `ANY`, results that match any of the specified criteria will be returned. | ##### Options | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **timeout** | If provided, determines how long to wait for a matching result (provided in milliseconds). | | **errorOnTimeout** | When set to `false`, an error will not be thrown if timeout is reached (default: `true`). | | **receivedAfter** | Allows you to customise how far back to look for messages. | | **page** | Used alongside `itemsPerPage` to paginate through results. This is zero-based, meaning `0` is the first page of results. | | **itemsPerPage** | A limit on the number of results to be returned. This can be set between 1 to 1000, with the default being 50. | | **dir** | Optionally limits results based on the direction (`Sent` or `Received`), with the default being `Received`. | ```php $criteria = new SearchCriteria(); $criteria->sentTo = 'someone@SERVER_ID.mailosaur.net'; # Search for all messages sent to someone@SERVER_ID.mailosaur.net, # received in the last 2 hours. Limit results to the first 10 matches only. $twoHoursAgo = new \DateTime(); $twoHoursAgo->sub(new \DateInterval('PT2H')); $result = $mailosaur->messages->search('SERVER_ID', $criteria, 0, 10, null, $twoHoursAgo); ``` #### messages->getById(id) Retrieves the detail for a single email message. Must be used in conjunction with either [`all`](#messages-allserver-page-itemsperpage-receivedafter) or [`search`](#messages-searchserver-criteria-page-itemsperpage-timeout-receivedafter) in order to get the unique identifier for the required message. **We always recommend using the** [`get`](#messages-getserver-criteria-timeout-receivedafter) **method instead**. ```php $result = $mailosaur->messages->all('SERVER_ID'); $messageId = $result->items[0]->id; $message = $mailosaur->messages->getById($messageId); print('Subject: ' . $message->subject); ``` #### messages->delete(id) Permanently deletes a message. Also deletes any attachments related to the message. This operation cannot be undone. ```php $mailosaur->messages->delete($messageId); ``` #### messages->deleteAll(server) Permanently deletes all messages held in the specified inbox. Also deletes any attachments related to each message. This operation cannot be undone. ```php $mailosaur->messages->deleteAll('SERVER_ID'); ``` #### messages->create(server, messageCreateOptions) Creates a new message that can be sent to a verified email address. This is useful in scenarios where you want an email to trigger a workflow in your product. ```php $options = new MessageCreateOptions(); $options->to = 'verified-address@example.com'; $options->send = TRUE; $options->subject = 'Request'; $options->text = 'Please can you give us a call back?'; $mailosaur->messages->create('SERVER_ID', $options); ``` ##### Options - **to** The email address to which the email will be sent. Must be a verified email address. - **send** If true, email will be sent upon creation. - **subject** The email subject line. - **text** The plain text body of the email. - **html** The HTML body of the email. #### messages->forward(messageId, messageForwardOptions) Forwards the specified email to a verified email address. ```php $options = new MessageForwardOptions(); $options->to = 'verified-address@example.com'; $options->text = 'FYI'; $mailosaur->messages->forward('MESSAGE_ID', $options); ``` ##### Options - **to** The email address to which the email will be sent. Must be a verified email address. - **text** Any additional plain text content to forward the email with. - **html** Any additional HTML content to forward the email with. #### messages->reply(messageId, messageReplyOptions) Sends a reply to the specified email. This is useful for when simulating a user replying to one of your emails. ```php $options = new MessageReplyOptions(); $options->text = 'FYI'; $mailosaur->messages->reply('MESSAGE_ID', $options); ``` ##### Options - **text** Any additional plain text content to include in the reply. - **html** Any additional HTML content to include in the reply. ### Servers Inboxes capture emails and SMS messages, group your tests and settings, and manage access for your team. #### servers->all() Returns a list of your inboxes. Inboxes are returned sorted in alphabetical order. ```php $result = $mailosaur->servers->all(); print('You have an inbox called: ' . $result->items[0]->name); ``` #### servers->create(server) Creates a new inbox. Only the `name` property is required to create a new inbox via the API. ```php $createOptions = new ServerCreateOptions('My email tests'); $mailosaur->servers->create($createOptions); ``` #### servers->get(id) Retrieves the detail for a single inbox. Simply supply the unique identifier for the required inbox. ```php $server = $mailosaur->servers->get('SERVER_ID'); ``` #### servers->getPassword(id) Retrieves the password, for use with SMTP and POP3, for a single inbox. Simply supply the unique identifier for the required inbox. ```php $password = $mailosaur->servers->getPassword('SERVER_ID'); ``` #### servers->update(id, server) Updates a single inbox. ```php $retrievedServer = $mailosaur->servers->get('SERVER_ID'); $retrievedServer->name = 'Updated inbox name'; $mailosaur->servers->update($retrievedServer->id, $retrievedServer); ``` #### servers->delete(id) Permanently deletes an inbox. Also deletes all messages and associated attachments within the inbox. This operation cannot be undone. ```php $mailosaur->servers->delete('SERVER_ID'); ``` #### servers->generateEmailAddress(id) Utility method to help you generate a random email address for a given inbox. ```php $emailAddress = $mailosaur->servers->generateEmailAddress('SERVER_ID'); print($emailAddress); // "bgwqj@SERVER_ID.mailosaur.net" ``` To learn about inbox IDs, and what to replace `SERVER_ID` with, see [sending email to Mailosaur](/docs/email-testing/sending-to-mailosaur). ### Files #### files->getEmail(messageId) Downloads an EML file representing the specified email. Simply supply the unique identifier for the required email. #### files->getAttachment(attachmentId) Downloads a single attachment. Simply supply the unique identifier for the required attachment. ### Analysis #### analysis->spam(messageId) Perform spam testing on the specified email. ### Usage #### usage->limits() Retrieve account usage limits. Details the current limits and usage for your account. This endpoint requires authentication with an account-level API key. #### usage->transactions() Retrieves the last 31 days of transactional usage. This endpoint requires authentication with an account-level API key. --- Source: https://mailosaur.com/docs/automation/playwright # Using Mailosaur with Playwright Find the guides you need to fully use your Mailosaur subscription. Mailosaur is very simple to effectively integrate with Playwright. In order to make the most of Mailosaur's key features within Playwright, make sure to follow our guides below: ![YouTube Video](https://youtu.be/PdlRr1-TMno?si=1tttfggwZqGQYeTy) ## Overview - Start by reading our [quickstart guide](/docs/automation/playwright/quickstart) for Playwright users - Read our guide on [Playwright email testing](/docs/automation/playwright/email-testing) - Learn how to test [SMS messages with Playwright](/docs/automation/playwright/sms-testing) ## Generating a starter project With **npm** installed, you can generate a basic starter project for Playwright via the command line: ```sh npm create mailosaur@latest ``` ## Learn more - See some [sample code](https://github.com/mailosaur/examples/tree/main/playwright) on GitHub. - Check out the [API reference](/docs/api) - detailed API documentation. - Read the [Node.js API library](https://github.com/mailosaur/mailosaur-node) documentation on GitHub. - [API client libraries](/docs/automation) - Check out the other Mailosaur API clients. --- Source: https://mailosaur.com/docs/automation/playwright/email-testing # Email testing for Playwright Learn how to integrate Mailosaur Email Testing into Playwright. ## What you'll find in this guide - How to test various aspects of emails - Testing links and codes - Managing email tests ## What you'll need - An understanding of Playwright. - A Mailosaur account. If you don't have one, [start a free trial](/app/signup). - A Playwright project with Mailosaur's API client configured. [See our short guide](/docs/automation/playwright/quickstart) to do this. ## Basic usage To perform email testing with Playwright, simply: 1. Send an email to your Mailosaur inbox (such as a password reset request) 2. Connect to the Mailosaur API with the official client library. 3. Find the email you sent. 4. Perform assertions in the same way as any other test. To learn about Server IDs, and what to replace SERVER_ID with, [see sending test emails to Mailosaur](/docs/email-testing/sending-to-mailosaur). ```js // Setup the API client const mailosaur = new MailosaurClient("API_KEY"); // Search for the message const message = await mailosaur.messages.get('SERVER_ID', { sentTo: 'my-test@SERVER_ID.mailosaur.net' }); // Perform test assertions expect(message.from[0].name).toEqual('Support'); expect(message.from[0].email).toEqual('noreply@acme.com'); ``` You can use this example to search for the email address that a message was sent to. You can also search using the below criteria: | **Parameter** | **Description** | | ------------- | ------------------------------------------------------------- | | sentTo | The full email address to which the target message was sent | | sentFrom | The full email address from which the target message was sent | | subject | Finds messages where the subject line contains this text | | body | Finds messages where the message body contains this text | ### Test email addresses Every inbox in your account (also known as a server) has a unique server ID. This is used to create your inbox domain name, such as: `SERVER_ID.mailosaur.net`. This domain supports a wildcard email pattern, so any email address ending `@SERVER_ID.mailosaur.net` works out of the box. **You don't need to create email addresses** before using them, they just work! However, if you would like extra support creating unique email addresses, you can use this helper method: ```js const emailAddress = mailosaur.servers.generateEmailAddress("SERVER_ID"); console.log(emailAddress); // "bgwqj@SERVER_ID.mailosaur.net" ``` ## Find an email Search for a specific message within your inbox, ideally using `messages.get()`, as it will automatically wait for messages to arrive, and return the full message result. ```js const message = await mailosaur.messages.get("SERVER_ID", { sentTo: "test123@SERVER_ID.mailosaur.net", }); console.log(message.html.body); ``` ### Time range for searching By default searches only look for messages received in the last hour. If you want to look further back than this, just set the 'received after' parameter. ```js // Calculate a datetime for yesterday const yesterday = new Date(Date.now() - 24 * 60 * 60 * 1000); // Use this timestamp in the search const message = await mailosaur.messages.get("SERVER_ID", { sentTo: "test123@SERVER_ID.mailosaur.net", }, { receivedAfter: yesterday }); ``` ### "No matching messages" troubleshooting If you see the error "No matching messages found in time" when searching for messages: - Ensure that the target email or SMS message is visible in the Mailosaur Dashboard, as it may not have arrived at all. - Check when the message arrived. By default, searches only include messages received within the last hour. See "time range for searching" above on how to override this. - Check you have correctly set the **sent to** parameter in your search criteria. ## Other ways to fetch emails > [!WARNING] > > #### Remember, it is usually better to use `messages.get()` > > The `list` and `search` methods only return basic summaries, leaving several properties (including the message body) out. To get this data, use [`.getById()`](#6-messagesgetbyidid). Unless there is a specific reason not to, we recommend using the [`messages.get()`](#2-messagesgetserver-criteria-options) as this automatically waits for a matching result and returns the message in the result. ### List current inbox contents List everything currently in your inbox. ```js // List the most recent messages const result = await mailosaur.messages.list("SERVER_ID"); // Get the most recent message (the first one in the list) const latestMessage = result.items[0]; // Get the full message object const message = await mailosaur.messages.getById(latestMessage.id); console.log(message.html.body); ``` ### Searching for multiple messages See if multiple messages meet a set criteria. ```js // Search for all messages sent to someone@SERVER_ID.mailosaur.net. // Limit results to the first 10 matches only. const result = await mailosaur.messages.search( "SERVER_ID", { sentTo: "someone@SERVER_ID.mailosaur.net", }, { page: 0, itemsPerPage: 10, } ); // Get the most recent message (the first one in the list) const latestMessage = result.items[0]; // Get the full message object const message = await mailosaur.messages.getById(latestMessage.id); console.log(message.html.body); ``` ## Common test scenarios ### Testing basic properties Once you have fetched an email (e.g. using `messages.get`), test the properties of that email: ```js // Test the email subject line expect(message.subject).toEqual("Password reset"); // Test sender information expect(message.from[0].name).toEqual("Support"); expect(message.from[0].email).toEqual("noreply@acme.com"); // Test recipient information expect(message.to[0].name).toEqual("John Smith"); expect(message.to[0].email).toEqual("john@SERVER.mailosaur.net"); ``` #### Testing carbon-copy recipients ```js // Carbon copy (CC) recipients expect(message.cc[0].name).toEqual("Jane Smith"); expect(message.cc[0].email).toEqual("jane@SERVER.mailosaur.net"); // Blind carbon copy (BCC) recipients expect(message.bcc[0].name).toEqual("Jill Smith"); expect(message.bcc[0].email).toEqual("jill@SERVER.mailosaur.net"); ``` ### Testing email contents Most emails have separate HTML and plain text content. This is how to test either content type: #### Plain text content ```js // Check that the email contains some text console.log(message.text.body); // "Hi Jason, ..." ``` #### HTML content When testing HTML content, you can perform basic contains or equals assertions as you would with plain text content: ```js // Check that raw HTML contains some expected content console.log(message.html.body); // "Hello world" ``` ### Testing links Any links that are found in the content of your email are instantly available via the `html.links` or `text.links` arrays, depending on where the link was found: ```js // Working with links in HTML content const linkInHtml = message.html.links[0]; expect(linkInHtml.text).toEqual("Google Search"); expect(linkInHtml.href).toEqual("https://www.google.com/"); // Working with links in plain text content const linkInPlainText = message.text.links[0]; expect(linkInPlainText.href).toEqual("https://www.google.com/"); ``` #### Clicking a link To simulate a link being clicked, you can do this with `HttpClient`: ```js const https = require("https"); // ... const href = message.html.links[0].href; // Make an HTTP call to simulate someone clicking a link https.get(href, (r) => console.log(r.statusCode)); // 200 ``` ### Testing verification codes Codes are automatically extracted from the content and made available via the `html.codes` or `text.codes` arrays: ```js // Working with codes in HTML content const codeInHtml = message.html.codes[0]; expect(codeInHtml.value).toEqual("456812"); // Working with codes in plain text content const codeInText = message.text.codes[0]; expect(codeInText.value).toEqual("456812"); ``` ### Testing attachments Any email attachments are made available via the attachments array: ```js // Number of attachments found console.log(message.attachments.length); // 2 // Get the first attachment const attachment = message.attachments[0]; // Check attachment attributes expect(attachment.fileName).toEqual("example.pdf"); expect(attachment.contentType).toEqual("application/pdf"); expect(attachment.length).toEqual(4028); ``` #### Save an attachment to disk You can download and save attachments using the `files.getAttachment` and `fs` methods: ```js const firstAttachment = message.attachments[0]; const file = await mailosaur.files.getAttachment(firstAttachment.id); fs.writeFileSync(firstAttachment.fileName, file); ``` #### Encoding attachments In some scenarios you may need a base64-encoded copy of an attachment: ```js const firstAttachment = message.attachments[0]; const file = await mailosaur.files.getAttachment(firstAttachment.id); const base64 = file.toString("base64"); console.log(base64); ``` ### Testing images and web beacons Any images found within the HTML content of an email are made available via the `html.images` array: ```js // Number of images found console.log(message.html.images.length); // Get the first image const image = message.html.images[0]; // Check image attributes expect(image.src).toEqual("https://example.com/balloon.png"); expect(image.alt).toEqual("A hot air balloon"); ``` To test an image's online accessibility, or that a [web beacon](https://en.wikipedia.org/wiki/Web_beacon) is working as expected, perform an HTTP request: ```js const https = require("https"); // ... const image = message.html.images[0]; console.log(image.src); // "https://example.com/s.png?abc123" // Make an HTTP call to trigger the web beacon https.get(image.src, (r) => console.log(r.statusCode)); // 200 ``` ### Sending an email If your product is set up to accept inbound emails, you can use the Mailosaur sending feature to trigger this functionality. The `messages.create` command creates and sends an email to a verified external email address: ```js await mailosaur.messages.create("SERVER_ID", { to: "verified-address@example.com", send: true, subject: "Request", text: "Please can you give us a call back?", }); ``` The options available to use with this method are: | Parameter | Description | | ----------- | ------------------------------------------------------------------------------------ | | send | This must be set to true if you are sending an outbound email | | to | The email address to which the email will be sent. Must be a verified email address. | | subject | The email subject line | | text | The plain text body of the email. | | html | The HTML body of the email. | | attachments | Optional attachments (see 'include attachments' below) | #### Include attachments You can include attachments in emails sent via the API, by including an array of base64-encoded attachment objects: ```js const attachments = [ { fileName: "cat.png", contentType: "image/png", content: "{BASE64_ENCODED_FILE}", }, ]; await mailosaur.messages.create("SERVER_ID", { to: "verified-address@example.com", send: true, subject: "Email from Mailosaur", html: "

Hello world.

", attachments: attachments, }); ``` ### Replying to an email If your product handles email replies, the Mailosaur reply feature simulates this. When you reply, the message is sent back to the original account: ```js await mailosaur.messages.reply("MESSAGE_ID", { text: "FYI", }); ``` | Parameter | Description | | ----------- | ------------------------------------------------------ | | text | Any additional text content to include in the reply | | html | Any additional HTML content to include in the reply | | subject | Optionally override the default subject line | | attachments | Optional attachments (see 'include attachments' above) | ### Forwarding a message to email You can forward messages from your Mailosaur account to external email addresses either one-by-one, or via the creation of automated forwarding rules. To do this **it is essential to set up a [verified external email address](/docs/managing-your-account/external-email-addresses)**, so you can send email to it: ```js await mailosaur.messages.forward("MESSAGE_ID", { to: "verified-address@example.com", text: "FYI", }); ``` | Parameter | Description | | --------- | ------------------------------------------------------------------------------------- | | to | The email address to which the message will be sent. Must be a verified email address | | text | Any additional text content to forward the message with | | html | Any additional HTML content to forward the message with | | subject | Optionally override the default subject line | ## Deleting messages ### Deleting an individual message Permanently deletes a single message and any attachments related to the message. This cannot be undone: ```js await mailosaur.messages.del("MESSAGE_ID"); ``` ### Delete all messages Permanently deletes all messages held in the specified inbox and any attachments related to each message. This cannot be undone: ```js await mailosaur.messages.deleteAll("SERVER_ID"); ``` ## See also - [SMS testing guide](/docs/automation/playwright/sms-testing) - [MFA/2FA guide](/docs/authenticator) --- Source: https://mailosaur.com/docs/automation/playwright/quickstart # Mailosaur and Playwright - Quickstart guide Get Mailosaur up and running within your Playwright project in a few steps. ## What you'll need - A Mailosaur account or [free trial account](/app/signup). - An [API key](/app/keys) generated in your account. - Knowledge of how to send emails (or SMS) into your account. ## Express: Generate a sample project With **npm** installed, get started by generating a basic starter project for Playwright via the command line: ```sh npm create mailosaur@latest ``` This gives you a simple Playwright project with Mailosaur pre-configured, along with some basic tests. You can also see [sample code](https://github.com/mailosaur/examples/tree/main/playwright) on GitHub. ## Integrate into an existing Playwright project With an existing Playwright project (or one you've just created), this is how to install and configure Mailosaur's API client library: ### Install the API client 1. Install the Mailosaur Node.js library: ```sh npm install mailosaur ``` 2. Import the Mailosaur client into your test code: ```js const MailosaurClient = require("mailosaur"); // Find your API key at https://mailosaur.com/app/keys const mailosaur = new MailosaurClient("API_KEY"); ``` ### Make your first API call ```js // Make a simple API call to find the name of your inbox const result = await mailosaur.servers.list(); console.log(`Inbox name is ${result.items[0].name}`); ``` ## Start testing With a project connected to the Mailosaur API, you can start creating tests: - [Email testing](/docs/automation/playwright/email-testing) - test password resets, account verification, order confirmations, etc. - [SMS testing](/docs/automation/playwright/sms-testing) - test alerts, notifications, and 2FA logins - [2FA app testing](/docs/authenticator) - mimic the functionality of apps like Google Authenticator and Auth0 - [Email deliverability testing](/docs/api) --- Source: https://mailosaur.com/docs/automation/playwright/sms-testing # SMS testing for Playwright Learn how to test every element of your SMS communication within Playwright. ## What you'll find in this guide - How to test differing aspects of SMS - Testing links and codes - Managing SMS tests ## What you'll need - Knowledge of how Playwright works. - A Mailosaur account with the SMS feature. [Start a free trial](/app/signup) if you don't already have one. - A Playwright project [with Mailosaur's API client configured](/docs/automation/playwright/quickstart). ## Basic usage To use Playwright and Mailosaur for SMS testing, you need to: 1. Send an SMS to your dedicated Mailosaur phone number. 2. Connect to the Mailosaur API with the official client library. 3. Search for the message sent earlier. 4. Perform assertions in the same way you would for any other test. To learn about Server IDs, and what to replace SERVER_ID with, [see sending test emails to Mailosaur](/docs/email-testing/sending-to-mailosaur). ```js // Setup the API client const mailosaur = new MailosaurClient("API_KEY"); // Search for the message const message = await mailosaur.messages.get("SERVER_ID", { sentTo: "123456789", // Phone number }); // Perform test assertions expect(message.from[0].name).toEqual("Support"); expect(message.from[0].phone).toEqual("654321"); ``` This will search for the phone number a message was sent to, but you can also use any of the below criteria: | **Parameter** | **Description** | | ------------- | ------------------------------------------------------------ | | sentTo | The full phone number to which the target message was sent | | sentFrom | The full phone number from which the target message was sent | | body | Finds messages where the message body contains this text | ## Find an SMS message Find a specific message within your inbox. It's always better to use `messages.get()`, as it will automatically wait for messages to arrive, and return the full message. ```js const message = await mailosaur.messages.get("SERVER_ID", { sentTo: "123456789", }); console.log(message.text.body); ``` ### Time range for searching By default searches only look for messages received in the last hour. If you want to look further back than this, just set the 'received after' parameter. ```js // Calculate a datetime for yesterday const yesterday = new Date(Date.now() - 24 * 60 * 60 * 1000); // Use this timestamp in the search const message = await mailosaur.messages.get("SERVER_ID", { sentTo: "123456789", }, { receivedAfter: yesterday }); ``` ### "No matching messages" troubleshooting If you see the error "No matching messages found in time" when searching for messages: - Ensure that the target email or SMS message is visible in the Mailosaur Dashboard, as it may not have arrived at all. - Check when the message arrived. By default, searches only include messages received within the last hour. See "time range for searching" above on how to override this. - Check you have correctly set the **sent to** parameter in your search criteria. ## Other ways to fetch SMS messages > [!WARNING] > > #### It is usually better to use `messages.get()` > > `list` and `search` methods only return basic summaries. To get the full data, such as the message body, you need to use [`.getById()`](#6-messagesgetbyidid). It's generally easier to use [`messages.get()`](#2-messagesgetserver-criteria-options) as this automatically waits for a matching result and returns full data. ### Search for multiple messages Spot multiple messages that meet the same criteria. ```js // Search for all messages sent to 123456789. // Limit results to the first 10 matches only. const result = await mailosaur.messages.search( "SERVER_ID", { sentTo: "123456789", }, { page: 0, itemsPerPage: 10, } ); // Get the most recent message (the first one in the list) const latestMessage = result.items[0]; // Get the full message object const message = await mailosaur.messages.getById(latestMessage.id); console.log(message.text.body); ``` ### List current inbox contents See a full list of everything currently in your inbox. ```js // List the most recent messages const result = await mailosaur.messages.list("SERVER_ID"); // Get the most recent message (the first one in the list) const latestMessage = result.items[0]; // Get the full message object const message = await mailosaur.messages.getById(latestMessage.id); console.log(message.text.body); ``` ## Common test scenarios ### Testing basic properties Once an SMS has been retrieved, test the properties of that text: ```js // Test sender information expect(message.from[0].name).toEqual("Support"); expect(message.from[0].phone).toEqual("654321"); // Test recipient information expect(message.to[0].name).toEqual("John Smith"); expect(message.to[0].phone).toEqual("1234567890"); ``` ### Testing SMS contents SMS message content is available via the `text.body` property: ```js console.log(message.text.body); // "Hi Jason, ..." ``` ### Testing links Any links in the content of your SMS are automatically available via the `text.links` array: ```js // How many links? console.log(message.text.links.length); // 2 const firstLink = message.text.links[0]; expect(firstLink.text).toEqual("Google Search"); expect(firstLink.href).toEqual("https://www.google.com/"); ``` ### Testing verification codes Codes are automatically extracted from the content of your SMS message. They are available via the `text.codes` array: ```js const otp = message.text.codes[0]; expect(otp.value).toEqual("456812"); ``` ### Replying to an SMS message If you have a product that handles SMS replies, you can use our reply feature to simulate this. When you reply, the SMS is sent back to the phone number it was originally sent from: ```js await mailosaur.messages.reply("MESSAGE_ID", { text: "FYI", }); ``` | Parameter | Description | | ----------- | ------------------------------------------------------ | | text | Any additional text content to include in the reply | | html | Any additional HTML content to include in the reply | | subject | Optionally override the default subject line | | attachments | Optional attachments (see 'include attachments' above) | ### Forwarding a message to email You can forward messages from your Mailosaur account to external email addresses via the creation of automated forwarding rules, or one at a time. Before you can forward messages, **you must set up a [verified external email address](/docs/managing-your-account/external-email-addresses)**, so you can send email to it: ```js await mailosaur.messages.forward("MESSAGE_ID", { to: "verified-address@example.com", text: "FYI", }); ``` | Parameter | Description | | --------- | ------------------------------------------------------------------------------------- | | to | The email address to which the message will be sent. Must be a verified email address | | text | Any additional text content to forward the message with | | html | Any additional HTML content to forward the message with | | subject | Optionally override the default subject line | ## Deleting messages ### Deleting an individual message Permanently deletes a single message. Also deletes any attachments related to the message. This operation cannot be undone: ```node await mailosaurClient.messages.del("MESSAGE_ID"); ``` ```java mailosaurClient.messages().delete("MESSAGE_ID"); ``` ```ruby mailosaurClient.messages.delete("MESSAGE_ID") ``` ```py mailosaurClient.messages.delete("MESSAGE_ID") ``` ```dotnet mailosaurClient.Messages.Delete("MESSAGE_ID"); ``` --- Source: https://mailosaur.com/docs/automation/postman # How to test email and SMS with Postman This article teaches you how to test email and SMS messages using Postman with the Mailosaur API. ## Before you begin If you don’t already have one, [create a Mailosaur account](/app/signup). Make sure you know [how to send email to Mailosaur](/docs/email-testing/sending-to-mailosaur) first. Once you have this working, you’re ready to start testing! ## 1. Create an API key Account-level API keys allow you to access all the functions described in the [API reference](/docs/api), and have access to all the inboxes in your account. To create an account-level API key, you must be an Administrator or Account Owner on the account in question. 1. Go to the **Settings** page in the Mailosaur Dashboard. 2. Go to the **API Keys** page. 3. Click the **Create a Key** button. 4. In the dialog that appears, enter a name for your key. 5. When you are finished, click **Create**. For more information, see our guide on [managing API keys](/docs/managing-your-account/api-keys). ## 2. Fork the Mailosaur Postman Collection Mailosaur has a public Postman Collection, which you can access by clicking the button below: ![Postman](https://app.getpostman.com/run-collection/6961255-6cc72dff-f576-451a-9023-b82dec84f95d?action=collection%2Ffork&collection-url=entityId%3D6961255-6cc72dff-f576-451a-9023-b82dec84f95d%26entityType%3Dcollection%26workspaceId%3D386a4af1-4293-4197-8f40-0eb49f831325) Once you have the collection loaded, simply enter your API key from step 1 above into the **Authorization** tab, by ensuring the **Basic Auth** type is selected, with your API key entered as the **Username**. Once this is done, you’re ready to start calling the endpoints in the collection! ## How to await a message using Postman It can sometimes take a few seconds for a new email or SMS message to arrive in your inbox. This is why our official API clients automatically wait for new matches. Using the steps below, you can configure your Postman tests to 'poll' until a new message arrives or a timeout is reached. Assuming you're running your tests as part of a Postman collection, you can do the following: 1. Add a single request to your collection that calls the [search endpoint](/docs/api#4-search-for-messages). 2. Edit the 'Tests' tab for that request, and add the code shown below. This code checks the API response and calls the endpoint again if no matches are found. 3. Once you've saved this, you can then go to your Postman collection and run it. **Important:** Remember that the 'search' endpoint only returns a message summary and does not include the body content of each message. To get this, you just need to follow this up with a call to the [retrieve message endpoint](/docs/api#0-retrieve-a-message) using the message ID from the search response. ```js if (!pm.environment.has("maxWait")) { pm.environment.set("maxWait", 0); } const timeout = 10; // Max seconds to wait for const maxWait = parseInt(pm.environment.get("maxWait"), 10); const response = pm.response.json(); const messages = response?.items; if ((messages && messages.length > 0) || maxWait >= timeout) { pm.test("match should have expected subject", function () { pm.expect(messages[0].subject).to.eq("My expected email subject"); }); } else { // Wait 1 second to avoid rate limiting setTimeout(() => {}, 1000); pm.environment.set("maxWait", maxWait + 1); postman.setNextRequest(request.name); } ``` --- Source: https://mailosaur.com/docs/automation/powershell # How to test email and SMS with PowerShell Learn how to test email and SMS messages in PowerShell, using Mailosaur. ## What is PowerShell? PowerShell is a cross-platform task automation solution from Microsoft, made up of a command-line shell, a scripting language, and a configuration management framework. PowerShell runs on Windows, Linux, and macOS. It can be used for any kind of QA test automation. As you are reading an article about testing email and SMS in PowerShell, you probably already know how to use it, however, if you are new to PowerShell, we would recommend reading the [official product documentation for PowerShell](https://learn.microsoft.com/en-us/powershell/?view=powershell-7.1) to get started. ## What is Mailosaur? Mailosaur is a service that allows you to capture and test email and SMS messages. This is crucial for products and websites that send out emails (such as password resets, account setup, marketing emails, etc.) or SMS messages (such as multi-factor authentication, verification, etc.). With Mailosaur, you get an unlimited supply of test email addresses, plus virtual SMTP servers, test SMS numbers to work with, and more - all accessible within your PowerShell scripts. ## Get Started ### Install and load the Mailosaur NuGet package Install the latest version of the Mailosaur package from nuget: ```powershell install-package Mailosaur -source https://www.nuget.org/api/v2 ``` Next, load the assembly into PowerShell: ```powershell $pkgZip = [System.IO.Compression.ZipFile]::Open((Get-Package Mailosaur).Source,"Read") $pkgStream = [System.IO.MemoryStream]::new() $pkgReader = [System.IO.StreamReader]($pkgZip.entries[2]).Open() $pkgReader.BaseStream.CopyTo($pkgStream) [byte[]]$pkgBytes = $pkgStream.ToArray() $pkgReader.Close() $pkgZip.dispose() [System.Reflection.Assembly]::Load($pkgBytes) ``` ### Instantiate the Mailosaur client You are now ready to start using the package. The value for `YOUR_API_KEY` is covered in the next step ([creating an account](#2-1-create-an-account)): ```powershell $mailosaur = [Mailosaur.MailosaurClient]::new("YOUR_API_KEY") ``` ### API Reference The .NET library is powered by the Mailosaur [Email & SMS Testing API](/docs/api). You can easily check out the API itself by looking at our [API reference documentation](/docs/api) or via our Postman or Insomnia collections: ![Postman](https://app.getpostman.com/run-collection/6961255-6cc72dff-f576-451a-9023-b82dec84f95d?action=collection%2Ffork&collection-url=entityId%3D6961255-6cc72dff-f576-451a-9023-b82dec84f95d%26entityType%3Dcollection%26workspaceId%3D386a4af1-4293-4197-8f40-0eb49f831325) ![Insomnia](https://insomnia.rest/run/?label=Mailosaur&uri=https%3A%2F%2Fmailosaur.com%2Finsomnia.json) ## 1. Create an account Create a [free trial account](/app/signup) for Mailosaur, via the website. Once you have this, open your inbox from the **Inboxes** section of the left-hand navigation, then click the **Settings** tab. You need the following values: - **Inbox ID** - Every [inbox](/docs/inboxes) has a unique ID. You need this ID whenever you interact with an inbox via the API. - **Inbox Domain** - Every inbox has its own domain name. You'll need this to send email to your inbox. - **API Key** - Get one from the [API Keys](/app/keys) page. You can create an API key per inbox (recommended), or an account-level API key to use across your whole account. [Learn more about API keys](/docs/managing-your-account/api-keys). ## 2. Test email addresses with Mailosaur Mailosaur gives you an **unlimited number of test email addresses** - with no setup or code required! Here’s how it works: - When you create an account, you are given an inbox. - Every inbox has its own **Inbox Domain** name (e.g. `abc123.mailosaur.net`) - Any email address that ends with `@{YOUR_SERVER_DOMAIN}` will work with Mailosaur without any special setup. For example: - `build-423@abc123.mailosaur.net` - `john.smith@abc123.mailosaur.net` - `rAnDoM63423@abc123.mailosaur.net` - You can create more inboxes when you need them. Each one will have its own domain name. _**Can’t use test email addresses?** You can also [use SMTP to test email](/docs/email-testing/sending-to-mailosaur#0-sending-directly-via-smtp). By connecting your product or website to Mailosaur via SMTP, Mailosaur will catch all email your application sends, regardless of the email address._ ## 3. Find an email Now that you have a sample project, your inbox’s credentials, and an email to test, then you’re ready to continue. Open a file in your new project called `script.ps1` and type or paste in this code sample, replacing the template code with the values from step 1 above: ```powershell # Find these on the API Keys page and your inbox's Settings tab $apiKey = "YOUR_API_KEY" $serverId = "SERVER_ID" $serverDomain = "SERVER_DOMAIN" $mailosaur = [Mailosaur.MailosaurClient]::new($apiKey) # Wait for an email to arrive, matching this search criteria $criteria = [Mailosaur.Models.SearchCriteria]::new() $criteria.SentTo = "anything@" + $serverDomain $message = $mailosaur.Messages.Get($serverId, $criteria); ``` ## Find an SMS message **Important:** Trial accounts do not automatically have SMS access. Please contact our support team to enable a trial of SMS functionality. If your account has [SMS Testing](/docs/sms-testing) enabled, you can reserve phone numbers to test with, then use the Mailosaur API in a very similar way to when testing email: ```powershell # ... $criteria = [Mailosaur.Models.SearchCriteria]::new() $criteria.SentTo = "4471235554444" $mailosaur.Messages.Get($serverId, $criteria); ``` ## Testing plain text content Most emails, and all SMS messages, should have a plain text body. Mailosaur exposes this content via the `Text.Body` property on an email or SMS message: ```powershell $message.Text.Body # "Hello world." ``` ## Testing HTML content Most emails also have an HTML body, as well as the plain text content. You can access HTML content in a very similar way to plain text: ```powershell $message.Html.Body # "`) and area (``) elements and makes these available via the `Html.Links` array. Each link has a text property, representing the display text of the hyperlink within the body, and an href property containing the target URL: ```powershell $message.Html.Links.Count # 2 # Accessing the HTML link content $firstLink = $message.Html.Links[0] $firstLink.Text # "Google Search" $firstLink.Href # "https://www.google.com/" ``` **Important:** To ensure you always have valid emails, Mailosaur only extracts links that have been correctly marked up with `
` or `` tags. ### Links in plain text (including SMS messages) Mailosaur auto-detects links in plain text content too, which is especially useful for SMS testing: ```powershell $message.Text.Links.Count # 1 # Accessing the HTML link content $firstLink = $message.Text.Links[0] $firstLink.Href # "https://www.google.com/" ``` ## Working with attachments If your email includes attachments, you can access these via the `Attachments` property: ```powershell # How many attachments? $message.Attachments # 2 ``` Each attachment contains metadata on the file name and content type: ```powershell $firstAttachment = $message.Attachments[0] $firstAttachment.FileName # "contract.pdf" $firstAttachment.ContentType # "application/pdf" ``` The `Length` property returns the size of the attached file (in bytes): ```powershell $firstAttachment = $message.Attachments[0] $firstAttachment.Length # 4028 ``` ## Working with images and web beacons The `Html.Images` property of a message contains an array of images found within the HTML content of an email. The length of this array corresponds to the number of images found within an email: ```powershell # How many images in the email? $message.Html.Images.Count # 1 ``` ### Remotely-hosted images Emails will often contain many images that are hosted elsewhere, such as on your website or product. It is recommended to check that these images are accessible by your recipients. All images should have an alternative text description, which can be checked using the Alt attribute. ```powershell $image = $message.Html.Images[0] $image.Alt # "Hot air balloon" ``` ### Triggering web beacons A web beacon is a small image that can be used to track whether an email has been opened by a recipient. Because a web beacon is simply another form of remotely-hosted image, you can use the `Src` attribute to make an HTTP request to that address using `Invoke-WebRequest`: ```powershell $image = $message.Html.Images[0] $image.Src # "https://example.com/s.png?abc123" # Make an HTTP call to trigger the web beacon Invoke-WebRequest -URI $image.Src ``` ## Spam checking You can perform a [SpamAssassin](https://spamassassin.apache.org) check against an email. The structure returned matches the [spam test object](/docs/api#0-perform-a-spam-test): ```powershell $result = $mailosaur.Analysis.Spam($message.Id) $result.Score # 0.5 foreach($r in $result.SpamFilterResults.SpamAssassin) { $r.Rule $r.Description $r.Score } ``` --- Source: https://mailosaur.com/docs/automation/python # How to test email and SMS in Python Learn how to automate testing of email and SMS messages in Python, using Mailosaur. ## 1. Create a Mailosaur account If you already have an account, skip to step 2. To create a new trial account, [sign up here](/app/signup). ## 2. Create a sample project ### Install Python To see if you already have Python installed, open a terminal window and run this command: ```bash python --version ``` If Python is installed, you’ll see a version number. If you see an error instead, then [download Python](https://www.python.org/downloads) and install it. ### Create a new project Run each of these commands to create a new folder for your Python project: ```bash mkdir EmailTests cd EmailTests ``` ### Install the Mailosaur Python library Run this command to install the [Mailosaur Python package](https://github.com/mailosaur/mailosaur-python): ```bash pip install mailosaur ``` ## 3. Send email to your Mailosaur inbox Inboxes allow you to group tests, permissions, and other settings together. Each inbox has an **Inbox ID** and a **domain name**. You need these values to both send email to Mailosaur, and to set up automated testing. You also need an [API key](/docs/managing-your-account/api-keys) to use. You can learn more about [creating API keys here](/docs/managing-your-account/api-keys). ### Retrieve your inbox’s attributes 1. In the left-hand navigation, locate the **Inboxes** section. 2. Click on the name of the inbox you want to test with. 3. Click the **Settings** tab. 4. Make a note of the **Inbox ID** and **Domain**. 5. Get an API key from the [API Keys](/app/keys) page. ### Send an email to your inbox If the **domain name** of your inbox above was: ```bash example.mailosaur.net ``` Then you can send an email to it with these steps: 1. Open up an email client and send an email to `anything@example.mailosaur.net` 2. In the left-hand navigation, locate the **Inboxes** section. 3. Click on the name of the inbox you sent an email to. 4. Confirm the email is there. Note that some services (like Gmail) may take 10-20 seconds to send a message through. To learn more, read our guide on [sending email to Mailosaur](/docs/email-testing/sending-to-mailosaur). ## 4. Find an email for automated testing Now that you have a sample project, your inbox’s credentials, and an email to test, then you’re ready to continue. Create a file named `hello.py` and type or paste in this code sample, replacing the template code with the values from step 3 above: ```python from mailosaur import MailosaurClient from mailosaur.models import SearchCriteria # Find these on the API Keys page and your inbox's Settings tab api_key = "YOUR_API_KEY" server_id = "SERVER_ID" server_domain = "SERVER_DOMAIN" mailosaur = MailosaurClient(api_key) criteria = SearchCriteria() criteria.sent_to = "anything@" + server_domain email = mailosaur.messages.get(server_id, criteria) print("Subject: " + email.subject) ``` This code connects to Mailosaur and looks for any email that has been sent to the address provided in the search criteria. Save your changes and run the code: ```bash python hello.py ``` If everything is set up correctly, you should see the subject line of the last email you sent, printed to screen: ```bash Subject: My example email ``` ### Troubleshooting If you see an error, e.g. ‘No matching messages found in time’: - Make sure you have set the **sent to** address correctly in your code. - Ensure that you have sent an email to the **sent to** address (check this is visible in the Mailosaur Dashboard). - Note that by default, the **get** method will only look for messages that were received by Mailosaur within the last hour. You can override this using the `received_after` option (see library reference below). ## 5. Narrowing your search results ### Only find messages received after a certain time By default, searches include messages received in the last hour, but you can customise the search window with the `received_after` option. This example shows you how to only include emails received after your test started: ```python test_start = datetime.today() - timedelta(minutes=1) # Perform the steps that send a message here criteria = SearchCriteria() criteria.sent_to = "..." message = mailosaur.messages.get("SERVER_ID", criteria, received_after=test_start) ``` ### Search criteria As you can see in the examples so far, you can search for the email address or phone number a message was sent to, but you can also search using these criteria: | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **sent_from** | The full email address from which the target message was sent. | | **sent_to** | The full email address to which the target message was sent. | | **subject** | Find emails where the subject line contains this text. | | **body** | Finds messages where the message body contains this text. | ## 6. Start writing tests Now that you have a working project that fetches an email, you can use this to begin writing tests for various pieces of functionality. Check out these guides on the most common test cases: > [!LINK](/docs/automation/text-content) > ### How to test the text content of email or SMS > Learn how to test the text content of email or SMS with Mailosaur. > [!LINK](/docs/automation/html-content) > ### HTML content of an email > Learn how to work with the HTML content found within your emails. > [!LINK](/docs/automation/codes) > ### Extracting codes from email and SMS > Learn how to test verification codes found in email and SMS messages with Mailosaur. > [!LINK](/docs/automation/links) > ### Extracting links from email and SMS > Learn how to test hyperlinks found in email and SMS messages with Mailosaur. > [!LINK](/docs/automation/attachments) > ### Email attachments > Learn how to test the email attachments with Mailosaur. > [!LINK](/docs/automation/images) > ### Images and web beacons > Learn how to work with images, including web beacons, within an HTML email. > [!LINK](/docs/automation/message-properties) > ### Message properties > Learn how to test the common properties of an email or SMS message with Mailosaur. > [!LINK](/docs/automation/spam) > ### How to test email spam score > Learn how to test the SpamAssassin score of an email with Mailosaur. ## SMS Testing You can test SMS messages in much the same way as email. Take a look at our [guide on testing SMS messages](/docs/sms-testing) for more information. ## Library reference The Python client library gives you access to several other methods. ### Messages Messages is the collective name given to the email and/or SMS messages that are sent into Mailosaur for testing. The [message object](/docs/api) contains everything you need to perform in-depth automated testing. #### messages.get(server, criteria, options) Waits for a message to be found. Returns as soon as a message matching the specified search criteria is found. **Recommended:** This is the most efficient method of looking up a message, therefore we recommend using it wherever possible. ```python criteria = SearchCriteria() criteria.sent_to = "someone@SERVER_ID.mailosaur.net" message = mailosaur.messages.get("SERVER_ID", criteria) ``` To learn about inbox IDs, and what to replace `SERVER_ID` with, see [sending email to Mailosaur](/docs/email-testing/sending-to-mailosaur). ##### Criteria | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **sent_from** | The full email address from which the target message was sent. | | **sent_to** | The full email address to which the target message was sent. | | **subject** | The subject line of the target email. | | **body** | Search for part of the message body. | | **match** | If set to `ALL` (default), then only results that match all specified criteria will be returned. If set to `ANY`, results that match any of the specified criteria will be returned. | ##### Options | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **timeout** | Specify how long to wait for a matching result (in milliseconds, _default value is 10 seconds_). | | **received_after** | Limits results to only messages received after this date/time (_default 1 hour ago_). | ```python from datetime import datetime, timedelta # ... criteria = SearchCriteria() criteria.sent_to = "someone@SERVER_ID.mailosaur.net" ten_minutes_ago = datetime.today() - timedelta(minutes=10) # Search all messages received in the last 10 minutes mailosaur.messages.get("SERVER_ID", criteria, received_after=ten_minutes_ago) ``` #### messages.list(server, options) Returns a list of your messages in summary form. The summaries are returned sorted by received date, with the most recently-received messages appearing first. > [!SUCCESS] > The method returns a message summary, rather than the full message object. This means that several properties, like the message body, are not included. To get this data, you’ll need to call [`get_by_id`](#messagesget_by_idid). Alternatively, we recommend using the [`get`](#messagesgetserver-criteria-options) method, which is a far more efficient approach. ```python # List the most recent messages result = mailosaur.messages.list('SERVER_ID') # Get the most recent message (the first one in the list) message = result.items[0] print('Subject: ' + message.subject) ``` ##### Options - **received_after** Allows you to customise how far back to look for messages. - **page** Used alongside `items_per_page` to paginate through results. This is zero-based, meaning `0` is the first page of results. - **items_per_page** A limit on the number of results to be returned. This can be set between 1 to 1000, with the default being 50. ```python from datetime import datetime, timedelta # ... ten_minutes_ago = datetime.today() - timedelta(minutes=10) # List all results received in the last 10 minutes result = mailosaur.messages.list('SERVER_ID', page=0, items_per_page=10, received_after=ten_minutes_ago) ``` #### messages.search(server, criteria, options) Returns a list of messages matching the specified search criteria, in summary form. The messages are returned sorted by received date, with the most recently-received messages appearing first. > [!SUCCESS] > The method returns a message summary, rather than the full message object. This means that several properties, like the message body, are not included. To get this data, you’ll need to call [`get_by_id`](#messagesget_by_idid). Alternatively, we recommend using the [`get`](#messagesgetserver-criteria-options) method, which is a far more efficient approach. ```python from mailosaur.models import SearchCriteria # ... criteria = SearchCriteria() criteria.sent_to = "someone@SERVER_ID.mailosaur.net" result = mailosaur.messages.search('SERVER_ID', criteria) # Get the most recent match message = result.items[0] print('Subject: ' + message.subject) ``` ##### Criteria | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **sent_from** | The full email address from which the target message was sent. | | **sent_to** | The full email address to which the target message was sent. | | **subject** | The subject line of the target email. | | **body** | Search for part of the message body. | | **match** | If set to `ALL` (default), then only results that match all specified criteria will be returned. If set to `ANY`, results that match any of the specified criteria will be returned. | ##### Options | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **timeout** | If provided, determines how long to wait for a matching result (provided in milliseconds). | | **error_on_timeout** | When set to `False`, an error will not be thrown if timeout is reached (default: `True`). | | **received_after** | Allows you to customise how far back to look for messages. | | **page** | Used alongside `items_per_page` to paginate through results. This is zero-based, meaning `0` is the first page of results. | | **items_per_page** | A limit on the number of results to be returned. This can be set between 1 to 1000, with the default being 50. | ```python from mailosaur.models import SearchCriteria # ... criteria = SearchCriteria() criteria.sent_to = "someone@SERVER_ID.mailosaur.net" # Search for all messages sent to someone@SERVER_ID.mailosaur.net, # received in the last 2 hours. Limit results to the first 10 matches only. two_hours_ago=datetime.today() - timedelta(hours=2) result = mailosaur.messages.search('SERVER_ID', criteria, page=0, items_per_page=10, received_after=two_hours_ago) ``` #### messages.get_by_id(id) Retrieves the detail for a single email message. Must be used in conjunction with either [`list`](#messageslistserver-options) or [`search`](#messagessearchserver-criteria-options) in order to get the unique identifier for the required message. **We always recommend using the** [`get`](#messagesgetserver-criteria-options) **method instead**. ```python result = mailosaur.messages.list("SERVER_ID") message_id = result.items[0].id message = mailosaur.messages.get_by_id(message_id) print('Subject: ' + message.subject) ``` #### messages.delete(id) Permanently deletes a message. Also deletes any attachments related to the message. This operation cannot be undone. ```python mailosaur.messages.delete(message_id) ``` #### messages.delete_all(server) Permanently deletes all messages held in the specified inbox. Also deletes any attachments related to each message. This operation cannot be undone. ```python mailosaur.messages.delete_all("SERVER_ID") ``` #### messages.create(server, options) Creates a new message that can be sent to a verified email address. This is useful in scenarios where you want an email to trigger a workflow in your product. ```python from mailosaur.models import MessageCreateOptions # ... options = MessageCreateOptions() options.to = "verified-address@example.com" options.send = True options.subject = "Request" options.text = "Please can you give us a call back?" mailosaur.messages.create("SERVER_ID", options) ``` ##### Options - **to** The email address to which the email will be sent. Must be a verified email address. - **send** If true, email will be sent upon creation. - **subject** The email subject line. - **text** The plain text body of the email. - **html** The HTML body of the email. #### messages.forward(messageId, options) Forwards the specified email to a verified email address. ```python from mailosaur.models import MessageForwardOptions # ... options = MessageForwardOptions() options.to = "verified-address@example.com" options.text = "FYI" mailosaur.messages.forward("MESSAGE_ID", options) ``` ##### Options - **to** The email address to which the email will be sent. Must be a verified email address. - **text** Any additional plain text content to forward the email with. - **html** Any additional HTML content to forward the email with. #### messages.reply(messageId, options) Sends a reply to the specified email. This is useful for when simulating a user replying to one of your emails. ```python from mailosaur.models import MessageReplyOptions # ... options = MessageReplyOptions() options.text = "FYI" mailosaur.messages.reply("MESSAGE_ID", options) ``` ##### Options - **text** Any additional plain text content to include in the reply. - **html** Any additional HTML content to include in the reply. ### Servers Inboxes capture emails and SMS messages, group your tests and settings, and manage access for your team. #### servers.list() Returns a list of your inboxes. Inboxes are returned sorted in alphabetical order. ```python result = mailosaur.servers.list() print('You have an inbox called: ' + result.items[0]["name"]) ``` #### servers.create(server) Creates a new inbox. Only the `name` property is required to create a new inbox via the API. ```python from mailosaur.models import ServerCreateOptions # ... options = ServerCreateOptions("My email tests") mailosaur.servers.create(options) ``` #### servers.get(id) Retrieves the detail for a single inbox. Simply supply the unique identifier for the required inbox. ```python server = mailosaur.servers.get("SERVER_ID") ``` #### servers.get_password(id) Retrieves the password, for use with SMTP and POP3, for a single inbox. Simply supply the unique identifier for the required inbox. ```python password = mailosaur.servers.get_password("SERVER_ID") ``` #### servers.update(id, server) Updates a single inbox. ```python retrieved_server = mailosaur.servers.get("SERVER_ID") retrieved_server.name = "Updated inbox name" mailosaur.servers.update(retrieved_server.id, retrieved_server) ``` #### servers.delete(id) Permanently deletes an inbox. Also deletes all messages and associated attachments within the inbox. This operation cannot be undone. ```python mailosaur.servers.delete("SERVER_ID") ``` #### servers.generate_email_address(id) Utility method to help you generate a random email address for a given inbox. ```python email_address = mailosaur.servers.generate_email_address("SERVER_ID") print(email_address) # "bgwqj@SERVER_ID.mailosaur.net" ``` To learn about inbox IDs, and what to replace `SERVER_ID` with, see [sending email to Mailosaur](/docs/email-testing/sending-to-mailosaur). ### Files #### files.get_email(message_id) Downloads an EML file representing the specified email. Simply supply the unique identifier for the required email. #### files.get_attachment(attachment_id) Downloads a single attachment. Simply supply the unique identifier for the required attachment. ### Analysis #### analysis.spam(message_id) Perform spam testing on the specified email. ### Usage #### usage.limits() Retrieve account usage limits. Details the current limits and usage for your account. This endpoint requires authentication with an account-level API key. #### usage.transactions() Retrieves the last 31 days of transactional usage. This endpoint requires authentication with an account-level API key. --- Source: https://mailosaur.com/docs/automation/robot-framework # How to test email and SMS with Robot Framework Learn how to test email and SMS messages in Robot Framework, using Mailosaur. ## What is Robot Framework? Robot Framework is a Python-based open source automation framework. It can be used for any kind of QA test automation. Robot Framework is in active use by many industry-leading companies as part of their software development lifecycle. As you are reading an article about testing email and SMS in Robot Framework, you probably already know how to use Robot Framework, however, if you are new to it, we would recommend reading the [Robot Framework website and documentation](https://robotframework.org) to get started. ## What is Mailosaur? Mailosaur is a service that allows you to capture and test email and SMS messages. This is crucial for products and websites that send out emails (such as password resets, account setup, marketing emails, etc.) or SMS messages (such as multi-factor authentication, verification, etc.). With Mailosaur, you get an unlimited supply of test email addresses, plus virtual SMTP servers, test SMS numbers to work with, and more - all accessible within your Robot Framework test suite. ## 1. Install the Mailosaur Python library As Robot Framework is Python-based, you can use our [official Python library](https://github.com/mailosaur/mailosaur-python) to quickly start testing email and SMS messages. ### Installation Install the Mailosaur Python library with pip: ```bash pip install --upgrade mailosaur ``` Create a Python file to contain the code you want to expose to Robot Framework, then import the library into it. The value for `YOUR_API_KEY` is covered in the next step ([creating an account](#2-2-create-an-account)): ```python from mailosaur import MailosaurClient mailosaur = MailosaurClient("YOUR_API_KEY") ``` ### API Reference This library is powered by the [Mailosaur API](/docs/api). You can easily check out the API itself by looking at our [API reference documentation](/docs/api) or via our Postman or Insomnia collections: ![Postman](https://app.getpostman.com/run-collection/6961255-6cc72dff-f576-451a-9023-b82dec84f95d?action=collection%2Ffork&collection-url=entityId%3D6961255-6cc72dff-f576-451a-9023-b82dec84f95d%26entityType%3Dcollection%26workspaceId%3D386a4af1-4293-4197-8f40-0eb49f831325) ![Insomnia](https://insomnia.rest/run/?label=Mailosaur&uri=https%3A%2F%2Fmailosaur.com%2Finsomnia.json) ## 2. Create an account Create a [free trial account](/app/signup) for Mailosaur, via the website. Once you have this, open your inbox from the **Inboxes** section of the left-hand navigation, then click the **Settings** tab. You need the following values: - **Inbox ID** - Every [inbox](/docs/inboxes) has a unique ID. You need this ID whenever you interact with an inbox via the API. - **Inbox Domain** - Every inbox has its own domain name. You'll need this to send email to your inbox. - **API Key** - Get one from the [API Keys](/app/keys) page. You can create an API key per inbox (recommended), or an account-level API key to use across your whole account. [Learn more about API keys](/docs/managing-your-account/api-keys). ## 3. Test email addresses with Mailosaur Mailosaur gives you an **unlimited number of test email addresses** - with no setup or code required! Here’s how it works: - When you create an account, you are given an inbox. - Every inbox has its own **Inbox Domain** name (e.g. `abc123.mailosaur.net`) - Any email address that ends with `@{YOUR_SERVER_DOMAIN}` will work with Mailosaur without any special setup. For example: - `build-423@abc123.mailosaur.net` - `john.smith@abc123.mailosaur.net` - `rAnDoM63423@abc123.mailosaur.net` - You can create more inboxes when you need them. Each one will have its own domain name. _**Can’t use test email addresses?** You can also [use SMTP to test email](/docs/email-testing/sending-to-mailosaur#0-sending-directly-via-smtp). By connecting your product or website to Mailosaur via SMTP, Mailosaur will catch all email your application sends, regardless of the email address._ ## 4. Find an email ### Create a helper class First, we need to create a helper class, which we’ll name `Mailosaur.py`. This file will let you write helper methods that expose the functionality of the Mailosaur Python library as keywords within your [Robot Framework](https://robotframework.org) tests: ```python from mailosaur import MailosaurClient from mailosaur.models import SearchCriteria class Mailosaur(object): def __init__(self): self.client = MailosaurClient("YOUR_API_KEY") def find_email(self, server_id, email_address): criteria = SearchCriteria() criteria.sent_to = email_address return self.client.messages.get(server_id, criteria) def subject_should_equal(self, message, expected): assert(message.subject == expected) ``` ### Use the helper class in a Robot Framework test spec Now we can use the helper methods we created above, in our Robot Framework tests. Simply include `Mailosaur.py` as a Library: ```text *** Settings *** Library SeleniumLibrary Library Mailosaur.py *** Variables *** ${URL} https://example.mailosaur.com/password-reset ${SERVER_ID} abc123 # From your inbox's Settings tab ${SERVER_DOMAIN} abc123.mailosaur.net # From your inbox's Settings tab *** Test Cases *** Test Password Reset Request Password Reset *** Keywords *** Request Password Reset ${TEST_EMAIL_ADDRESS}= some-random-string@${SERVER_DOMAIN} Open Browser ${URL} Input Text name:email ${TEST_EMAIL_ADDRESS} Click Button css:button[type="submit"] ${MESSAGE}= Mailosaur.find_email ${SERVER_ID} ${TEST_EMAIL_ADDRESS} Mailosaur.subject_should_equal ${MESSAGE} Thanks for joining! [Teardown] Close Browser ``` ## Find an SMS message **Important:** Trial accounts do not automatically have SMS access. Please contact our support team to enable a trial of SMS functionality. If your account has [SMS Testing](/docs/sms-testing) enabled, you can reserve phone numbers to test with, then use the Mailosaur API in a very similar way to when testing email: ```python # ... criteria = SearchCriteria() criteria.sent_to = "4471235554444" return self.client.messages.get(server_id, criteria) ``` ## Testing plain text content Most emails, and all SMS messages, should have a plain text body. Mailosaur exposes this content via the `text.body` property on an email or SMS message: ```python def message_text_contains(self, message, expected): assert(expected in message.text.body) ``` ### Extracting verification codes from plain text You may have an email or SMS message that contains an account verification code, or some other one-time passcode. You can extract content like this using a simple regex. Here is how to extract a 6-digit numeric code: ```python print(message.text.body) # "Your access code is 243546." match = re.search("([0-9]{6})", message.text.body) print(match.group()) # "243546" ``` [Read more](/docs/automation/text-content) ## Testing HTML content Most emails also have an HTML body, as well as the plain text content. You can access HTML content in a very similar way to plain text: ```python print(message.html.body) # "`) and area (``) elements and makes these available via the `html.links` array. Each link has a text property, representing the display text of the hyperlink within the body, and an href property containing the target URL: ```python def count_html_links(self, message, expected): # Passes if message has the expected number of links assert(expected in len(message.html.links)) # Accessing the HTML link content first_link = message.html.links[0] print(first_link.text) # "Google Search" print(first_link.href) # "https://www.google.com/" ``` **Important:** To ensure you always have valid emails, Mailosaur only extracts links that have been correctly marked up with `` or `` tags. ### Links in plain text (including SMS messages) Mailosaur auto-detects links in plain text content too, which is especially useful for SMS testing: ```python def count_text_links(self, message, expected): # Passes if message has the expected number of links assert(expected in len(message.text.links)) # Accessing the HTML link content first_link = message.text.links[0] print(first_link.href) # "https://www.google.com/" ``` ## Working with attachments If your email includes attachments, you can access these via the attachments property: ```python # How many attachments? print(len(message.attachments)) # 2 ``` Each attachment contains metadata on the file name and content type: ```python first_attachment = message.attachments[0] print(first_attachment.file_name) # "contract.pdf" print(first_attachment.content_type) # "application/pdf" ``` The `length` property returns the size of the attached file (in bytes): ```python first_attachment = message.attachments[0] print(first_attachment.length) # 4028 ``` ## Working with images and web beacons The `html.images` property of a message contains an array of images found within the HTML content of an email. The length of this array corresponds to the number of images found within an email: ```python # How many images in the email? print(len(message.html.images)) # 1 ``` ### Remotely-hosted images Emails will often contain many images that are hosted elsewhere, such as on your website or product. It is recommended to check that these images are accessible by your recipients. All images should have an alternative text description, which can be checked using the `alt` attribute. ```python image = message.html.images[0] print(image.alt) # "Hot air balloon" ``` ### Triggering web beacons A web beacon is a small image that can be used to track whether an email has been opened by a recipient. Because a web beacon is simply another form of remotely-hosted image, you can use the `src` attribute to navigate to that address with Robot Framework. Alternatively you can use the `requests` library to make a direct HTTP request: ```python import requests # ... const image = message.html.images[0] print(image.src) # "https://example.com/s.png?abc123" # Make an HTTP call to trigger the web beacon response = requests.get(image.src) print(response.status_code) # 200 ``` ## Spam checking You can perform a [SpamAssassin](https://spamassassin.apache.org) check against an email. The structure returned matches the [spam test object](/docs/api#0-perform-a-spam-test): ```python result = mailosaur.analysis.spam(message.id) print(result.score) # 0.5 for r in result.spam_filter_results.spam_assassin: print(r.rule) print(r.description) print(r.score) ``` --- Source: https://mailosaur.com/docs/automation/ruby # How to test email and SMS in Ruby Learn how to automate testing of email and SMS messages in Ruby, using Mailosaur. ## 1. Create a Mailosaur account If you already have an account, skip to step 2. To create a new trial account, [sign up here](/app/signup). ## 2. Create a sample project ### Install Ruby To see if you already have Ruby installed, open a terminal window and run this command: ```bash ruby --version ``` If Ruby is installed, you’ll see a version number. If you see an error instead, then [download Ruby](https://www.ruby-lang.org/en/downloads) and install it. ### Create a new project Run each of these commands to create a new folder for your Ruby project: ```bash mkdir EmailTests cd EmailTests ``` ### Install the Mailosaur Ruby library Run this command to install the [Mailosaur Ruby package](https://github.com/mailosaur/mailosaur-ruby): ```bash gem install mailosaur ``` ## 3. Send email to your Mailosaur inbox Inboxes allow you to group tests, permissions, and other settings together. Each inbox has an **Inbox ID** and a **domain name**. You need these values to both send email to Mailosaur, and to set up automated testing. You also need an [API key](/docs/managing-your-account/api-keys) to use. You can learn more about [creating API keys here](/docs/managing-your-account/api-keys). ### Retrieve your inbox’s attributes 1. In the left-hand navigation, locate the **Inboxes** section. 2. Click on the name of the inbox you want to test with. 3. Click the **Settings** tab. 4. Make a note of the **Inbox ID** and **Domain**. 5. Get an API key from the [API Keys](/app/keys) page. ### Send an email to your inbox If the **domain name** of your inbox above was: ```bash example.mailosaur.net ``` Then you can send an email to it with these steps: 1. Open up an email client and send an email to `anything@example.mailosaur.net` 2. In the left-hand navigation, locate the **Inboxes** section. 3. Click on the name of the inbox you sent an email to. 4. Confirm the email is there. Note that some services (like Gmail) may take 10-20 seconds to send a message through. To learn more, read our guide on [sending email to Mailosaur](/docs/email-testing/sending-to-mailosaur). ## 4. Find an email for automated testing Now that you have a sample project, your inbox’s credentials, and an email to test, then you’re ready to continue. Create a file named `hello.rb` and type or paste in this code sample, replacing the template code with the values from step 3 above: ```ruby require 'mailosaur' # Find these on the API Keys page and your inbox's Settings tab api_key = "YOUR_API_KEY" server_id = "SERVER_ID" server_domain = "SERVER_DOMAIN" mailosaur = Mailosaur::MailosaurClient.new(api_key) criteria = Mailosaur::Models::SearchCriteria.new() criteria.sent_to = "anything@" + server_domain email = mailosaur.messages.get(server_id, criteria) print("Subject: " + email.subject) ``` This code connects to Mailosaur and looks for any email that has been sent to the address provided in the search criteria. Save your changes and run the code: ```bash ruby hello.rb ``` If everything is set up correctly, you should see the subject line of the last email you sent, printed to screen: ```bash Subject: My example email ``` ### Troubleshooting If you see an error, e.g. ‘No matching messages found in time’: - Make sure you have set the **sent to** address correctly in your code. - Ensure that you have sent an email to the **sent to** address (check this is visible in the Mailosaur Dashboard). - Note that by default, the **get** method will only look for messages that were received by Mailosaur within the last hour. You can override this using the `received_after` option (see library reference below). ## 5. Narrowing your search results ### Only find messages received after a certain time By default, searches include messages received in the last hour, but you can customise the search window with the `received_after` option. This example shows you how to only include emails received after your test started: ```ruby test_start = DateTime.now # Perform the steps that send a message here criteria = Mailosaur::Models::SearchCriteria.new() criteria.sent_to = '...' message = mailosaur.messages.get('SERVER_ID', criteria, received_after: test_start) ``` ### Search criteria As you can see in the examples so far, you can search for the email address or phone number a message was sent to, but you can also search using these criteria: | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **sent_from** | The full email address from which the target message was sent. | | **sent_to** | The full email address to which the target message was sent. | | **subject** | Find emails where the subject line contains this text. | | **body** | Finds messages where the message body contains this text. | ## 6. Start writing tests Now that you have a working project that fetches an email, you can use this to begin writing tests for various pieces of functionality. Check out these guides on the most common test cases: > [!LINK](/docs/automation/text-content) > ### How to test the text content of email or SMS > Learn how to test the text content of email or SMS with Mailosaur. > [!LINK](/docs/automation/html-content) > ### HTML content of an email > Learn how to work with the HTML content found within your emails. > [!LINK](/docs/automation/codes) > ### Extracting codes from email and SMS > Learn how to test verification codes found in email and SMS messages with Mailosaur. > [!LINK](/docs/automation/links) > ### Extracting links from email and SMS > Learn how to test hyperlinks found in email and SMS messages with Mailosaur. > [!LINK](/docs/automation/attachments) > ### Email attachments > Learn how to test the email attachments with Mailosaur. > [!LINK](/docs/automation/images) > ### Images and web beacons > Learn how to work with images, including web beacons, within an HTML email. > [!LINK](/docs/automation/message-properties) > ### Message properties > Learn how to test the common properties of an email or SMS message with Mailosaur. > [!LINK](/docs/automation/spam) > ### How to test email spam score > Learn how to test the SpamAssassin score of an email with Mailosaur. ## SMS Testing You can test SMS messages in much the same way as email. Take a look at our [guide on testing SMS messages](/docs/sms-testing) for more information. ## Library reference The Ruby client library gives you access to several other methods. ### Messages Messages is the collective name given to the email and/or SMS messages that are sent into Mailosaur for testing. The [message object](/docs/api) contains everything you need to perform in-depth automated testing. #### messages.get(server, criteria, options) Waits for a message to be found. Returns as soon as a message matching the specified search criteria is found. **Recommended:** This is the most efficient method of looking up a message, therefore we recommend using it whenever possible. ```ruby criteria = Mailosaur::Models::SearchCriteria.new() criteria.sent_to = "someone@SERVER_ID.mailosaur.net" message = mailosaur.messages.get("SERVER_ID", criteria) ``` To learn about inbox IDs, and what to replace `SERVER_ID` with, see [sending email to Mailosaur](/docs/email-testing/sending-to-mailosaur). ##### Criteria | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **sent_from** | The full email address from which the target message was sent. | | **sent_to** | The full email address to which the target message was sent. | | **subject** | The subject line of the target email. | | **body** | Search for part of the message body. | | **match** | If set to `ALL` (default), then only results that match all specified criteria will be returned. If set to `ANY`, results that match any of the specified criteria will be returned. | ##### Options | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **timeout** | Specify how long to wait for a matching result (in milliseconds, _default value is 10 seconds_). | | **received_after** | Limits results to only messages received after this date/time (_default 1 hour ago_). | ```ruby criteria = Mailosaur::Models::SearchCriteria.new() criteria.sent_to = "someone@SERVER_ID.mailosaur.net" ten_minutes_ago = DateTime.now - (10 / 1440.0) # Search all messages received in the last 10 minutes message = mailosaur.messages.get("SERVER_ID", criteria, received_after: ten_minutes_ago) ``` #### messages.list(server, options) Returns a list of your messages in summary form. The summaries are returned sorted by received date, with the most recently-received messages appearing first. > [!SUCCESS] > The method returns a message summary, rather than the full message object. This means that several properties, like the message body, are not included. To get this data, you’ll need to call [`get_by_id`](#messagesget_by_idid). Alternatively, we recommend using the [`get`](#messagesgetserver-criteria-options) method, which is a far more efficient approach. ```ruby # List the most recent messages result = mailosaur.messages.list("SERVER_ID") # Get the most recent message (the first one in the list) message = result.items[0] print('Subject: ' + message.subject) ``` ##### Options - **received_after** Allows you to customise how far back to look for messages. - **page** Used alongside `items_per_page` to paginate through results. This is zero-based, meaning `0` is the first page of results. - **items_per_page** A limit on the number of results to be returned. This can be set between 1 to 1000, with the default being 50. ```ruby ten_minutes_ago = DateTime.now - (10 / 1440.0) # List all results received in the last 10 minutes. # Limit results to the first 10 matches only. result = mailosaur.messages.list("SERVER_ID", page: 0, items_per_page: 10, received_after: ten_minutes_ago) ``` #### messages.search(server, criteria, options) Returns a list of messages matching the specified search criteria, in summary form. The messages are returned sorted by received date, with the most recently-received messages appearing first. > [!SUCCESS] > The method returns a message summary, rather than the full message object. This means that several properties, like the message body, are not included. To get this data, you’ll need to call [`get_by_id`](#messagesget_by_idid). Alternatively, we recommend using the [`get`](#messagesgetserver-criteria-options) method, which is a far more efficient approach. ```ruby criteria = Mailosaur::Models::SearchCriteria.new() criteria.sent_to = "someone@SERVER_ID.mailosaur.net" result = mailosaur.messages.search("SERVER_ID", criteria) # Get the most recent match message = result.items[0] print('Subject: ' + message.subject) ``` ##### Criteria | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **sent_from** | The full email address from which the target message was sent. | | **sent_to** | The full email address to which the target message was sent. | | **subject** | The subject line of the target email. | | **body** | Search for part of the message body. | | **match** | If set to `ALL` (default), then only results that match all specified criteria will be returned. If set to `ANY`, results that match any of the specified criteria will be returned. | ##### Options | PARAMETER | DESCRIPTION | | ------------ | ------------ | | **timeout** | If provided, determines how long to wait for a matching result (provided in milliseconds). | | **error_on_timeout** | When set to `false`, an error will not be thrown if timeout is reached (default: `true`). | | **received_after** | Allows you to customise how far back to look for messages. | | **page** | Used alongside `items_per_page` to paginate through results. This is zero-based, meaning `0` is the first page of results. | | **items_per_page** | A limit on the number of results to be returned. This can be set between 1 to 1000, with the default being 50. | ```ruby criteria = Mailosaur::Models::SearchCriteria.new() criteria.sent_to = "someone@SERVER_ID.mailosaur.net" # Search for all messages sent to someone@SERVER_ID.mailosaur.net, # received in the last 2 hours. Limit results to the first 10 matches only. two_hours_ago = DateTime.now - (2 / 24.0) result = mailosaur.messages.search("SERVER_ID", criteria, page: 0, items_per_page: 10, received_after: two_hours_ago) ``` #### messages.get_by_id(id) Retrieves the detail for a single email message. Must be used in conjunction with either [`list`](#messageslistserver-options) or [`search`](#messagessearchserver-criteria-options) in order to get the unique identifier for the required message. **We always recommend using the** [`get`](#messagesgetserver-criteria-options) **method instead**. ```ruby result = mailosaur.messages.list("SERVER_ID") message_id = result.items[0].id message = mailosaur.messages.get_by_id(message_id) print('Subject: ' + message.subject) ``` #### messages.delete(id) Permanently deletes a message. Also deletes any attachments related to the message. This operation cannot be undone. ```ruby mailosaur.messages.delete(message_id) ``` #### messages.delete_all(server) Permanently deletes all messages held in the specified inbox. Also deletes any attachments related to each message. This operation cannot be undone. ```ruby mailosaur.messages.delete_all("SERVER_ID") ``` #### messages.create(server, options) Creates a new message that can be sent to a verified email address. This is useful in scenarios where you want an email to trigger a workflow in your product. ```ruby options = Mailosaur::Models::MessageCreateOptions.new() options.to = 'verified-address@example.com' options.send = true options.subject = 'Request' options.text = 'Please can you give us a call back?' mailosaur.messages.create('SERVER_ID', options) ``` ##### Options - **to** The email address to which the email will be sent. Must be a verified email address. - **send** If true, email will be sent upon creation. - **subject** The email subject line. - **text** The plain text body of the email. - **html** The HTML body of the email. #### messages.forward(messageId, options) Forwards the specified email to a verified email address. ```ruby options = Mailosaur::Models::MessageForwardOptions.new() options.to = 'verified-address@example.com' options.text = 'FYI' mailosaur.messages.forward('MESSAGE_ID', options) ``` ##### Options - **to** The email address to which the email will be sent. Must be a verified email address. - **text** Any additional plain text content to forward the email with. - **html** Any additional HTML content to forward the email with. #### messages.reply(messageId, options) Sends a reply to the specified email. This is useful for when simulating a user replying to one of your emails. ```ruby options = Mailosaur::Models::MessageReplyOptions.new() options.text = 'FYI' mailosaur.messages.reply('MESSAGE_ID', options) ``` ##### Options - **text** Any additional plain text content to include in the reply. - **html** Any additional HTML content to include in the reply. ### Servers Inboxes capture emails and SMS messages, group your tests and settings, and manage access for your team. #### servers.list() Returns a list of your inboxes. Inboxes are returned sorted in alphabetical order. ```ruby result = mailosaur.servers.list() print('You have an inbox called: ' + result.items[0].name) ``` #### servers.create(server) Creates a new inbox. Only the `name` property is required to create a new inbox via the API. ```ruby create_options = Mailosaur::Models::ServerCreateOptions.new() create_options.name = "My email tests" mailosaur.servers.create(create_options) ``` #### servers.get(id) Retrieves the detail for a single inbox. Simply supply the unique identifier for the required inbox. ```ruby server = mailosaur.servers.get("SERVER_ID") ``` #### servers.get_password(id) Retrieves the password, for use with SMTP and POP3, for a single inbox. Simply supply the unique identifier for the required inbox. ```ruby password = mailosaur.servers.get_password("SERVER_ID") ``` #### servers.update(id, server) Updates a single inbox. ```ruby retrieved_server = mailosaur.servers.get("SERVER_ID") retrieved_server.name = "Updated inbox name" mailosaur.servers.update(retrieved_server.id, retrieved_server) ``` #### servers.delete(id) Permanently deletes an inbox. Also deletes all messages and associated attachments within the inbox. This operation cannot be undone. ```ruby mailosaur.servers.delete("SERVER_ID") ``` #### servers.generate_email_address(id) Utility method to help you generate a random email address for a given inbox. ```ruby email_address = mailosaur.servers.generate_email_address("SERVER_ID") print(email_address) # "bgwqj@SERVER_ID.mailosaur.net" ``` To learn about inbox IDs, and what to replace `SERVER_ID` with, see [sending email to Mailosaur](/docs/email-testing/sending-to-mailosaur). ### Files #### files.get_email(message_id) Downloads an EML file representing the specified email. Simply supply the unique identifier for the required email. #### files.get_attachment(attachment_id) Downloads a single attachment. Simply supply the unique identifier for the required attachment. ### Analysis #### analysis.spam(message_id) Perform spam testing on the specified email. ### Usage #### usage.limits() Retrieve account usage limits. Details the current limits and usage for your account. This endpoint requires authentication with an account-level API key. #### usage.transactions() Retrieves the last 31 days of transactional usage. This endpoint requires authentication with an account-level API key. --- Source: https://mailosaur.com/docs/automation/selenium # Using Mailosaur with Selenium All the guides you need to make the most of your Mailosaur subscription. Mailosaur integrates very simply and effectively into Selenium. To make the most of Mailosaur’s key features within Selenium, you can follow our guides on integration, email testing, and more. ## Overview - Start by reading our [quickstart guide](/docs/automation/selenium/quickstart) for Selenium users - Read our guide on [Selenium email testing](/docs/automation/selenium/email-testing) - Learn how to test [SMS messages with Selenium](/docs/automation/selenium/sms-testing) ## Generating a starter project If you have **npm** installed, you can quickly generate a basic starter project for Selenium via the command line: ```sh npm create mailosaur@latest ``` ## Learn more - Take a look at some [sample code](https://github.com/mailosaur/examples/tree/main/selenium) on GitHub. - Check out the [API reference](/docs/api) - detailed API documentation. - Read the [Java API library](https://github.com/mailosaur/mailosaur-java) documentation on GitHub. - Read the [Python API library](https://github.com/mailosaur/mailosaur-python) documentation on GitHub. - Read the [.NET API library](https://github.com/mailosaur/mailosaur-dotnet) documentation on GitHub. - Read the [Ruby API library](https://github.com/mailosaur/mailosaur-ruby) documentation on GitHub. - Read the [Node.js API library](https://github.com/mailosaur/mailosaur-node) documentation on GitHub. - [API client libraries](/docs/automation) - Check out the other Mailosaur API clients. --- Source: https://mailosaur.com/docs/automation/selenium/email-screenshots # Screenshot guide for Selenium Learn how to take screenshots with Mailosaur and Selenium. ## What you’ll need - An up-to-date version of Selenium - The Email Previews feature of Mailosaur - Mailosaur set up with Selenium. [See our Quickstart guide](/docs/automation/selenium/quickstart) Seeing how your email will look on various platforms is simple. Just follow the steps below: ### See a new email If you’re working on a new email and would like to see how it’ll look on various platforms, our Designer tool is the place to start. 1. Go to the [Designer](/app/builder) from the main menu. 2. Click **New Design**, name your design, and click **Create**. 3. Paste the HTML you want to test into the editor. 4. In the **Previews** panel, click **Generate previews**. 5. Select the email clients and devices you want to preview. 6. Click **Generate previews**. Your previews are ready in moments. They appear on the **See results** tab. If you need to make changes, edit the HTML in the Designer and generate new previews. ### See a pre-existing email If you have an existing email and want to see how it’ll look on a variety of platforms, Mailosaur’s inbox can help. 1. Send your email to one of your Mailosaur inboxes. 2. When the email arrives, click it to open the email viewer. 3. Select the **Previews** tab, and click **Generate previews**. 4. Select the email clients and devices you want to preview. 5. Click **Generate previews**. Your previews are ready in moments. They appear on the **See results** tab. For more detail, see [Generate email previews](/docs/email-previews/generate-previews). ## See also - [Email testing guide](/docs/automation/selenium/email-testing) - [SMS testing guide](/docs/automation/selenium/sms-testing) - [MFA/2FA guide](/docs/authenticator) --- Source: https://mailosaur.com/docs/automation/selenium/email-testing # Email testing for Selenium Learn how to integrate Mailosaur Email Testing into Selenium. ## What you'll find in this guide - How to test various aspects of emails - Testing links and codes - Managing email tests ## What you'll need - An understanding of Selenium and how it works. - A Mailosaur account. You can [start a free trial](/app/signup) if you don't have one. - A Selenium project with Mailosaur's API client configured. [See our short guide](/docs/automation/selenium/quickstart) on this. ## Basic usage To perform email testing with Selenium, all you need to do is: 1. Send an email message to your Mailosaur inbox (e.g. by requesting a password reset) 2. Connect to the Mailosaur API with the official client library. 3. Search for the email you sent in step 1. 4. Perform assertions in the same way you would for any other test. To learn about Server IDs, and what to replace SERVER_ID with, [see sending test emails to Mailosaur](/docs/email-testing/sending-to-mailosaur). ```java // Setup the API client MailosaurClient mailosaur = new MailosaurClient("API_KEY"); MessageSearchParams params = new MessageSearchParams(); params.withServer("SERVER_ID"); SearchCriteria searchCriteria = new SearchCriteria(); searchCriteria.withSentTo("my-test@SERVER_ID.mailosaur.net"); // Search for the message Message message = mailosaur.messages().get(params, searchCriteria); // Perform test assertions assertEquals("Support", message.from().get(0).name()); assertEquals("noreply@acme.com", message.from().get(0).email()); ``` ```py # Setup the API client mailosaur = MailosaurClient("API_KEY") criteria = SearchCriteria() criteria.sent_to = "my-test@SERVER_ID.mailosaur.net" # Search for the message message = mailosaur.messages.get("SERVER_ID", criteria) # Perform test assertions self.assertEqual("Support", message.sender[0].name) self.assertEqual("noreply@acme.com", message.sender[0].email) ``` ```csharp // Setup the API client var mailosaur = new MailosaurClient("API_KEY"); var criteria = new SearchCriteria() { SentTo = "my-test@SERVER_ID.mailosaur.net" }; // Search for the message var message = mailosaur.Messages.Get("SERVER_ID", criteria); // Perform test assertions Assert.Equal("Support", message.From[0].Name); Assert.Equal("noreply@acme.com", message.From[0].Email); ``` ```ruby # Setup the API client mailosaur = Mailosaur::MailosaurClient.new("API_KEY") criteria = Mailosaur::Models::SearchCriteria.new() criteria.sent_to = "my-test@SERVER_ID.mailosaur.net" # Search for the message message = mailosaur.messages.get("SERVER_ID", criteria) # Perform test assertions assert_equal("Support", message.from[0].name) assert_equal("noreply@acme.com", message.from[0].email) ``` ```js // Setup the API client const MailosaurClient = require("mailosaur"); const mailosaur = new MailosaurClient("API_KEY"); // Search for the message const message = await mailosaur.messages.get("SERVER_ID", { sentTo: "my-test@SERVER_ID.mailosaur.net", }); // Perform test assertions expect(message.from[0].name).toBe("Support"); expect(message.from[0].email).toBe("noreply@acme.com"); ``` This example will search for the email address that a message was sent to, but you can also search using any of the below criteria: | **Parameter** | **Description** | | ------------- | ------------------------------------------------------------- | | sentTo | The full email address to which the target message was sent | | sentFrom | The full email address from which the target message was sent | | subject | Finds messages where the subject line contains this text | | body | Finds messages where the message body contains this text | ### Test email addresses Each inbox in your account (also known as a server) has a unique identifier, referred to as a **Server ID**. This ID is used to give your inbox a domain name like this: `SERVER_ID.mailosaur.net`. This domain supports a wildcard email pattern, meaning any email address ending `@SERVER_ID.mailosaur.net` works out of the box. **You don't need to create email addresses** before using them, they just work! However, if you need help thinking of a unique email address, you can use this helper method: ```java String emailAddress = mailosaur.servers().generateEmailAddress("SERVER_ID"); System.out.println(emailAddress); // "bgwqj@SERVER_ID.mailosaur.net" ``` ```py email_address = mailosaur.servers.generate_email_address("SERVER_ID") print(email_address) # "bgwqj@SERVER_ID.mailosaur.net" ``` ```csharp var emailAddress = mailosaur.Servers.GenerateEmailAddress("SERVER_ID"); Console.WriteLine(emailAddress); // "bgwqj@SERVER_ID.mailosaur.net" ``` ```ruby email_address = mailosaur.servers.generate_email_address("SERVER_ID") puts(email_address) # "bgwqj@SERVER_ID.mailosaur.net" ``` ```js const emailAddress = mailosaur.servers.generateEmailAddress("SERVER_ID"); console.log(emailAddress); // "bgwqj@SERVER_ID.mailosaur.net" ``` ## Find an email Search for a specific message within your inbox. It's always better to use `messages.get()`, as it will automatically wait for messages to arrive, and will return the full message result. ```java MessageSearchParams params = new MessageSearchParams(); params.withServer("SERVER_ID"); SearchCriteria searchCriteria = new SearchCriteria(); searchCriteria.withSentTo("test123@SERVER_ID.mailosaur.net"); Message message = mailosaur.messages().get(params, searchCriteria); System.out.println(message.html().body()); ``` ```py criteria = SearchCriteria() criteria.sent_to = "test123@SERVER_ID.mailosaur.net" message = mailosaur.messages.get("SERVER_ID", criteria) print(message.html.body) ``` ```csharp var criteria = new SearchCriteria() { SentTo = "test123@SERVER_ID.mailosaur.net" }; var message = mailosaur.Messages.Get("SERVER_ID", criteria); Console.WriteLine(message.Html.Body); ``` ```ruby criteria = Mailosaur::Models::SearchCriteria.new() criteria.sent_to = "test123@SERVER_ID.mailosaur.net" message = mailosaur.messages.get("SERVER_ID", criteria) puts(message.html.body) ``` ```js // Search for the message const message = await mailosaur.messages.get("SERVER_ID", { sentTo: "my-test@SERVER_ID.mailosaur.net", }); console.log(message.html.body); ``` ### Time range for searching By default searches only look for messages received in the last hour. If you want to look further back than this, just set the 'received after' parameter. ```java // Calculate a timestamp for yesterday Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_YEAR, -1); long yesterday = calendar.getTimeInMillis(); // Use this timestamp in the search MessageSearchParams params = new MessageSearchParams(); params.withServer("SERVER_ID"); params.withReceivedAfter(yesterday); SearchCriteria searchCriteria = new SearchCriteria(); searchCriteria.withSentTo("test123@SERVER_ID.mailosaur.net"); Message message = mailosaur.messages().get(params, searchCriteria); ``` ```python # Calculate a datetime for yesterday yesterday = datetime.today() - timedelta(days=1) criteria = SearchCriteria() criteria.sent_to = "test123@SERVER_ID.mailosaur.net" # Use this timestamp in the search message = mailosaur.messages.get("SERVER_ID", criteria, received_after=yesterday) ``` ```csharp // Calculate a datetime for yesterday var yesterday = DateTime.Today.AddDays(-1); var criteria = new SearchCriteria() { SentTo = "test123@SERVER_ID.mailosaur.net" }; // Use this timestamp in the search var message = mailosaur.Messages.Get("SERVER_ID", criteria, receivedAfter: yesterday); ``` ```ruby # Calculate a datetime for yesterday yesterday = Date.today - 1 criteria = Mailosaur::Models::SearchCriteria.new() criteria.sent_to = "test123@SERVER_ID.mailosaur.net" # Use this timestamp in the search message = mailosaur.messages.get("SERVER_ID", criteria) ``` ```js // Calculate a datetime for yesterday const yesterday = new Date(Date.now() - 24 * 60 * 60 * 1000); // Use this timestamp in the search const message = await mailosaur.messages.get("SERVER_ID", { sentTo: "my-test@SERVER_ID.mailosaur.net", }, { receivedAfter: yesterday }); ``` ### "No matching messages" troubleshooting If you see the error "No matching messages found in time" when searching for messages: - Ensure that the target email or SMS message is visible in the Mailosaur Dashboard, as it may not have arrived at all. - Check when the message arrived. By default, searches only include messages received within the last hour. See "time range for searching" above on how to override this. - Check you have correctly set the **sent to** parameter in your search criteria. ## Other ways to fetch emails > [!WARNING] > > #### It is usually better to use `messages.get()` > > The `list` and `search` methods will only return basic summaries, meaning several properties (including the message body) are not included. To get this data, you need to use [`.getById()`](#6-messagesgetbyidid). Instead, we recommend using the [`messages.get()`](#2-messagesgetserver-criteria-options) as this automatically waits for a matching result and returns the message in the result. ### List current inbox contents See a full list of everything currently in your inbox. ```java // List the most recent messages MessageListParams params = new MessageListParams(); params.withServer("SERVER_ID"); MessageListResult result = mailosaur.messages().list(params); // Get the most recent message (the first one in the list) MessageSummary latestMessage = result.items().get(0); // Get the full message object Message message = mailosaur.messages().getById(latestMessage.id()); System.out.println(message.html().body()); ``` ```py # List the most recent messages result = mailosaur.messages.list("SERVER_ID") # Get the most recent message (the first one in the list) latest_message = result.items[0] # Get the full message object message = mailosaur.messages.get_by_id(latest_message.id) print(message.html.body) ``` ```csharp // List the most recent messages var result = mailosaur.Messages.List("SERVER_ID"); // Get the most recent message (the first one in the list) var latestMessage = result.Items[0]; // Get the full message object var message = mailosaur.Messages.GetById(latestMessage.Id); Console.WriteLine(message.Html.Body); ``` ```ruby # List the most recent messages result = mailosaur.messages.list("SERVER_ID") # Get the most recent message (the first one in the list) latest_message = result.items[0] # Get the full message object message = mailosaur.messages.get_by_id(latest_message.id) puts(message.html.body) ``` ```js // List the most recent messages const result = await mailosaur.messages.list("SERVER_ID"); // Get the most recent message (the first one in the list) const latestMessage = result.items[0]; // Get the full message object const message = await mailosaur.messages.getById(latestMessage.id); console.log(message.html.body); ``` ### Searching for multiple messages Identify if multiple messages meet the same criteria. ```java // Search for all messages sent to someone@SERVER_ID.mailosaur.net. SearchCriteria criteria = new SearchCriteria(); criteria.withSentTo("someone@SERVER_ID.mailosaur.net"); // Limit results to the first 10 matches only. MessageSearchParams params = new MessageSearchParams(); params.withServer("SERVER_ID") .withPage(0) .withItemsPerPage(10); MessageListResult result = mailosaur.messages().search(params, criteria); // Get the most recent message (the first one in the list) MessageSummary latestMessage = result.items().get(0); // Get the full message object Message message = mailosaur.messages().getById(latestMessage.id()); System.out.println(message.html().body()); ``` ```py # Search for all messages sent to someone@SERVER_ID.mailosaur.net. criteria = SearchCriteria() criteria.sent_to = "someone@SERVER_ID.mailosaur.net" # Limit results to the first 10 matches only. result = mailosaur.messages.search("SERVER_ID", criteria, page=0, items_per_page=10) # Get the most recent message (the first one in the list) latest_message = result.items[0] # Get the full message object message = mailosaur.messages.get_by_id(latest_message.id) print(message.html.body) ``` ```csharp // Search for all messages sent to someone@SERVER_ID.mailosaur.net. var criteria = new SearchCriteria() { SentTo = "someone@SERVER_ID.mailosaur.net" }; // Limit results to the first 10 matches only. var result = mailosaur.Messages.Search("SERVER_ID", criteria, page: 0, itemsPerPage: 10); // Get the most recent message (the first one in the list) var latestMessage = result.Items[0]; // Get the full message object var message = mailosaur.Messages.GetById(latestMessage.Id); Console.WriteLine(message.Html.Body); ``` ```ruby # Search for all messages sent to someone@SERVER_ID.mailosaur.net. criteria = Mailosaur::Models::SearchCriteria.new() criteria.sent_to = "someone@SERVER_ID.mailosaur.net" # Limit results to the first 10 matches only. result = mailosaur.messages.search("SERVER_ID", criteria, page: 0, items_per_page: 10) # Get the most recent message (the first one in the list) latest_message = result.items[0] # Get the full message object message = mailosaur.messages.get_by_id(latest_message.id) puts(message.html.body) ``` ```js // Search for all messages sent to someone@SERVER_ID.mailosaur.net. // Limit results to the first 10 matches only. const result = await mailosaur.messages.search( "SERVER_ID", { sentTo: "someone@SERVER_ID.mailosaur.net", }, { page: 0, itemsPerPage: 10, } ); // Get the most recent message (the first one in the list) const latestMessage = result.items[0]; // Get the full message object const message = await mailosaur.messages.getById(latestMessage.id); console.log(message.html.body); ``` ## Common test scenarios ### Testing basic properties Once you have fetched an email (e.g. using `messages.get`), you can easily test the properties of that email: ```java // Test the email subject line assertEquals("Password reset", message.subject()); // Test sender information assertEquals("Support", message.from().get(0).name()); assertEquals("noreply@acme.com", message.from().get(0).email()); // Test recipient information assertEquals("John Smith", message.to().get(0).name()); assertEquals("john@SERVER.mailosaur.net", message.to().get(0).email()); ``` ```py # Test the email subject line self.assertEqual("Password reset", message.subject) # Test sender information self.assertEqual("Support", message.sender[0].name) self.assertEqual("noreply@acme.com", message.sender[0].email) # Test recipient information self.assertEqual("John Smith", message.to[0].name) self.assertEqual("john@SERVER.mailosaur.net", message.to[0].email) ``` ```csharp // Test the email subject line Assert.Equal("Password reset", message.Subject); // Test sender information Assert.Equal("Support", message.From[0].Name); Assert.Equal("noreply@acme.com", message.From[0].Email); // Test recipient information Assert.Equal("John Smith", message.To[0].Name); Assert.Equal("john@SERVER.mailosaur.net", message.To[0].Email); ``` ```ruby # Test the email subject line assert_equal("Password reset", message.subject) # Test sender information assert_equal("Support", message.from[0].name) assert_equal("noreply@acme.com", message.from[0].email) # Test recipient information assert_equal("John Smith", message.to[0].name) assert_equal("john@SERVER.mailosaur.net", message.to[0].email) ``` ```js // Test the email subject line expect(message.subject).toBe("Password reset"); // Test sender information expect(message.from[0].name).toBe("Support"); expect(message.from[0].email).toBe("noreply@acme.com"); // Test recipient information expect(message.from[0].name).toBe("John Smith"); expect(message.from[0].email).toBe("john@SERVER.mailosaur.net"); ``` #### Testing carbon-copy recipients ```java // Carbon copy (CC) recipients assertEquals("Jane Smith", message.cc().get(0).name()); assertEquals("jane@SERVER.mailosaur.net", message.cc().get(0).email()); // Blind carbon copy (BCC) recipients assertEquals("Jill Smith", message.bcc().get(0).name()); assertEquals("jill@SERVER.mailosaur.net", message.bcc().get(0).email()); ``` ```py # Carbon copy (CC) recipients self.assertEqual("Jane Smith", message.cc[0].name) self.assertEqual("jane@SERVER.mailosaur.net", message.cc[0].email) # Blind carbon copy (BCC) recipients self.assertEqual("Jill Smith", message.bcc[0].name) self.assertEqual("jill@SERVER.mailosaur.net", message.bcc[0].email) ``` ```csharp // Carbon copy (CC) recipients Assert.Equal("Jane Smith", message.Cc[0].Name); Assert.Equal("jane@SERVER.mailosaur.net", message.Cc[0].Email); // Blind carbon copy (BCC) recipients Assert.Equal("Jill Smith", message.Bcc[0].Name); Assert.Equal("jill@SERVER.mailosaur.net", message.Bcc[0].Email); ``` ```ruby # Carbon copy (CC) recipients assert_equal("Jane Smith", message.cc[0].name) assert_equal("jane@SERVER.mailosaur.net", message.cc[0].email) # Blind carbon copy (BCC) recipients assert_equal("Jill Smith", message.bcc[0].name) assert_equal("jill@SERVER.mailosaur.net", message.bcc[0].email) ``` ```js // Carbon copy (CC) recipients expect(message.cc[0].name).toBe("Jane Smith"); expect(message.cc[0].email).toBe("jane@SERVER.mailosaur.net"); // Blind carbon copy (BCC) recipients expect(message.bcc[0].name).toBe("Jill Smith"); expect(message.bcc[0].email).toBe("jill@SERVER.mailosaur.net"); ``` ### Testing email contents Most emails will contain separate HTML and plain text content. You can see below how to test either content type: #### Plain text content ```java // Check that the email contains some text System.out.println(message.text().body()); // "Hi Jason, ..." ``` ```py # Check that the email contains some text print(message.text.body) # "Hi Jason, ..." ``` ```csharp // Check that the email contains some text Console.WriteLine(message.Text.Body); // "Hi Jason, ..." ``` ```ruby # Check that the email contains some text puts(message.text.body) # "Hi Jason, ..." ``` ```js // Check that the email contains some text console.log(message.text.body); // "Hi Jason, ..." ``` #### HTML content When testing HTML content, you can perform basic contains or equals assertions in the same way as with plain text content: ```java // Check that raw HTML contains some expected content System.out.println(message.html().body()); // "Hello world" ``` ```py # Check that raw HTML contains some expected content print(message.html.body) # "Hello world" ``` ```csharp // Check that raw HTML contains some expected content Console.WriteLine(message.Html.Body); // "Hello world" ``` ```ruby # Check that raw HTML contains some expected content puts(message.html.body) # "Hello world" ``` ```js // Check that raw HTML contains some expected content console.log(message.html.body); // "Hello world" ``` ### Testing links Any links that are found in the content of your email are instantly available via the `html.links` or `text.links` arrays, depending on which content the link was found in: ```java // Working with links in HTML content Link linkInHtml = message.html().links().get(0); assertEquals("Google Search", linkInHtml.text()); assertEquals("https://www.google.com/", linkInHtml.href()); // Working with links in plain text content Link linkInPlainText = message.text().links().get(0); assertEquals("https://www.google.com/", linkInPlainText.href()); ``` ```py # Working with links in HTML content link_in_html = message.html.links[0] self.assertEqual("Google Search", link_in_html.text) self.assertEqual("https://www.google.com/", link_in_html.href) # Working with links in plain text content link_in_plain_text = message.text.links[0] self.assertEqual("https://www.google.com/", link_in_plain_text.href) ``` ```csharp // Working with links in HTML content var linkInHtml = message.Html.Links[0]; Assert.Equal("Google Search", linkInHtml.Text); Assert.Equal("https://www.google.com/", linkInHtml.Href); // Working with links in plain text content var linkInPlainText = message.Text.Links[0]; Assert.Equal("https://www.google.com/", linkInPlainText.Href); ``` ```ruby # Working with links in HTML content link_in_html = message.html.links[0] assert_equal("Google Search", link_in_html.text) assert_equal("https://www.google.com/", link_in_html.href) # Working with links in plain text content link_in_plain_text = message.text.links[0] assert_equal("https://www.google.com/", link_in_plain_text.href) ``` ```js // Working with links in HTML content const linkInHtml = message.html.links[0]; expect(linkInHtml.text).toBe("Google Search"); expect(linkInHtml.href).toBe("https://www.google.com/"); // Working with links in plain text content const linkInPlainText = message.text.links[0]; expect(linkInPlainText.href).toBe("https://www.google.com/"); ``` #### Clicking a link If you just need to simulate a link being clicked and do not need to do anything on the target page, you can do this with `HttpClient`: ```java String href = message.html().links().get(0).href(); // Make an HTTP call to simulate someone clicking a link var client = HttpClient.newHttpClient(); var request = HttpRequest.newBuilder(URI.create(href)).build(); var response = client.send(request, null); System.out.println(response.statusCode()); // 200 ``` ```py import requests # ... href = message.html.links[0].href # Make an HTTP call to simulate someone clicking a link response = requests.get(href) print(response.status_code) # 200 ``` ```csharp var href = message.Html.Links[0].Href; // Make an HTTP call to simulate someone clicking a link using (var client = new HttpClient()) { var result = await client.GetAsync(href); Console.WriteLine(result.StatusCode); // 200 } ``` ```ruby href = message.html.links[0].href # Make an HTTP call to simulate someone clicking a link uri = URI(href) Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http| request = Net::HTTP::Get.new uri response = http.request request # Net::HTTPResponse object puts(response.code) # 200 end ``` ```js const https = require("https"); // ... const href = message.html.links[0].href; // Make an HTTP call to trigger the web beacon https.get(href, (r) => console.log(r.statusCode)); // 200 ``` ### Testing verification codes Codes are automatically extracted from the content of your message. They are then made available via the `html.codes` or `text.codes` arrays: ```java // Working with codes in HTML content Link codeInHtml = message.html().codes().get(0); assertEquals("456812", codeInHtml.value()); // Working with codes in plain text content Link codeInText = message.text().codes().get(0); assertEquals("456812", codeInText.value()); ``` ```py # Working with codes in HTML content code_in_html = message.html.codes[0] self.assertEqual("456812", code_in_html.value) # Working with codes in plain text content code_in_text = message.text.codes[0] self.assertEqual("456812", code_in_text.value) ``` ```csharp // Working with codes in HTML content var codeInHtml = message.Html.Codes[0]; Assert.Equal("456812", codeInHtml.Value); // Working with codes in plain text content var codeInText = message.Text.Codes[0]; Assert.Equal("456812", codeInText.Value); ``` ```ruby # Working with codes in HTML content code_in_html = message.html.codes[0] assert_equal("456812", code_in_html.value) # Working with codes in plain text content code_in_text = message.text.codes[0] assert_equal("456812", code_in_text.value) ``` ```js // Working with codes in HTML content const codeInHtml = message.html.codes[0]; expect(codeInHtml.value).toBe("456812"); // Working with codes in plain text content const codeInText = message.text.codes[0]; expect(codeInText.value).toBe("456812"); ``` ### Testing attachments Any email attachments are made available via the attachments array: ```java // Number of attachments found System.out.println(message.attachments().size()); // 2 // Get the first attachment Attachment attachment = message.attachments().get(0); // Check attachment attributes assertEquals("example.pdf", attachment.fileName()); assertEquals("application/pdf", attachment.contentType()); assertEquals(4028, attachment.length()); ``` ```py # Number of attachments found print(len(message.attachments)) # 2 # Get the first attachment attachment = message.attachments[0] # Check attachment attributes self.assertEqual("example.pdf", attachment.file_name) self.assertEqual("application/pdf", attachment.content_type) self.assertEqual(4028, attachment.length) ``` ```csharp // Number of attachments found Console.WriteLine(message.Attachments.Count); // Get the first attachment var attachment = message.Attachments[0]; // Check attachment attributes Assert.Equal("example.pdf", attachment.FileName); Assert.Equal("application/pdf", attachment.ContentType); Assert.Equal(4028, attachment.Length); ``` ```ruby # Number of attachments found puts(message.attachments.length) # 2 # Get the first attachment attachment = message.attachments[0] # Check attachment attributes assert_equal("example.pdf", attachment.file_name) assert_equal("application/pdf", attachment.content_type) assert_equal(4028, attachment.length) ``` ```js // Number of attachments found console.log(message.attachments.length); // 2 // Get the first attachment const attachment = message.attachments[0]; // Check attachment attributes expect(attachment.fileName).toBe("example.pdf"); expect(attachment.contentType).toBe("application/pdf"); expect(attachment.length).toBe(4028); ``` #### Save an attachment to disk You can download and save attachments using this sample code: ```java Attachment firstAttachment = message.attachments().get(0); byte[] file = mailosaur.files().getAttachment(firstAttachment.id()); Files.write(Paths.get(firstAttachment.fileName()), file); ``` ```py first_attachment = message.attachments[0] file = mailosaur.files.get_attachment(first_attachment.id).content f = open(first_attachment.file_name, 'wb') f.write(file) f.close() ``` ```csharp var firstAttachment = message.Attachments[0]; var file = mailosaur.Files.GetAttachment(firstAttachment.Id); File.WriteAllBytes(firstAttachment.FileName, file); ``` ```ruby first_attachment = message.attachments[0] file = mailosaur.files.get_attachment(first_attachment.id) File.open(first_attachment.file_name, 'wb') { |fp| fp.write(file) } ``` ```js const firstAttachment = message.Attachments[0]; const file = await mailosaur.files.getAttachment(firstAttachment.id); fs.writeFileSync(firstAttachment.fileName, file); ``` #### Encoding attachments In some scenarios you may need a base64-encoded copy of an attachment. You can achieve this using this sample code: ```java Attachment firstAttachment = message.attachments().get(0); byte[] file = mailosaur.files().getAttachment(firstAttachment.id()); String base64 = new String(Base64.getEncoder().encode(file)); System.out.println(base64); ``` ```py first_attachment = message.attachments[0] file = mailosaur.files.get_attachment(first_attachment.id).content base64 = base64.b64encode(file) print(base64) ``` ```csharp var firstAttachment = message.Attachments[0]; var file = mailosaur.Files.GetAttachment(firstAttachment.Id); var base64 = Convert.ToBase64String(file); Console.WriteLine(base64); ``` ```ruby first_attachment = message.attachments[0] file = mailosaur.files.get_attachment(first_attachment.id) base64 = Base64.encode64(file) puts base64 ``` ```js const firstAttachment = message.Attachments[0]; const file = await mailosaur.files.getAttachment(firstAttachment.id); const base64 = file.toString("base64"); console.log(base64); ``` ### Testing images and web beacons Any images found within the HTML content of an email are made available via the `html.images` array: ```java // Number of images found System.out.println(message.html().images().size()); // Get the first image var image = message.html().images().get(0); // Check image attributes assertEquals("https://example.com/balloon.png", image.src()); assertEquals("A hot air balloon", image.alt()); ``` ```py # Number of images found print(len(message.html.images)) # Get the first image image = message.html.images[0] # Check image attributes self.assertEqual("https://example.com/balloon.png", image.src) self.assertEqual("A hot air balloon", image.alt) ``` ```csharp // Number of images found Console.WriteLine(message.Html.Images.Count); // Get the first image var image = message.Html.Images[0]; // Check image attributes Assert.Equal("https://example.com/balloon.png", image.Src) Assert.Equal("A hot air balloon", image.Alt) ``` ```ruby # Number of images found puts(message.html.images.length) # Get the first image image = message.html.images[0] # Check image attributes assert_equal("https://example.com/balloon.png", image.src) assert_equal("A hot air balloon", image.alt) ``` ```js // Number of images found console.log(message.html.images.length); // Get the first image const image = message.html.images[0]; // Check image attributes expect(image.src).toBe("https://example.com/balloon.png"); expect(image.alt).toBe("A hot air balloon"); ``` To test whether an image is accessible online, or that a [web beacon](https://en.wikipedia.org/wiki/Web_beacon) is working as expected, you can simply perform an HTTP request: ```java // Make an HTTP call to trigger the web beacon var client = HttpClient.newHttpClient(); var request = HttpRequest.newBuilder(URI.create(image.src())).build(); var response = client.send(request, null); System.out.println(response.statusCode()); // 200 ``` ```py import requests # ... # Make an HTTP call to trigger the web beacon response = requests.get(image.src) print(response.status_code) # 200 ``` ```csharp // Make an HTTP call to trigger the web beacon using (var client = new HttpClient()) { var result = await client.GetAsync(image.Src); Console.WriteLine(result.StatusCode); // 200 } ``` ```ruby # Make an HTTP call to trigger the web beacon uri = URI(image.src) Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http| request = Net::HTTP::Get.new uri response = http.request request puts(response.code) # 200 end ``` ```js const https = require("https"); // ... // Make an HTTP call to trigger the web beacon https.get(image.src, (r) => console.log(r.statusCode)); // 200 ``` ### Sending an email If your product is capable of handling inbound emails, you can use Mailosaur’s sending feature to trigger this functionality in your product. The `messages.create` command creates and sends an email to a verified external email address: ```java CodeMessageCreateOptions options = new MessageCreateOptions(); options.withTo("verified-address@example.com") .withSend(true) .withSubject("Request") .withText("Please can you give us a call back?"); mailosaur.messages().create("SERVER_ID", options); ``` ```py recipient = "verified-address@example.com" subject = "Request" text = "Please can you give us a call back?" options = MessageCreateOptions( recipient, True, subject, text=text) mailosaur.messages.create("SERVER_ID", options) ``` ```csharp mailosaur.Messages.Create("SERVER_ID", new MessageCreateOptions() { To = "verified-address@example.com", Subject = "Request", Text = "Please can you give us a call back?", Send = true } ); ``` ```ruby options = Mailosaur::Models::MessageCreateOptions.new() options.to = "verified-address@example.com" options.subject = "Request" options.text = "Please can you give us a call back?" options.send = true mailosaur.messages.create('SERVER_ID', options) ``` ```js await mailosaur.messages.create("SERVER_ID", { to: "verified-address@example.com", subject: "Request", text: "Please can you give us a call back?", send: true, }); ``` The options available to use with this method are: | Parameter | Description | | ----------- | ------------------------------------------------------------------------------------ | | send | This must be set to true if you are sending an outbound email | | to | The email address to which the email will be sent. Must be a verified email address. | | subject | The email subject line | | text | The plain text body of the email. | | html | The HTML body of the email. | | attachments | Optional attachments (see 'include attachments' below) | #### Include attachments You can include attachments in emails sent via the API, by including an array of base64-encoded attachment objects: ```java Attachment attachment = new Attachment(); attachment.withFileName("cat.png"); attachment.withContent("{BASE64_ENCODED_FILE}"); attachment.withContentType("image/png"); CodeMessageCreateOptions options = new MessageCreateOptions(); options.withTo("verified-address@example.com") .withSend(true) .withSubject("Request") .withText("Please can you give us a call back?") .withAttachments(Arrays.asList(new Attachment[] { attachment })); mailosaur.messages().create("SERVER_ID", options); ``` ```py attachment = Attachment() attachment.file_name = "cat.png" attachment.content = "{BASE64_ENCODED_FILE}" attachment.content_type = "image/png" attachments = [attachment] recipient = "verified-address@example.com" subject = "Request" text = "Please can you give us a call back?" options = MessageCreateOptions( recipient, True, subject, text=text, attachments=attachments) mailosaur.messages.create("SERVER_ID", options) ``` ```csharp var attachment = new Attachment() { FileName = "cat.png", Content = "{BASE64_ENCODED_FILE}", ContentType = "image/png" }; mailosaur.Messages.Create("SERVER_ID", new MessageCreateOptions() { To = "verified-address@example.com", Subject = "Request", Text = "Please can you give us a call back?", Attachments = new List() { attachment }, Send = true } ); ``` ```ruby attachment = Mailosaur::Models::Attachment.new() attachment.file_name = "cat.png" attachment.content = "{BASE64_ENCODED_FILE}" attachment.content_type = "image/png" options = Mailosaur::Models::MessageCreateOptions.new() options.to = "verified-address@example.com" options.subject = "Request" options.text = "Please can you give us a call back?" options.attachments = [attachment] options.send = true mailosaur.messages.create('SERVER_ID', options) ``` ```js const attachment = { fileName: "cat.png", content: "{BASE64_ENCODED_FILE}", contentType: "image/png", }; await mailosaur.messages.create("SERVER_ID", { to: "verified-address@example.com", subject: "Request", text: "Please can you give us a call back?", attachments: [attachment], send: true, }); ``` ### Replying to an email If your product handles email replies, the Mailosaur reply feature simulates this. When you reply, the message is sent back to the original account: ```java MessageReplyOptions options = new MessageReplyOptions(); options.withText("FYI"); mailosaur.messages().reply("MESSAGE_ID", options); ``` ```py options = MessageReplyOptions(text="FYI") mailosaur.messages.reply("MESSAGE_ID", options) ``` ```csharp mailosaur.Messages.Reply("MESSAGE_ID", new MessageReplyOptions() { Text = "FYI" } ); ``` ```ruby options = Mailosaur::Models::MessageReplyOptions.new() options.text = "FYI" mailosaur.messages.reply("MESSAGE_ID", options) ``` ```js await mailosaur.messages.reply("MESSAGE_ID", { text: "FYI", }); ``` | Parameter | Description | | ----------- | ------------------------------------------------------ | | text | Any additional text content to include in the reply | | html | Any additional HTML content to include in the reply | | subject | Optionally override the default subject line | | attachments | Optional attachments (see 'include attachments' above) | ### Forwarding a message to email You can forward messages from your Mailosaur account to external email addresses either one-by-one, or via the creation of automated forwarding rules. Before you can forward messages, **you must set up a [verified external email address](/docs/managing-your-account/external-email-addresses)**, so you can send email to it: ```java MessageForwardOptions options = new MessageForwardOptions(); options.withTo("verified-address@example.com") .withText("FYI"); mailosaur.messages().forward("MESSAGE_ID", options); ``` ```py recipient = "verified-address@example.com" options = MessageForwardOptions(recipient, text="FYI") mailosaur.messages.forward("MESSAGE_ID", options) ``` ```csharp mailosaur.Messages.Forward("MESSAGE_ID", new MessageForwardOptions() { To = "verified-address@example.com", Text = "FYI" } ); ``` ```ruby options = Mailosaur::Models::MessageForwardOptions.new() options.to = 'verified-address@example.com' options.text = 'FYI' mailosaur.messages.forward('MESSAGE_ID', options) ``` ```js await mailosaur.messages.forward("MESSAGE_ID", { to: "verified-address@example.com", text: "FYI", }); ``` | Parameter | Description | | --------- | ------------------------------------------------------------------------------------- | | to | The email address to which the message will be sent. Must be a verified email address | | text | Any additional text content to forward the message with | | html | Any additional HTML content to forward the message with | | subject | Optionally override the default subject line | ## Deleting messages ### Deleting an individual message Permanently deletes a single message. Also deletes any attachments related to the message. This operation cannot be undone: ```java mailosaur.messages().delete("MESSAGE_ID"); ``` ```py mailosaur.messages.delete("MESSAGE_ID") ``` ```csharp mailosaur.Messages.Delete("MESSAGE_ID"); ``` ```ruby mailosaur.messages.delete("MESSAGE_ID") ``` ```js await mailosaur.messages.del("MESSAGE_ID"); ``` ### Delete all messages Permanently deletes all messages held in the specified inbox. Also deletes any attachments related to each message. This operation cannot be undone: ```java mailosaur.messages().deleteAll("SERVER_ID"); ``` ```py mailosaur.messages.delete_all("SERVER_ID") ``` ```csharp mailosaur.Messages.DeleteAll("SERVER_ID"); ``` ```ruby mailosaur.messages.delete_all("SERVER_ID") ``` ```js await mailosaur.messages.deleteAll("SERVER_ID"); ``` ## See also - [SMS testing guide](/docs/automation/selenium/sms-testing) - [MFA/2FA guide](/docs/authenticator) --- Source: https://mailosaur.com/docs/automation/selenium/quickstart # Mailosaur and Selenium - Quickstart guide Get Mailosaur up and running within your Selenium project in a few steps. ## What you'll need - You'll need a Mailosaur account. If you don’t already have one, just [create a free trial account](/app/signup) first. - Log in to your account and generate an [API key](/app/keys), as you will need this to run automated tests. - Finally, make sure you know how to send emails (or SMS) into your account. ## Express: Generate a sample project If you have **npm** installed, then the quickest way to get started is by generating a basic starter project for Selenium via the command line: ```sh npm create mailosaur@latest ``` This will give you a simple Selenium project with Mailosaur already configured, along with some basic tests so you can see how a project would typically work. You can also check out similar [sample code](https://github.com/mailosaur/examples/tree/main/selenium) on GitHub. ## Integrate with an existing Selenium project If you have an existing Selenium project (or created one just now), here is how to install and configure Mailosaur's API client library: ### Install the Mailosaur Java library **Gradle users** can add this dependency to their project’s build file: ```java // MAILOSAUR_JAVA_VERSION available at: // https://github.com/mailosaur/mailosaur-java/releases/latest) implementation "com.mailosaur:mailosaur-java:MAILOSAUR_JAVA_VERSION" ``` **Maven users** should add this dependency to their project’s POM: ```xml com.mailosaur mailosaur-java MAILOSAUR_JAVA_VERSION ``` If you don’t use Gradle or Maven, refer to the README within the [GitHub repository](https://github.com/mailosaur/mailosaur-java). ### Make your first API call ```java // Replace API_KEY with the one from your account var mailosaur = new MailosaurClient("API_KEY"); // Make a simple API call to find the name of your inbox var result = mailosaur.servers().list(); System.out.println("Inbox name is " + result.items().get(0).name()); ``` ### Install the Mailosaur Python library Run this command to install the [Mailosaur Python package](https://github.com/mailosaur/mailosaur-python): ```sh pip install mailosaur ``` ### Make your first API call ```py # Replace API_KEY with the one from your account mailosaur = MailosaurClient("API_KEY") # Make a simple API call to find the name of your inbox result = mailosaur.servers().list() print("Inbox name is " + result.items[0].name) ``` ### Install the Mailosaur .NET library Run this command to install the [Mailosaur NuGet package](https://github.com/mailosaur/mailosaur-dotnet): ```sh dotnet add package mailosaur ``` ### Make your first API call ```dotnet // Replace API_KEY with the one from your account var mailosaur = new MailosaurClient("API_KEY"); // Make a simple API call to find the name of your inbox var result = mailosaur.Servers.List(); Console.WriteLine("Inbox name is " + result.Items[0].Name); ``` ### Install the Mailosaur Ruby library Run this command to install the [Mailosaur Ruby package](https://github.com/mailosaur/mailosaur-ruby): ```sh gem install mailosaur ``` ### Make your first API call ```ruby # Replace API_KEY with the one from your account mailosaur = Mailosaur::MailosaurClient.new("API_KEY") # Make a simple API call to find the name of your inbox result = mailosaur.servers().list() puts("Inbox name is " + result.items[0].name) ``` ### Install the Mailosaur Node.js library Use **npm** to install the [Mailosaur Node.js library](https://github.com/mailosaur/mailosaur-node): ```sh npm install mailosaur ``` ### Make your first API call ```js // Replace API_KEY with the one from your account const MailosaurClient = require("mailosaur"); const mailosaur = new MailosaurClient("API_KEY"); // Make a simple API call to find the name of your inbox const result = await mailosaur.servers().list(); console.log("Inbox name is " + result.items[0].name); ``` ## Start testing Now that you have a project connected to the Mailosaur API, you can start creating all kinds of tests: - [Email testing](/docs/automation/selenium/email-testing) - test password resets, account verification, order confirmations, etc. - [SMS testing](/docs/automation/selenium/sms-testing) - test alerts, notifications, and 2FA logins - [2FA app testing](/docs/authenticator) - mimic the functionality of apps like Google Authenticator and Auth0 - [Email deliverability testing](/docs/api) --- Source: https://mailosaur.com/docs/automation/selenium/sms-testing # SMS testing for Selenium Learn how to comprehensively test every element of your SMS communication within Selenium. ## What you'll find in this guide - How to test various aspects of SMS - Testing links and codes - Managing SMS tests ## What you'll need - An understanding of Selenium and how it works. - A Mailosaur account with the SMS feature enabled. You can [start a free trial](/app/signup) if you don't have one. - A Selenium project with Mailosaur's API client configured. [See our short guide](/docs/automation/selenium/quickstart) on this. ## Basic usage To perform SMS testing with Selenium, all you need to do is: 1. Send an SMS message to your dedicated Mailosaur phone number. 2. Connect to the Mailosaur API with the official client library. 3. Search for the message you sent in step 1. 4. Perform assertions in the same way you would for any other test. To learn about Server IDs, and what to replace SERVER_ID with, [see sending test emails to Mailosaur](/docs/email-testing/sending-to-mailosaur). ```java // Setup the API client MailosaurClient mailosaur = new MailosaurClient("API_KEY"); MessageSearchParams params = new MessageSearchParams(); params.withServer("SERVER_ID"); SearchCriteria searchCriteria = new SearchCriteria(); searchCriteria.withSentTo("123456789"); // Phone number // Search for the message Message message = mailosaur.messages().get(params, searchCriteria); // Perform test assertions assertEquals("Support", message.from().get(0).name()); assertEquals("654321", message.from().get(0).phone()); ``` ```py # Setup the API client mailosaur = MailosaurClient("API_KEY") criteria = SearchCriteria() criteria.sent_to = "123456789" # Phone number # Search for the message message = mailosaur.messages.get("SERVER_ID", criteria) # Perform test assertions self.assertEqual("Support", message.sender[0].name) self.assertEqual("654321", message.sender[0].phone) ``` ```csharp // Setup the API client var mailosaur = new MailosaurClient("API_KEY"); var criteria = new SearchCriteria() { SentTo = "123456789" // Phone number }; // Search for the message var message = mailosaur.Messages.Get("SERVER_ID", criteria); // Perform test assertions Assert.Equal("Support", message.From[0].Name); Assert.Equal("654321", message.From[0].Phone); ``` ```ruby # Setup the API client mailosaur = Mailosaur::MailosaurClient.new("API_KEY") criteria = Mailosaur::Models::SearchCriteria.new() criteria.sent_to = "123456789" # Phone number # Search for the message message = mailosaur.messages.get("SERVER_ID", criteria) # Perform test assertions assert_equal("Support", message.from[0].name) assert_equal("654321", message.from[0].phone) ``` ```js // Setup the API client const MailosaurClient = require("mailosaur"); const mailosaur = new MailosaurClient("API_KEY"); // Search for the message const message = await mailosaur.messages.get("SERVER_ID", { sentTo: "123456789", // Phone number }); // Perform test assertions expect(message.from[0].name).toBe("Support"); expect(message.from[0].phone).toBe("654321"); ``` This example will search for the phone number that a message was sent to, but you can also search using any of the below criteria: | **Parameter** | **Description** | | ------------- | ------------------------------------------------------------ | | sentTo | The full phone number to which the target message was sent | | sentFrom | The full phone number from which the target message was sent | | body | Finds messages where the message body contains this text | ## Find an SMS message Search for a specific message within your inbox. It's always better to use `messages.get()`, as it will automatically wait for messages to arrive, and will return the full message result. ```java MessageSearchParams params = new MessageSearchParams(); params.withServer("SERVER_ID"); SearchCriteria searchCriteria = new SearchCriteria(); searchCriteria.withSentTo("123456789"); // Phone number Message message = mailosaur.messages().get(params, searchCriteria); System.out.println(message.text().body()); ``` ```py criteria = SearchCriteria() criteria.sent_to = "123456789" # Phone number message = mailosaur.messages.get("SERVER_ID", criteria) print(message.text.body) ``` ```csharp var criteria = new SearchCriteria() { SentTo = "123456789" // Phone number }; var message = mailosaur.Messages.Get("SERVER_ID", criteria); Console.WriteLine(message.Text.Body); ``` ```ruby criteria = Mailosaur::Models::SearchCriteria.new() criteria.sent_to = "123456789" # Phone number message = mailosaur.messages.get("SERVER_ID", criteria) puts(message.text.body) ``` ```js // Search for the message const message = await mailosaur.messages.get("SERVER_ID", { sentTo: "123456789", // Phone number }); console.log(message.text.body); ``` ### Time range for searching By default searches only look for messages received in the last hour. If you want to look further back than this, just set the 'received after' parameter. ```java // Calculate a timestamp for yesterday Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_YEAR, -1); long yesterday = calendar.getTimeInMillis(); // Use this timestamp in the search MessageSearchParams params = new MessageSearchParams(); params.withServer("SERVER_ID"); params.withReceivedAfter(yesterday); SearchCriteria searchCriteria = new SearchCriteria(); searchCriteria.withSentTo("123456789"); Message message = mailosaur.messages().get(params, searchCriteria); ``` ```python # Calculate a datetime for yesterday yesterday = datetime.today() - timedelta(days=1) criteria = SearchCriteria() criteria.sent_to = "123456789" # Use this timestamp in the search message = mailosaur.messages.get("SERVER_ID", criteria, received_after=yesterday) ``` ```csharp // Calculate a datetime for yesterday var yesterday = DateTime.Today.AddDays(-1); var criteria = new SearchCriteria() { SentTo = "123456789" }; // Use this timestamp in the search var message = mailosaur.Messages.Get("SERVER_ID", criteria, receivedAfter: yesterday); ``` ```ruby # Calculate a datetime for yesterday yesterday = Date.today - 1 criteria = Mailosaur::Models::SearchCriteria.new() criteria.sent_to = "123456789" # Use this timestamp in the search message = mailosaur.messages.get("SERVER_ID", criteria) ``` ```js // Calculate a datetime for yesterday const yesterday = new Date(Date.now() - 24 * 60 * 60 * 1000); // Use this timestamp in the search const message = await mailosaur.messages.get("SERVER_ID", { sentTo: "123456789", }, { receivedAfter: yesterday }); ``` ### "No matching messages" troubleshooting If you see the error "No matching messages found in time" when searching for messages: - Ensure that the target email or SMS message is visible in the Mailosaur Dashboard, as it may not have arrived at all. - Check when the message arrived. By default, searches only include messages received within the last hour. See "time range for searching" above on how to override this. - Check you have correctly set the **sent to** parameter in your search criteria. ## Other ways to fetch SMS messages > [!WARNING] > > #### It is usually better to use `messages.get()` > > The `list` and `search` methods will only return basic summaries, meaning several properties (including the message body) are not included. To get this data, you need to use [`.getById()`](#6-messagesgetbyidid). Instead, we recommend using the [`messages.get()`](#2-messagesgetserver-criteria-options) as this automatically waits for a matching result and returns the message in the result. ### Search for multiple messages Identify if multiple messages meet the same criteria. ```java // Search for all messages sent to 123456789. SearchCriteria criteria = new SearchCriteria(); criteria.withSentTo("123456789"); // Limit results to the first 10 matches only. MessageSearchParams params = new MessageSearchParams(); params.withServer("SERVER_ID") .withPage(0) .withItemsPerPage(10); MessageListResult result = mailosaur.messages().search(params, criteria); // Get the most recent message (the first one in the list) MessageSummary latestMessage = result.items().get(0); // Get the full message object Message message = mailosaur.messages().getById(latestMessage.id()); System.out.println(message.text().body()); ``` ```py # Search for all messages sent to 123456789. criteria = SearchCriteria() criteria.sent_to = "123456789" # Limit results to the first 10 matches only. result = mailosaur.messages.search("SERVER_ID", criteria, page=0, items_per_page=10) # Get the most recent message (the first one in the list) latest_message = result.items[0] # Get the full message object message = mailosaur.messages.get_by_id(latest_message.id) print(message.text.body) ``` ```csharp // Search for all messages sent to 123456789. var criteria = new SearchCriteria() { SentTo = "123456789" }; // Limit results to the first 10 matches only. var result = mailosaur.Messages.Search("SERVER_ID", criteria, page: 0, itemsPerPage: 10); // Get the most recent message (the first one in the list) var latestMessage = result.Items[0]; // Get the full message object var message = mailosaur.Messages.GetById(latestMessage.Id); Console.WriteLine(message.Text.Body); ``` ```ruby # Search for all messages sent to 123456789. criteria = Mailosaur::Models::SearchCriteria.new() criteria.sent_to = "123456789" # Limit results to the first 10 matches only. result = mailosaur.messages.search("SERVER_ID", criteria, page: 0, items_per_page: 10) # Get the most recent message (the first one in the list) latest_message = result.items[0] # Get the full message object message = mailosaur.messages.get_by_id(latest_message.id) puts(message.text.body) ``` ```js // Search for all messages sent to 123456789. // Limit results to the first 10 matches only. const result = await mailosaur.messages.search( "SERVER_ID", { sentTo: "123456789", }, { page: 0, itemsPerPage: 10, } ); // Get the most recent message (the first one in the list) const latestMessage = result.items[0]; // Get the full message object const message = await mailosaur.messages.getById(latestMessage.id); console.log(message.text.body); ``` ### List current inbox contents See a full list of everything currently in your inbox. ```java // List the most recent messages MessageListParams params = new MessageListParams(); params.withServer("SERVER_ID"); MessageListResult result = mailosaur.messages().list(params); // Get the most recent message (the first one in the list) MessageSummary latestMessage = result.items().get(0); // Get the full message object Message message = mailosaur.messages().getById(latestMessage.id()); System.out.println(message.text().body()); ``` ```py # List the most recent messages result = mailosaur.messages.list("SERVER_ID") # Get the most recent message (the first one in the list) latest_message = result.items[0] # Get the full message object message = mailosaur.messages.get_by_id(latest_message.id) print(message.text.body) ``` ```csharp // List the most recent messages var result = mailosaur.Messages.List("SERVER_ID"); // Get the most recent message (the first one in the list) var latestMessage = result.Items[0]; // Get the full message object var message = mailosaur.Messages.GetById(latestMessage.Id); Console.WriteLine(message.Text.Body); ``` ```ruby # List the most recent messages result = mailosaur.messages.list("SERVER_ID") # Get the most recent message (the first one in the list) latest_message = result.items[0] # Get the full message object message = mailosaur.messages.get_by_id(latest_message.id) puts(message.text.body) ``` ```js // List the most recent messages const result = await mailosaur.messages.list("SERVER_ID"); // Get the most recent message (the first one in the list) const latestMessage = result.items[0]; // Get the full message object const message = await mailosaur.messages.getById(latestMessage.id); console.log(message.text.body); ``` ## Common test scenarios ### Testing basic properties Once you have fetched an SMS, you can simply test the properties of that text: ```java // Test sender information assertEquals("Support", message.from().get(0).name()); assertEquals("654321", message.from().get(0).phone()); // Test recipient information assertEquals("John Smith", message.to().get(0).name()); assertEquals("1234567890", message.to().get(0).phone()); ``` ```py # Test sender information self.assertEqual("Support", message.sender[0].name) self.assertEqual("654321", message.sender[0].phone) # Test recipient information self.assertEqual("John Smith", message.to[0].name) self.assertEqual("1234567890", message.to[0].phone) ``` ```csharp // Test sender information Assert.Equal("Support", message.From[0].Name); Assert.Equal("654321", message.From[0].Phone); // Test recipient information Assert.Equal("John Smith", message.To[0].Name); Assert.Equal("1234567890", message.To[0].Phone); ``` ```ruby # Test sender information assert_equal("Support", message.from[0].name) assert_equal("654321", message.from[0].phone) # Test recipient information assert_equal("John Smith", message.to[0].name) assert_equal("1234567890", message.to[0].phone) ``` ```js // Test sender information expect(message.from[0].name).toBe("Support"); expect(message.from[0].phone).toBe("654321"); // Test recipient information expect(message.from[0].name).toBe("John Smith"); expect(message.from[0].phone).toBe("1234567890"); ``` ### Testing SMS contents The content of an SMS message is available via the `text.body` property: ```java System.out.println(message.text().body()); // "Hi Jason, ..." ``` ```py print(message.text.body) # "Hi Jason, ..." ``` ```csharp Console.WriteLine(message.Text.Body); // "Hi Jason, ..." ``` ```ruby puts(message.text.body) # "Hi Jason, ..." ``` ```js console.log(message.text.body); // "Hi Jason, ..." ``` ### Testing links Any links that are found in the content of your SMS are automatically available via the `text.links` array: ```java // How many links? System.out.println(message.text().links().size()); // 2 Link firstLink = message.text().links().get(0); assertEquals("Google Search", firstLink.text()); assertEquals("https://www.google.com/", firstLink.href()); ``` ```py # How many links? print(len(message.text.links)) # 2 first_link = message.text.links[0] self.assertEqual("Google Search", first_link.text) self.assertEqual("https://www.google.com/", first_link.href) ``` ```csharp // How many links? Console.WriteLine(message.Text.Links.Count); // 2 var firstLink = message.Text.Links[0]; Assert.Equal("Google Search", firstLink.Text); Assert.Equal("https://www.google.com/", firstLink.Href); ``` ```ruby # How many links? puts(message.text.links.length) # 2 first_link = message.text.links[0] assert_equal("Google Search", first_link.text) assert_equal("https://www.google.com/", first_link.href) ``` ```js // How many links? console.log(message.text.links.length); // 2 const firstLink = message.text.links[0]; expect(firstLink.text).toBe("Google Search"); expect(firstLink.href).toBe("https://www.google.com/"); ``` ### Testing verification codes Codes are automatically extracted from the content of your SMS message. They are then made available via the `text.codes` array: ```java Code otp = message.text().codes().get(0); assertEquals("456812", otp.value()); ``` ```py otp = message.text.codes[0] self.assertEqual("456812", otp.value) ``` ```csharp var otp = message.Text.Codes[0]; Assert.Equal("456812", otp.Value); ``` ```ruby otp = message.text.codes[0] assert_equal("456812", otp.value) ``` ```js const otp = message.text.codes[0]; expect(otp.value).toBe("456812"); ``` ### Replying to an SMS message If your product is capable of handling SMS replies from your customers, you can use Mailosaur’s reply feature to simulate this. When you reply, the SMS is sent back to the phone number it was originally sent to Mailosaur from: ```java MessageReplyOptions options = new MessageReplyOptions(); options.withText("FYI"); mailosaur.messages().reply("MESSAGE_ID", options); ``` ```py options = MessageReplyOptions(text="FYI") mailosaur.messages.reply("MESSAGE_ID", options) ``` ```csharp mailosaur.Messages.Reply("MESSAGE_ID", new MessageReplyOptions() { Text = "FYI" } ); ``` ```ruby options = Mailosaur::Models::MessageReplyOptions.new() options.text = "FYI" mailosaur.messages.reply("MESSAGE_ID", options) ``` ```js await mailosaur.messages.reply("MESSAGE_ID", { text: "FYI", }); ``` | Parameter | Description | | ----------- | ------------------------------------------------------ | | text | Any additional text content to include in the reply | | html | Any additional HTML content to include in the reply | | subject | Optionally override the default subject line | | attachments | Optional attachments (see 'include attachments' above) | ### Forwarding a message to email You can forward messages from your Mailosaur account to external email addresses either one-by-one, or via the creation of automated forwarding rules. Before you can forward messages, **you must set up a [verified external email address](/docs/managing-your-account/external-email-addresses)**, so you can send email to it: ```java MessageForwardOptions options = new MessageForwardOptions(); options.withTo("verified-address@example.com") .withText("FYI"); mailosaur.messages().forward("MESSAGE_ID", options); ``` ```py recipient = "verified-address@example.com" options = MessageForwardOptions(recipient, text="FYI") mailosaur.messages.forward("MESSAGE_ID", options) ``` ```csharp mailosaur.Messages.Forward("MESSAGE_ID", new MessageForwardOptions() { To = "verified-address@example.com", Text = "FYI" } ); ``` ```ruby options = Mailosaur::Models::MessageForwardOptions.new() options.to = 'verified-address@example.com' options.text = 'FYI' mailosaur.messages.forward('MESSAGE_ID', options) ``` ```js await mailosaur.messages.forward("MESSAGE_ID", { to: "verified-address@example.com", text: "FYI", }); ``` | Parameter | Description | | --------- | ------------------------------------------------------------------------------------- | | to | The email address to which the message will be sent. Must be a verified email address | | text | Any additional text content to forward the message with | | html | Any additional HTML content to forward the message with | | subject | Optionally override the default subject line | ## Deleting messages ### Deleting an individual message Permanently deletes a single message. Also deletes any attachments related to the message. This operation cannot be undone: ```java mailosaur.messages().delete("MESSAGE_ID"); ``` ```py mailosaur.messages.delete("MESSAGE_ID") ``` ```csharp mailosaur.Messages.Delete("MESSAGE_ID"); ``` ```ruby mailosaur.messages.delete("MESSAGE_ID") ``` ```js await mailosaur.messages.del("MESSAGE_ID"); ``` ### Delete all messages Permanently deletes all messages held in the specified inbox. Also deletes any attachments related to each message. This operation cannot be undone: ```java mailosaur.messages().deleteAll("SERVER_ID"); ``` ```py mailosaur.messages.delete_all("SERVER_ID") ``` ```csharp mailosaur.Messages.DeleteAll("SERVER_ID"); ``` ```ruby mailosaur.messages.delete_all("SERVER_ID") ``` ```js await mailosaur.messages.deleteAll("SERVER_ID"); ``` ## See also - [Email testing guide](/docs/automation/selenium/email-testing) - [MFA/2FA guide](/docs/authenticator) --- Source: https://mailosaur.com/docs/automation/spam # How to test email spam score Learn how to test the SpamAssassin score of an email with Mailosaur. ## Before you begin The examples shown below are based on two key assumptions: 1. You have already created a basic automated test using our [getting started guides](/docs/automation). 2. You have a chosen assertion library that you will use to test the values shown below. ## Accessing SpamAssassin results This method allows you to perform a SpamAssassin check against an email. The structure returned matches the [spam test object](/docs/api#0-perform-a-spam-test): ```nodejs const result = await mailosaur.analysis.spam(message.id) console.log(result.score) // 0.5 result.spamFilterResults.spamAssassin.forEach(r => { console.log(r.rule) console.log(r.description) console.log(r.score) }) ``` ```cypress cy.mailosaurGetSpamAnalysis(message.id) .then((result) => { result.spamFilterResults.spamAssassin.forEach((rule) => { expect(rule.score).to.be.a('number'); expect(rule.rule).to.be.ok; expect(rule.description).to.be.ok; }) }) ``` ```python result = mailosaur.analysis.spam(message.id) print(result.score) # 0.5 for r in result.spam_filter_results.spam_assassin: print(r.rule) print(r.description) print(r.score) ``` ```java SpamAnalysisResult result = mailosaur.analysis().spam(message.id()); System.out.println(result.score()); // 0.5 result.spamFilterResults().spamAssassin().forEach(r -> { System.out.println(r.rule()); System.out.println(r.description()); System.out.println(r.score()); }); ``` ```csharp var result = mailosaur.Analysis.Spam(message.Id); Console.WriteLine(result.Score); // 0.5 foreach (var r in result.SpamFilterResults.SpamAssassin) { Console.WriteLine(r.Rule); Console.WriteLine(r.Description); Console.WriteLine(r.Score); } ``` ```ruby result = mailosaur.analysis.spam(message.id) puts(result.score) # 0.5 for r in result.spam_filter_results.spam_assassin do puts(r.rule) puts(r.description) puts(r.score) end ``` ```php $result = $mailosaur->analysis->spam($message->id); print($result->score); // 0.5 foreach ($result->spamFilterResults->spamAssassin as &$r) { print($r->rule); print($r->description); print($r->score); } ``` ```go result, _ := m.Analysis.Spam(message.Id) fmt.Println(result.Score) for _, r := range result.SpamFilterResults.SpamAssassin { fmt.Println(r.Rule) fmt.Println(r.Description) fmt.Println(r.Score) } ``` #### See also - [Sending test email](/docs/email-testing/sending-to-mailosaur) - [Selenium quickstart](/docs/automation/selenium/quickstart) --- Source: https://mailosaur.com/docs/automation/testcafe # How to test email and SMS with TestCafe End-to-end testing using TestCafe and email and SMS testing using Mailosaur. Learn how to use TestCafe together with the Mailosaur API. ## What is TestCafe? TestCafe is an easy to use Node.js library for cross-browser testing. TestCafe does not require WebDriver or other testing software, meaning you can get up and running in seconds. As you’re reading this, there is a good chance you know all about TestCafe, but if not, we definitely recommend checking out the [TestCafe documentation](https://testcafe.io/documentation/402635/guides/overview/getting-started) to get up and running. ## What is Mailosaur? Mailosaur lets you automate email and SMS tests as part of your end-to-end QA. This is particularly important for websites and apps that send an email (password resets, account setup, marketing emails, etc.) or SMS message (multi-factor authentication, verification, etc.). Mailosaur gives you an endless set of test email addresses, plus virtual SMTP servers, to use with TestCafe. ## Get Started ### Installation Install the Mailosaur Node.js library via npm or yarn: ```bash npm i -D mailosaur # or yarn add -D mailosaur ``` Then import the library into your code. The value for `YOUR_API_KEY` is covered in the next step ([creating an account](#2-creating-an-account)): ```js const MailosaurClient = require('mailosaur') const mailosaur = new MailosaurClient('YOUR_API_KEY') ``` ### API Reference This library is powered by the Mailosaur [Email & SMS Testing API](/docs/api). You can easily check out the API itself by looking at our [API reference documentation](/docs/api) or via our Postman or Insomnia collections: ![Postman](https://app.getpostman.com/run-collection/6961255-6cc72dff-f576-451a-9023-b82dec84f95d?action=collection%2Ffork&collection-url=entityId%3D6961255-6cc72dff-f576-451a-9023-b82dec84f95d%26entityType%3Dcollection%26workspaceId%3D386a4af1-4293-4197-8f40-0eb49f831325) ![Insomnia](https://insomnia.rest/run/?label=Mailosaur&uri=https%3A%2F%2Fmailosaur.com%2Finsomnia.json) ## Creating an account Create a [free trial account](/app/signup) for Mailosaur via the website. Once you have this, open your inbox from the **Inboxes** section of the left-hand navigation, then click the **Settings** tab. You need the following values: - **Inbox ID** - Every [inbox](/docs/inboxes) has a unique ID. You need this ID whenever you interact with an inbox via the API. - **Inbox Domain** - Every inbox has its own domain name. You'll need this to send email to your inbox. - **API Key** - Get one from the [API Keys](/app/keys) page. You can create an API key per inbox (recommended), or an account-level API key to use across your whole account. [Learn more about API keys](/docs/managing-your-account/api-keys). ## Test email addresses with Mailosaur Mailosaur gives you an **unlimited number of test email addresses** - with no setup or coding required! Here’s how it works: - When you create an account, you are given an inbox. - Every inbox has its own **Inbox Domain** name (e.g. `abc123.mailosaur.net`) - Any email address that ends with `@{YOUR_SERVER_DOMAIN}` will work with Mailosaur without any special setup. For example: - `build-423@abc123.mailosaur.net` - `john.smith@abc123.mailosaur.net` - `rAnDoM63423@abc123.mailosaur.net` - You can create more inboxes when you need them. Each one will have its own domain name. _**Can’t use test email addresses?** You can also [use SMTP to test email](/docs/email-testing/sending-to-mailosaur#0-sending-directly-via-smtp). By connecting your product or website to Mailosaur via SMTP, Mailosaur will catch all email your application sends, regardless of the email address._ ## Find an email In automated tests you will want to wait for a new email to arrive. This library makes that easy with the `messages.get` method. Here’s how you use it: ```js fixture `Mailosaur Example` .page `https://example.mailosaur.com/password-reset`; test('Request a password reset', async t => { const MailosaurClient = require('mailosaur') const mailosaur = new MailosaurClient('API_KEY') // Find these on your inbox's Settings tab const serverId = 'abc123' const serverDomain = 'abc123.mailosaur.net' const testEmailAddress = `testcafe123@${serverDomain}` // Submit the password reset request await t .typeText('#email', testEmailAddress) .click('button[type="submit"]') const searchCriteria = { sentTo: testEmailAddress } const message = await mailosaur.messages.get(serverId, searchCriteria) await t.expect(message.subject) .eql('Set your new password for ACME Product') }) ``` ### What is this code doing? 1. Sets up an instance of `MailosaurClient` with your API key. 2. Waits for an email to arrive at the server with ID `abc123`. 3. Performs an assertion on the subject line of the email. ### My email wasn’t found First, check that the email you sent is visible in the [Mailosaur Dashboard](/app). If it is, the likely reason is that by default, `message.get` only searches emails received by Mailosaur in the last 1 hour. You can override this behavior (see the `receivedAfter` option below), however, we only recommend doing this during setup, as your tests will generally run faster with the default settings: ```js const email = await mailosaur.messages.get( serverId, searchCriteria, // Override receivedAfter to search all messages since Feb 1st { receivedAfter: new Date(2021, 1, 1) } ) ``` ## Find an SMS message **Important:** Trial accounts do not automatically have SMS access. Please contact our support team to enable a trial of SMS functionality. If your account has [SMS Testing](/docs/sms-testing) enabled, you can reserve phone numbers to test with, then use the Mailosaur API in a very similar way to when testing email: ```js // ... const searchCriteria = { sentTo: '4471235554444' } const sms = await mailosaur.messages.get(serverId, searchCriteria) console.log(sms.text.body) ``` ## Testing plain text content Most emails, and all SMS messages, should have a plain text body. Mailosaur exposes this content via the `text.body` property on an email or SMS message: ```js console.log(message.text.body) // "Hi Jason, ..." if (message.text.body.indexOf('Jason') > -1) { console.log('Email contains "Jason"') } ``` ### Extracting verification codes from plain text You may have an email or SMS message that contains an account verification code, or some other one-time passcode. You can extract content like this using a simple regex. Here is how to extract a 6-digit numeric code: ```js console.log(message.text.body) // "Your access code is 243546." const regEx = new RegExp('([0-9]{6})') const matches = regEx.exec(message.text.body) console.log(matches[0]) // "243546" ``` [Read more](/docs/automation/text-content) ## Testing HTML content Most emails also have an HTML body, as well as the plain text content. You can access HTML content in a very similar way to plain text: ```js console.log(message.html.body) // "`) and area (``) elements and makes these available via the `html.links` array. Each link has a text property, representing the display text of the hyperlink within the body, and an href property containing the target URL: ```js // How many links? console.log(message.html.links.length) // 2 const firstLink = message.html.links[0] console.log(firstLink.text) // "Google Search" console.log(firstLink.href) // "https://www.google.com/" ``` **Important:** To ensure you always have valid emails, Mailosaur only extracts links that have been correctly marked up with `` or `` tags. ### Links in plain text (including SMS messages) Mailosaur auto-detects links in plain text content too, which is especially useful for SMS testing: ```js // How many links? console.log(message.text.links.length) // 2 const firstLink = message.text.links[0] console.log(firstLink.href) // "https://www.google.com/" ``` ## Working with attachments If your email includes attachments, you can access these via the `attachments` property: ```js // How many attachments? console.log(message.attachments.length) // 2 ``` Each attachment contains metadata on the file name and content type: ```js const firstAttachment = message.attachments[0] console.log(firstAttachment.fileName) // "contract.pdf" console.log(firstAttachment.contentType) // "application/pdf" ``` The `length` property returns the size of the attached file (in bytes): ```js const firstAttachment = message.attachments[0] console.log(firstAttachment.length) // 4028 ``` ### Writing an attachment to disk ```js const fs = require('fs') // ... const firstAttachment = message.attachments[1] const fileBytes = await mailosaur.files.getAttachment(firstAttachment.id) fs.writeFileSync(firstAttachment.fileName, fileBytes) ``` ## Working with images and web beacons The `html.images` property of a message contains an array of images found within the HTML content of an email. The length of this array corresponds to the number of images found within an email: ```js // How many images in the email? console.log(message.html.images.length) // 1 ``` ### Remotely-hosted images Emails will often contain many images that are hosted elsewhere, such as on your website or product. It is recommended to check that these images are accessible by your recipients. All images should have an alternative text description, which can be checked using the `alt` attribute. ```js const image = message.html.images[0] console.log(image.alt) // "Hot air balloon" ``` ### Triggering web beacons A web beacon is a small image that can be used to track whether an email has been opened by a recipient. Because a web beacon is simply another form of remotely-hosted image, you can use the `src` attribute to navigate to that address: ```js const image = message.html.images[0] console.log(image.src) // "https://example.com/s.png?abc123" // Make an HTTP call to trigger the web beacon await t.page(image.src) ``` ## Spam checking You can perform a [SpamAssassin](https://spamassassin.apache.org) check against an email. The structure returned matches the [spam test object](/docs/api#0-perform-a-spam-test): ```js const result = await mailosaur.analysis.spam(message.id) console.log(result.score) // 0.5 result.spamFilterResults.spamAssassin.forEach(r => { console.log(r.rule) console.log(r.description) console.log(r.score) }) ``` --- Source: https://mailosaur.com/docs/automation/text-content # How to test the text content of email or SMS Learn how to test the text content of email or SMS with Mailosaur. > [!SUCCESS] > Most email sent today is HTML-based, however, an email will often contain a plain text alternative for older mail clients, which is what this page relates to. Learn how to work with the HTML content of an email. ## Before you begin The examples shown below are based on two key assumptions: 1. You have already created a basic automated test using our [getting started guides](/docs/automation). 2. You have a chosen assertion library that you will use to test the values shown below. ## Accessing the text The text content of an email or SMS message can be accessed via the `text.body` property of a message. ```nodejs console.log(message.text.body) // "Hi Jason, ..." ``` ```python print(message.text.body) # "Hi Jason, ..." ``` ```java System.out.println(message.text().body()); // "Hi Jason, ..." ``` ```csharp Console.WriteLine(message.Text.Body); // "Hi Jason, ..." ``` ```ruby puts(message.text.body) # "Hi Jason, ..." ``` ```php print($message->text->body); // "Hi Jason, ..." ``` ```go fmt.Println(message.Text.Body) // "Hi Jason, ..." ``` ## Working with the content This section describes some of the most common use cases related to the content of an email or SMS message. You should also refer to the guides on working with automatically-extracted content such as [links](/docs/automation/links) and [images](/docs/automation/images). ### Checking if message contains a string ```nodejs const containsText = message.text.body.indexOf('Jason') > -1 console.log(containsText) // true ``` ```python contains_text = "Jason" in message.text.body print(contains_text) # true ``` ```java boolean containsText = message.text().body().contains("Jason"); System.out.println(containsText); // true ``` ```csharp Console.WriteLine(message.Text.Body.Contains("Jason")); // true ``` ```ruby contains_text = message.text.body.include? "Jason" puts(contains_text) # true ``` ```php $containsText = strpos($message->text->body, 'Jason') !== false; print($containsText); // 1 ``` ```go containsText := strings.Contains(message.Text.Body, "Jason") fmt.Println(containsText) // true ``` ### Finding a 6-digit code Note: We recommend using Mailosaur’s [built-in verification code detection](/docs/automation/codes). However, you can also write your own regular expressions to extract values from within your content. The example below shows how to extract a 6-digit numeric code from a message. ```nodejs console.log(message.text.body) // "Your access code is 243546." const regEx = new RegExp('([0-9]{6})') const matches = regEx.exec(message.text.body) console.log(matches[0]) // "243546" ``` ```python print(message.text.body) # "Your access code is 243546." match = re.search("([0-9]{6})", message.text.body) print(match.group()) # "243546" ``` ```java System.out.println(message.text().body()); // "Your access code is 243546." Pattern pattern = Pattern.compile(".*([0-9]{6}).*"); Matcher matcher = pattern.matcher(message.text().body()); matcher.find(); System.out.println(matcher.group(1)); // "243546" ``` ```csharp Console.WriteLine(message.Text.Body); // "Your access code is 243546." var matches = Regex.Matches(message.Text.Body, "([0-9]{6})", RegexOptions.IgnoreCase); Console.WriteLine(matches[0]); // "243546" ``` ```ruby puts(message.text.body) # "Your access code is 243546." match = message.text.body.match(/([0-9]{6})) puts(match[0]) # "243546" ``` ```php print($message->text->body); // "Your access code is 243546." preg_match('/([0-9]){6}/', $message->text->body, $matches); print($matches[0]); // "243546" ``` ```go fmt.Println(message.Text.Body) // "Your access code is 243546." r, _ := regexp.Compile("([0-9]{6})") fmt.Println(r.FindString(message.Text.Body)) // "243546" ``` ### Finding an 8-digit alphanumeric code In this example, an 8-digit code, consisting of 2 letters, followed by 6 numbers is extracted. ```nodejs console.log(message.text.body) // "Your access code is QZ524822." const regEx = new RegExp('([A-Z]{2}[0-9]{6})') const matches = regEx.exec(message.text.body) console.log(matches[0]) // "Q2ZH482S" ``` ```python print(message.text.body) # "Your access code is QZ524822." match = re.search("([A-Z]{2}[0-9]{6})", message.text.body) print(match.group()) # "Q2ZH482S" ``` ```java System.out.println(message.text().body()); // "Your access code is QZ524822." Pattern pattern = Pattern.compile(".*([A-Z]{2}[0-9]{6}).*"); Matcher matcher = pattern.matcher(message.text().body()); matcher.find(); System.out.println(matcher.group(1)); // "Q2ZH482S" ``` ```csharp Console.WriteLine(message.Text.Body); // "Your access code is QZ524822." var matches = Regex.Matches(message.Text.Body, "([A-Z]{2}[0-9]{6})", RegexOptions.IgnoreCase); Console.WriteLine(matches[0]); // "Q2ZH482S" ``` ```ruby puts(message.text.body) # "Your access code is QZ524822." match = message.text.body.match(/([A-Z]{2}[0-9]{6})) puts(match[0]) # "Q2ZH482S" ``` ```php print($message->text->body); // "Your access code is QZ524822." preg_match('/([0-9]){6}/', $message->text->body, $matches); print($matches[0]); // "Q2ZH482S" ``` ```go fmt.Println(message.Text.Body) // "Your access code is QZ524822." r, _ := regexp.Compile("([A-Z]{2}[0-9]{6})") fmt.Println(r.FindString(message.Text.Body)) // "Q2ZH482S" ``` --- Source: https://mailosaur.com/docs/automation/webdriverio # How to test email and SMS with WebdriverIO Learn how to test email and SMS messages in WebdriverIO, using Mailosaur. ## What is WebdriverIO? WebdriverIO (sometimes shortened to wdio) is a browser and mobile automation test framework for Node.js. It lets users automate any application written with modern web frameworks such as React, Angular, Polymer or Vue.js, as well as native mobile applications. If you’re reading this, you likely already know how to use WebdriverIO, however, if you are just getting started, take a look at the [awesome getting started guide](https://webdriver.io/docs/gettingstarted) on the WebdriverIO website. ## What is Mailosaur? Mailosaur is a test automation service that lets you test email and SMS messages in frameworks like WebdriverIO, allowing you to create end-to-end tests for account creation, password reset requests, identity verification and more! If you don’t already have one, [create a free trial account](/app/signup) now, and [send an email into Mailosaur](/docs/email-testing/sending-to-mailosaur) first. Once you have this working, you’re ready to start testing! ## Get Started ### Installation Install the Mailosaur Node.js library via npm or yarn: ```bash npm i -D mailosaur # or yarn add -D mailosaur ``` Then import the library into your code. The value for `YOUR_API_KEY` is covered in the next step ([creating an account](#2-creating-an-account)): ```js const MailosaurClient = require('mailosaur') const mailosaur = new MailosaurClient('YOUR_API_KEY') ``` ### API Reference The Node.js library is powered by the Mailosaur [Email & SMS Testing API](/docs/api). You can easily check out the API itself by looking at our [API reference documentation](/docs/api) or via our Postman or Insomnia collections: ![Postman](https://app.getpostman.com/run-collection/6961255-6cc72dff-f576-451a-9023-b82dec84f95d?action=collection%2Ffork&collection-url=entityId%3D6961255-6cc72dff-f576-451a-9023-b82dec84f95d%26entityType%3Dcollection%26workspaceId%3D386a4af1-4293-4197-8f40-0eb49f831325) ![Insomnia](https://insomnia.rest/run/?label=Mailosaur&uri=https%3A%2F%2Fmailosaur.com%2Finsomnia.json) ## Creating an account Create a [free trial account](/app/signup) for Mailosaur via the signup page. Once you have this, open your inbox from the **Inboxes** section of the left-hand navigation, then click the **Settings** tab. You need the following values: - **Inbox ID** - Every [inbox](/docs/inboxes) has a unique ID. You need this ID whenever you interact with an inbox via the API. - **Inbox Domain** - Every inbox has its own domain name. You'll need this to send email to your inbox. - **API Key** - Get one from the [API Keys](/app/keys) page. You can create an API key per inbox (recommended), or an account-level API key to use across your whole account. [Learn more about API keys](/docs/managing-your-account/api-keys). ## Test email addresses with Mailosaur Mailosaur gives you an **unlimited number of test email addresses** to use with WebdriverIO - with no setup or coding required! Here’s how it works: - When you create an account, you are given an inbox. - Every inbox has its own **Inbox Domain** name (e.g. `abc123.mailosaur.net`) - Any email address that ends with `@{YOUR_SERVER_DOMAIN}` will work with Mailosaur without any special setup. For example: - `build-423@abc123.mailosaur.net` - `john.smith@abc123.mailosaur.net` - `rAnDoM63423@abc123.mailosaur.net` - You can create more inboxes when you need them. Each one will have its own domain name. _**Can’t use test email addresses?** You can also [use SMTP to test email](/docs/email-testing/sending-to-mailosaur#0-sending-directly-via-smtp). By connecting your product or website to Mailosaur via SMTP, Mailosaur will catch all email your application sends, regardless of the email address._ ## Find an email In automated tests you will want to wait for a new email to arrive. This library makes that easy with the `messages.get` method. Here’s how you use it: ```js const { remote } = require('webdriverio'); const MailosaurClient = require('mailosaur') const mailosaur = new MailosaurClient('API_KEY') ;(async () => { const browser = await remote({ capabilities: { browserName: 'chrome' } }) await browser.url('https://example.mailosaur.com/password-reset') // Find these on your inbox's Settings tab const serverId = 'abc123' const serverDomain = 'abc123.mailosaur.net' const testEmailAddress = `some-random-string@${serverDomain}` // Submit the password reset request const email = await browser.$('#email') email.setValue(testEmailAddress) const btn = await browser.$('button[type="submit"]') btn.click() const searchCriteria = { sentTo: testEmailAddress } const message = await mailosaur.messages.get(serverId, searchCriteria) console.log(message.subject) await browser.deleteSession() })() ``` ### What is this code doing? 1. Sets up an instance of `MailosaurClient` with your API key. 2. Waits for an email to arrive at the server with ID `abc123`. 3. Performs an assertion on the subject line of the email. ### My email wasn’t found First, check that the email you sent is visible in the [Mailosaur Dashboard](/app). If it is, the likely reason is that by default, `message.get` only searches emails received by Mailosaur in the last 1 hour. You can override this behavior (see the `receivedAfter` option below), however, we only recommend doing this during setup, as your tests will generally run faster with the default settings: ```js const email = await mailosaur.messages.get( serverId, searchCriteria, // Override receivedAfter to search all messages since Feb 1st { receivedAfter: new Date(2021, 1, 1) } ) ``` ## Find an SMS message **Important:** Trial accounts do not automatically have SMS access. Please contact our support team to enable a trial of SMS functionality. If your account has [SMS Testing](/docs/sms-testing) enabled, you can reserve phone numbers to test with, then use the Mailosaur API in a very similar way to when testing email: ```js // ... const searchCriteria = { sentTo: '4471235554444' } const sms = await mailosaur.messages.get(serverId, searchCriteria) console.log(sms.text.body) ``` ## Testing plain text content Most emails, and all SMS messages, should have a plain text body. Mailosaur exposes this content via the `text.body` property on an email or SMS message: ```js console.log(message.text.body) // "Hi Jason, ..." if (message.text.body.indexOf('Jason') > -1) { console.log('Email contains "Jason"') } ``` ### Extracting verification codes from plain text You may have an email or SMS message that contains an account verification code, or some other one-time passcode. You can extract content like this using a simple regex. Here is how to extract a 6-digit numeric code: ```js console.log(message.text.body) // "Your access code is 243546." const regEx = new RegExp('([0-9]{6})') const matches = regEx.exec(message.text.body) console.log(matches[0]) // "243546" ``` [Read more](/docs/automation/text-content) ## Testing HTML content Most emails also have an HTML body, as well as the plain text content. You can access HTML content in a very similar way to plain text: ```js console.log(message.html.body) // "`) and area (``) elements and makes these available via the `html.links` array. Each link has a text property, representing the display text of the hyperlink within the body, and an href property containing the target URL: ```js // How many links? console.log(message.html.links.length) // 2 const firstLink = message.html.links[0] console.log(firstLink.text) // "Google Search" console.log(firstLink.href) // "https://www.google.com/" ``` **Important:** To ensure you always have valid emails, Mailosaur only extracts links that have been correctly marked up with `` or `` tags. ### Links in plain text (including SMS messages) Mailosaur auto-detects links in plain text content too, which is especially useful for SMS testing: ```js // How many links? console.log(message.text.links.length) // 2 const firstLink = message.text.links[0] console.log(firstLink.href) // "https://www.google.com/" ``` ## Working with attachments If your email includes attachments, you can access these via the `attachments` property: ```js // How many attachments? console.log(message.attachments.length) // 2 ``` Each attachment contains metadata on the file name and content type: ```js const firstAttachment = message.attachments[0] console.log(firstAttachment.fileName) // "contract.pdf" console.log(firstAttachment.contentType) // "application/pdf" ``` The `length` property returns the size of the attached file (in bytes): ```js const firstAttachment = message.attachments[0] console.log(firstAttachment.length) // 4028 ``` ### Writing an attachment to disk ```js const fs = require('fs') // ... const firstAttachment = message.attachments[1] const fileBytes = await mailosaur.files.getAttachment(firstAttachment.id) fs.writeFileSync(firstAttachment.fileName, fileBytes) ``` ## Working with images and web beacons The `html.images` property of a message contains an array of images found within the HTML content of an email. The length of this array corresponds to the number of images found within an email: ```js // How many images in the email? console.log(message.html.images.length) // 1 ``` ### Remotely-hosted images Emails will often contain many images that are hosted elsewhere, such as on your website or product. It is recommended to check that these images are accessible by your recipients. All images should have an alternative text description, which can be checked using the `alt` attribute. ```js const image = message.html.images[0] console.log(image.alt) // "Hot air balloon" ``` ### Triggering web beacons A web beacon is a small image that can be used to track whether an email has been opened by a recipient. Because a web beacon is simply another form of remotely-hosted image, you can use the `src` attribute to navigate to that address: ```js const image = message.html.images[0] console.log(image.src) // "https://example.com/s.png?abc123" // Make an HTTP call to trigger the web beacon await t.page(image.src) ``` ## Spam checking You can perform a [SpamAssassin](https://spamassassin.apache.org) check against an email. The structure returned matches the [spam test object](/docs/api#0-perform-a-spam-test): ```js const result = await mailosaur.analysis.spam(message.id) console.log(result.score) // 0.5 result.spamFilterResults.spamAssassin.forEach(r => { console.log(r.rule) console.log(r.description) console.log(r.score) }) ``` ## Library reference Check out all of the methods available to the [Mailosaur Node.js library](/docs/automation/nodejs). --- Source: https://mailosaur.com/docs/compliance # Check email accessibility and compatibility Use Compliance checks to find accessibility and rendering issues in your emails before you send them. ## What are Compliance checks? A well-designed email can still fail the people who receive it. Some recipients use screen readers or other assistive technologies, and the same email can render differently across email clients such as Gmail, Outlook, and Apple Mail. Compliance checks help you find these problems before you send. The **Compliance** panel runs two checks against your email's HTML: - **Accessibility** checks your email against the Web Content Accessibility Guidelines (WCAG), so you can improve usability for everyone, including people using assistive technologies. - **Compatibility** checks how each element of your email renders across email clients and devices. Accessibility and compatibility solve different problems. Accessibility makes sure your email can be used by all recipients; compatibility makes sure it displays correctly everywhere. An email can pass one check and fail the other, so be sure to check both. Both checks run on the same HTML and update automatically when the email loads. > [!INFO] > To check an email's deliverability and spam score as well, with a single score and the problems to fix first, run an [email audit](/docs/email-audit). ## Open the Compliance panel You can run Compliance checks on a received email or on a design you are building. To check a received email: 1. Select **Inboxes** from the main menu, and open one of your inboxes. 2. Open the email you want to check. 3. In the email viewer toolbar, select **Compliance**. To check a design: 1. Navigate to the [Designer](/app/builder) via the main menu. 2. Open the design you want to check. 3. In the toolbar, select **Compliance**. The **Compliance** panel opens with an **Accessibility** section and a **Compatibility** section. > [!INFO] > Compliance checks run on the HTML content of an email, so the **Compliance** button appears only for emails that contain HTML. ## Accessibility checks ### What Mailosaur checks Mailosaur checks your email against WCAG 2.2 to level **AA**. Level AA is the benchmark most organisations use for legal and practical accessibility compliance. (WCAG defines three levels: A is the minimum baseline, AA is the common standard, and AAA is the strictest.) WCAG groups its guidelines under four principles. Your email should be: - **Perceivable** — recipients can see or hear the content. For example, images have alternative (`alt`) text, and text has sufficient colour contrast. - **Operable** — recipients can navigate and use the content, including with a keyboard rather than a mouse. - **Understandable** — the content is clear and predictable, with a defined language and meaningful link text. - **Robust** — the content works across devices and assistive technologies, with valid, well-structured HTML. ### Read the accessibility results The **Accessibility** section summarises your results and shows the percentage of checks your email passes. Results are grouped into three colour-coded tabs: - **Passed** (green) — checks your email meets. - **Inconclusive** (amber) — checks that need a manual review, because they cannot be verified automatically. - **Failed** (red) — checks your email does not meet. Each failed or inconclusive check shows an impact level — **Critical**, **Serious**, **Moderate**, or **Minor** — which ranks issues by severity. Expand a check to see a description, a link to the relevant WCAG criterion, and the affected elements in your HTML. ### Fix an accessibility issue 1. Expand a failed check in the **Accessibility** section. 2. Review the affected HTML elements listed under the check. 3. Update your email's HTML to resolve the issue. 4. Reload the email or design to re-run the check. Common fixes include: - Adding `alt` text to images - Using descriptive link text instead of vague phrases such as "click here" - Increasing colour contrast between text and its background - Using a correct, ordered HTML heading structure If you are unsure how to resolve a check, use its link to the WCAG criterion. The linked guidance explains why the issue matters and how to fix it correctly. > [!INFO] > The ability to jump straight from a check to the matching element in the code editor is coming soon. Today, each check lists the affected HTML so you can find it in your template. > [!INFO] > Accessibility checks are available on the **Core** plan. ## Compatibility checks ### What Mailosaur checks Mailosaur renders each element of your email against 90+ email clients, including Gmail, Outlook, and Apple Mail, and reports how widely each element is supported. Here, an *element* means an HTML element or CSS rule used in your email. This helps you find layout and styling that works in one client but breaks in another. ### Read the compatibility results The **Compatibility** section groups results into three colour-coded tabs: - **Compatible** (green) — the element displays as it was designed to in every client tested. - **Partial** (amber) — the element renders with minor differences in some clients. - **Incompatible** (red) — the element fails to display correctly in at least one major client. Expand an element to see a description, a per-client support breakdown by platform and version, and the occurrences of that element in your email's HTML. The per-client breakdown shows exactly which clients are affected, so you can judge the impact for your own audience. > [!INFO] > Compatibility checks are available on the **Personal** and **Core** plans. ## Common use cases - **Marketing email QA** — validate campaigns before sending to improve reach and reduce accessibility complaints. - **Accessibility compliance** — align emails with WCAG standards and prepare for audits or internal policy reviews. - **Cross-client confidence** — confirm that your email renders correctly across the clients your recipients use. --- Source: https://mailosaur.com/docs/email-audit # Email Audit Check whether an email will reach the inbox, whether everyone can read it, and whether it works in the main email clients, in one report. An email audit checks an email in one of your inboxes for the problems most likely to stop it reaching people, or stop them reading it. It gives the email a score out of 100, and lists the problems to fix first. ## Before you start - Email Audit is available on the **Core** and **Enterprise** plans. - You can audit emails in your inboxes. Email Audit is not available for designs or SMS messages. ## Run an email audit 1. Select **Inboxes** from the main menu, and open one of your inboxes. 2. Open the email you want to check. 3. In the email viewer toolbar, select **Audit**. 4. Click **Run email audit**. Results appear as each check finishes. The score is ready when every check has finished. The audit only runs when you click **Run email audit**. Your results stay in place until you reload the page. To check the email again, click **Run again**. ## What the audit checks | Check | What it looks at | |-------|------------------| | **Deliverability** | Whether mailbox providers trust the email enough to put it in the inbox. Checks SPF, DKIM and DMARC, blocklists, reverse DNS, and the email's headers, including unsubscribe headers. | | **Spam** | How likely spam filters are to flag the email, using its SpamAssassin score and the rules behind it. | | **Accessibility** | Whether everyone can read the email, including people using screen readers. Checks against WCAG 2.2 AA. | | **Client compatibility** | Whether the email's HTML and CSS work in the main email clients. | Accessibility and client compatibility check the email's HTML. If the email has no HTML, they show **Not available**. ## Read the results ### Score and verdict The score summarizes the most serious problems the audit found. The verdict shows what they mean for your email: | Score | Verdict | What it means | |-------|---------|---------------| | 90–100 | **Looks good** | Nothing found will stop the email arriving or being read. | | 70–89 | **Needs attention** | The email should reach the inbox and be readable, but fixing these problems will make it better for some recipients. | | 40–69 | **Urgent fixes** | Some recipients may not get the email, or may not be able to read it. | | 0–39 | **Will be rejected** | Gmail, Yahoo or Outlook reject email with at least one of these problems, so it will not reach some inboxes. | Deliverability problems count for more in the score than problems in the other checks. ### Problem levels Each problem has a level: - **Critical**: mailbox providers reject email with this problem. - **Important**: this problem needs fixing first. - **Worth fixing**: fixing this problem makes the email better for some recipients. - **Good to know**: this problem does not affect the score, but you may want to be aware of it. ### Fix these first **Fix these first** lists up to three of the most serious problems, across all the checks. Each one explains how to fix it. Click **Show me in** to jump to the problem in its check. ### Check details Each check shows its status, its problems and the checks it passed. Click **Show details** to see the data behind the results, such as the blocklists checked or the SpamAssassin rules that matched. To see every check in full, click **Open full screen**. ## Checks left out of the score The score leaves out any check that does not run. A note under the score explains why: - **Couldn't run**: the check failed. Click **Try again** to run that check again. - **Not on your plan**: your plan does not include the check. - **Not available**: the email has no HTML to check. > [!INFO] > Running the audit again does not recalculate the spam score. ## Related pages - [Check email accessibility and compatibility](/docs/compliance) - [Generate email previews](/docs/email-previews/generate-previews) - [Spam testing in automated tests](/docs/automation/spam) --- Source: https://mailosaur.com/docs/email-previews # Email Previews See how your email looks across real email clients and devices, before your customers do. The same email can look very different in Outlook, Gmail, and Apple Mail, and different again in dark mode or on a phone. Email previews show you exactly what your recipients see. Each preview is a screenshot of your email, captured in a real email client on a real device, including PC, Mac, and mobile. > [!LINK](/docs/email-previews/generate-previews) > ### Generate email previews > Generate previews from a design in the Designer, or from an email you send to a Mailosaur inbox. > [!LINK](/docs/email-previews/supported-clients) > ### Supported email clients and devices > The email clients and devices you can generate previews in, and which of them support dark mode. > [!LINK](/docs/email-previews/compare-previews) > ### Compare email previews > Put two previews side by side to spot differences between email clients, devices, or light and dark mode. > [!LINK](/docs/email-previews/presets) > ### Save devices as a preset > Save the email clients and devices you test most often, and select them again in one click. > [!LINK](/docs/email-previews/automate-previews) > ### Automate email previews > Generate email previews from your automated tests, and download each one as an image. > [!LINK](/docs/compliance) > ### Check email accessibility and compatibility > Find accessibility and email client compatibility issues in your emails before you send them. > [!LINK](/docs/email-audit) > ### Email Audit > Check whether an email will reach the inbox, whether everyone can read it, and whether it works in the main email clients, in one report. --- Source: https://mailosaur.com/docs/email-previews/automate-previews # Automate email previews Generate email previews from your automated tests, and download each one as an image. You can generate email previews from your automated tests with the Mailosaur API. For example, each time your tests run, they can capture your password reset email in Outlook, Gmail and Apple Mail. ## Before you begin - The Previews API is available on the Core and Enterprise plans with the Email Previews add-on. It is not available during a free trial. See [Billing and plans](/docs/managing-your-account/billing). - You need an [API key](/docs/managing-your-account/api-keys). - Each preview uses one credit. See [Usage limits](/docs/managing-your-account/usage-limits). The examples below assume you already have a basic automated test that finds an email in Mailosaur. To create one, see our [getting started guides](/docs/automation). ## How it works 1. Your test sends an email to a Mailosaur inbox. 2. Your test finds the email in the inbox, and gets its `id`. 3. Your test asks Mailosaur to generate previews of the email in the email clients you choose. 4. Your test downloads each preview as a PNG image. ## Choose email clients Each email client has a label. The label is made up of the device, the email client, light or dark mode, and the orientation. For example: - `windows-outlook-lightmode-landscape` is Outlook on Windows - `iphone-16-applemail-darkmode-portrait` is Apple Mail on iPhone 16, in dark mode - `android-15-gmail-lightmode-portrait` is Gmail on Android 15 To get the label of every email client you can use, list the email clients: ```nodejs const result = await mailosaur.previews.listEmailClients() result.items.forEach(client => { console.log(client.label) // "iphone-16-applemail-darkmode-portrait" }) ``` ```cypress cy.mailosaurListPreviewEmailClients().then(result => { result.items.forEach(client => { cy.log(client.label) // "iphone-16-applemail-darkmode-portrait" }) }) ``` ```python result = mailosaur.previews.list_email_clients() for client in result.items: print(client.label) # "iphone-16-applemail-darkmode-portrait" ``` ```java EmailClientListResult result = mailosaur.previews().listEmailClients(); for (EmailClient client : result.items()) { System.out.println(client.label()); // "iphone-16-applemail-darkmode-portrait" } ``` ```csharp var result = mailosaur.Previews.ListEmailClients(); foreach (var client in result.Items) { Console.WriteLine(client.Label); // "iphone-16-applemail-darkmode-portrait" } ``` ```ruby result = mailosaur.previews.list_email_clients result.items.each do |client| puts(client.label) # "iphone-16-applemail-darkmode-portrait" end ``` ```php $result = $mailosaur->previews->allEmailClients(); foreach ($result->items as $client) { print($client->label); // "iphone-16-applemail-darkmode-portrait" } ``` ```go result, _ := m.Previews.ListEmailClients() for _, client := range result.Items { fmt.Println(client.Label) // "iphone-16-applemail-darkmode-portrait" } ``` For a readable list, see [Supported email clients and devices](/docs/email-previews/supported-clients). ## Generate previews Pass the `id` of the email, and the labels of the email clients you want: ```nodejs const result = await mailosaur.messages.generatePreviews(message.id, { emailClients: [ 'windows-outlook-lightmode-landscape', 'iphone-16-applemail-darkmode-portrait', 'android-15-gmail-lightmode-portrait' ] }) console.log(result.items.length) // 3 ``` ```cypress cy.mailosaurGenerateEmailPreviews(message.id, { emailClients: [ 'windows-outlook-lightmode-landscape', 'iphone-16-applemail-darkmode-portrait', 'android-15-gmail-lightmode-portrait' ] }).then(result => { cy.log(result.items.length) // 3 }) ``` ```python options = PreviewRequestOptions([ "windows-outlook-lightmode-landscape", "iphone-16-applemail-darkmode-portrait", "android-15-gmail-lightmode-portrait" ]) result = mailosaur.messages.generate_previews(message.id, options) print(len(result.items)) # 3 ``` ```java PreviewRequestOptions options = new PreviewRequestOptions(); options.withEmailClients(Arrays.asList( "windows-outlook-lightmode-landscape", "iphone-16-applemail-darkmode-portrait", "android-15-gmail-lightmode-portrait" )); PreviewListResult result = mailosaur.messages().generatePreviews(message.id(), options); System.out.println(result.items().size()); // 3 ``` ```csharp var options = new PreviewRequestOptions(new List { "windows-outlook-lightmode-landscape", "iphone-16-applemail-darkmode-portrait", "android-15-gmail-lightmode-portrait" }); var result = mailosaur.Messages.GeneratePreviews(message.Id, options); Console.WriteLine(result.Items.Count); // 3 ``` ```ruby options = Mailosaur::Models::PreviewRequestOptions.new([ 'windows-outlook-lightmode-landscape', 'iphone-16-applemail-darkmode-portrait', 'android-15-gmail-lightmode-portrait' ]) result = mailosaur.messages.generate_previews(message.id, options) puts(result.items.length) # 3 ``` ```php $options = new PreviewRequestOptions(array( 'windows-outlook-lightmode-landscape', 'iphone-16-applemail-darkmode-portrait', 'android-15-gmail-lightmode-portrait' )); $result = $mailosaur->messages->generatePreviews($message->id, $options); print(count($result->items)); // 3 ``` ```go result, _ := m.Messages.GeneratePreviews(message.Id, &PreviewRequestOptions{ EmailClients: []string{ "windows-outlook-lightmode-landscape", "iphone-16-applemail-darkmode-portrait", "android-15-gmail-lightmode-portrait", }, }) fmt.Println(len(result.Items)) // 3 ``` The result contains one preview for each email client. Each preview has an `id`, which you use to download it, and an `emailClient`, which is the label of its email client. The request fails, and Mailosaur generates no previews, if: - A label is not valid. The error suggests a valid label where it can. - The previews would take you over your monthly limit. ## Download previews Previews take a short time to render. The download method waits until a preview is ready, then returns it as a PNG image. This example saves each preview to a file named after its email client: ```nodejs const fs = require('fs') // ... for (const preview of result.items) { const file = await mailosaur.files.getPreview(preview.id) fs.writeFileSync(`${preview.emailClient}.png`, file) } ``` ```cypress result.items.forEach(preview => { cy.mailosaurDownloadPreview(preview.id).then(file => { cy.writeFile(`${preview.emailClient}.png`, file, 'binary') }) }) ``` ```python for preview in result.items: file = mailosaur.files.get_preview(preview.id).content with open(preview.email_client + ".png", "wb") as f: f.write(file) ``` ```java for (Preview preview : result.items()) { byte[] file = mailosaur.files().getPreview(preview.id()); Files.write(Paths.get(preview.emailClient() + ".png"), file); } ``` ```csharp foreach (var preview in result.Items) { var file = mailosaur.Files.GetPreview(preview.Id); File.WriteAllBytes($"{preview.EmailClient}.png", file); } ``` ```ruby result.items.each do |preview| file = mailosaur.files.get_preview(preview.id) File.open("#{preview.email_client}.png", 'wb') { |fp| fp.write(file) } end ``` ```php foreach ($result->items as $preview) { $file = $mailosaur->files->getPreview($preview->id); file_put_contents($preview->emailClient . '.png', $file); } ``` ```go for _, preview := range result.Items { file, _ := m.Files.GetPreview(preview.Id) err := os.WriteFile(preview.EmailClient+".png", file, 0644) if err != nil { // handle error } } ``` The download method waits up to 2 minutes for each preview. If a preview is not ready in that time, the method fails with a `preview_timeout` error. ## See your previews in the Dashboard Previews you generate with the API also appear in the Dashboard. Open the email in its inbox, and select **Previews** in the email viewer toolbar. From there, you can [compare two previews side by side](/docs/email-previews/compare-previews). When an email is deleted, its previews are deleted too. ## See also - [Generate email previews](/docs/api#generate-email-previews) in the API reference - [Download an email preview](/docs/api#download-an-email-preview) in the API reference - [Supported email clients and devices](/docs/email-previews/supported-clients) --- Source: https://mailosaur.com/docs/email-previews/compare-previews # Compare email previews Put two previews side by side to spot differences between email clients, devices, or light and dark mode. A layout that works in Apple Mail can break in Outlook. A logo that looks sharp in light mode can disappear in dark mode. Comparing two previews side by side makes these differences easy to see. You can compare any two previews generated for the same email or design. For example: - Outlook on Windows against Apple Mail on Mac - An iPhone against an Android phone - The same device in light mode and in dark mode Comparing previews does not use any credits. ## Before you start You need at least two previews of your email or design. See [Generate email previews](/docs/email-previews/generate-previews). Previews do not have to finish rendering before you compare them. A preview that is still rendering shows its progress until it is ready. ## Select two previews to compare 1. Open your email or design, and go to the **Previews** tab or panel. 2. Open your previews on the **See results** tab. 3. Select the checkbox on the first preview you want to compare. It is labeled **A**. 4. Select the checkbox on the second preview. It is labeled **B**. 5. Click **Compare**. If you select a third preview, Mailosaur removes your earliest selection, so you always have two. Click **Clear** to remove both selections. ## Compare from a single preview When you are already looking at one preview, you can compare it with another without going back to your results. 1. Open a preview. 2. Click **Compare previews**. 3. Under **Compare against**, find the second preview. You can search by device, device setting, or test date. 4. Select the preview to open the comparison. ## Work with a comparison Each side of the comparison has its own controls: - **Zoom in**: click anywhere on a preview to zoom in on that point. Click again to zoom out. Each side zooms and scrolls on its own. - **Change a side**: click the device name above a preview, and choose a different preview. If you choose the preview that is already on the other side, the two sides swap. - **Download a preview**: click the download button above a preview to save it as a PNG image. To download both previews, click **Download both**. On a smaller screen, the two previews appear one above the other instead of side by side. To leave the comparison, click **Back** or press **Esc**. Your two previews stay selected, so you can return to the comparison or change your selection. ## Share a comparison The address in your browser includes the two previews you are comparing. Copy it to send the same comparison to a teammate who has access to the email or design. People who view your previews through a shared link can also compare them, without signing in to Mailosaur. --- Source: https://mailosaur.com/docs/email-previews/generate-previews # Generate email previews Generate previews from a design in the Designer, or from an email you send to a Mailosaur inbox. You can generate previews in two ways: - **From a design**, when you have the HTML for your email and want to test it before it goes anywhere else. - **From an email in an inbox**, when the email already exists in another system, such as your product or your email marketing tool. Each preview uses one credit. The number of previews you can generate each month depends on your plan. See [Usage limits](/docs/managing-your-account/usage-limits). ## Who can generate previews Designs and inboxes both belong to a [project](/docs/projects), and the project controls who can generate previews from them: - **From a design**, you must be an **Editor** or **Admin** of the project the design belongs to, or an Account Administrator. - **From an email in an inbox**, you need write access to that inbox. Every member of the project has it on inboxes that are not restricted. On a restricted inbox you need a **Write** or **Admin** role on the inbox, or you must be an Editor or Admin of its project. A **Viewer** on a restricted inbox can open previews that other people have generated, but cannot generate new ones. See [Permissions](/docs/managing-your-account/permissions). ## Generate previews from a design A design is a standalone piece of email HTML that you test in Mailosaur. Use designs to check the appearance of an email while you create or change it. The Designer shows the designs in the project you are working in. A new design belongs to that project, and stays there. To generate previews from a design: 1. Go to the [Designer](/app/builder) from the main menu. 2. Click **New Design**. 3. Name your design and click **Create**. 4. Paste the HTML you want to test into the editor. 5. In the **Previews** panel, click **Generate previews**. 6. Select the email clients and devices you want to preview. To select a group you use often, click one of your [presets](/docs/email-previews/presets). 7. Click **Generate previews**. Your previews appear on the **See results** tab as they render. ## Generate previews from an email in an inbox When your email is built in another system, send a copy of it to a Mailosaur inbox. Many email marketing tools have a "send a test email" option you can use for this. To generate previews from an email in an inbox: 1. Select **Inboxes** from the main menu, and open one of your inboxes. 2. In the top-right of the inbox, copy the inbox's email address. 3. Send your email to that address. 4. When the email arrives, click it to open the email viewer. 5. In the email viewer toolbar, select **Previews**, then click **Generate previews**. 6. Select the email clients and devices you want to preview. To select a group you use often, click one of your [presets](/docs/email-previews/presets). 7. Click **Generate previews**. Your previews appear on the **See results** tab as they render. ## Generate previews using the API On the Core and Enterprise plans, you can also generate previews of an email in an inbox from your automated tests, using the Mailosaur API. See [Automate email previews](/docs/email-previews/automate-previews). ## Next steps - [Compare two previews side by side](/docs/email-previews/compare-previews) to spot differences between clients. - [Save your device selection as a preset](/docs/email-previews/presets) so you can select it again in one click. - [Automate email previews](/docs/email-previews/automate-previews) to generate previews from your tests. --- Source: https://mailosaur.com/docs/email-previews/presets # Save devices as a preset Save the email clients and devices you test most often, and select them again in one click. Most teams preview the same email clients and devices every time. For example, a release check might always cover Outlook on Windows, Gmail on Android, and Apple Mail on iPhone in both light and dark mode. A preset saves that selection under a name. When you generate previews, click the preset to select all of its devices at once. ## How presets work - A preset is a named list of email clients and devices. Light mode and dark mode, and portrait and landscape, count as separate devices. - Your presets are personal. Other people in your account cannot see or use them. - Your presets are available everywhere you generate previews: in the Designer and in every inbox. - You can make one preset your default. Mailosaur selects its devices each time you generate previews. You manage presets on the **Generate new** tab, which appears when you click **Generate previews**. To use presets, you need permission to generate previews. See [Who can generate previews](/docs/email-previews/generate-previews#who-can-generate-previews). ## Create a preset 1. Click **Generate previews** on a design or an email. 2. Select the email clients and devices you want in the preset. 3. Click **Save as preset**. 4. Enter a name for the preset, such as "Release smoke test". Each preset needs a different name. 5. Click **Save preset**. Your new preset appears under **Presets**, and its devices stay selected. ## Use a preset 1. Click **Generate previews** on a design or an email. 2. Under **Presets**, click the preset you want. Its devices replace your current selection. 3. Add or remove devices if you need to. This does not change the saved preset. 4. Click **Generate previews**. To see which devices a preset includes, hover over it. ## Change the devices in a preset 1. Select the preset under **Presets**. 2. Add or remove devices. Mailosaur shows **Unsaved changes to**, followed by the preset name. 3. Click **Update preset**. To undo your changes instead, open the menu next to **Update preset** and click **Discard changes**. To keep the original preset and save your changes as a new one, open the menu and click **Save as new preset**. ## Rename a preset 1. Select the preset under **Presets**. 2. Click **Rename preset**. 3. Enter the new name, and click **Rename**. ## Set a default preset 1. Select the preset under **Presets**. 2. Open the menu next to **Rename preset**, and click **Make default**. A star marks your default preset. You can only have one default. When you make a different preset the default, the previous one stops being the default. To stop using a default, select the preset, open the menu, and click **Unmark as default**. ## Delete a preset 1. Select the preset under **Presets**. 2. Open the menu next to **Rename preset**, and click **Delete preset**. 3. Click **Delete preset** to confirm. Deleting a preset does not change the devices you have selected. --- Source: https://mailosaur.com/docs/email-previews/supported-clients # Supported email clients and devices The email clients and devices you can generate email previews in, and which of them support dark mode. Each email preview is captured in a real email client on a real device. When you [generate previews](/docs/email-previews/generate-previews), you choose from the clients and devices below. ## Desktop | Email client | Platform | |--------------|----------| | Outlook for Windows | Windows | | Outlook Classic (2021) | Windows | | Outlook Classic (2021) (Dark mode) | Windows | | Thunderbird | Windows | | Apple Mail | macOS | | Apple Mail (Dark mode) | macOS | | Outlook on Mac | macOS | | Outlook on Mac (Dark mode) | macOS | ## Webmail Webmail previews are captured in Chrome. | Email client | |--------------| | Gmail | | Outlook | | AOL | ## iPhone Previews on iPhone use Apple Mail, unless stated otherwise. | Device | |--------| | iPhone Duo | | iPhone Duo (Dark mode) | | iPhone 18 Pro Max | | iPhone 18 Pro Max (Dark mode) | | iPhone 18 Pro | | iPhone 18 Pro (Dark mode) | | iPhone 17 Pro Max | | iPhone 17 Pro Max (Dark mode) | | iPhone 17 Air | | iPhone 17 Air (Dark mode) | | iPhone 17 | | iPhone 17 (Dark mode) | | iPhone 16 Plus | | iPhone 16 Plus (Dark mode) | | iPhone 16 | | iPhone 16 (Dark mode) | | iPhone 16e | | Gmail app on iPhone | | Gmail app on iPhone (Dark mode) | | Outlook app on iPhone | | iPhone 15 Plus | | iPhone 15 Plus (Dark mode) | | iPhone 15 | | iPhone 14 Plus | | iPhone 14 | | iPhone 13 | | iPhone 13 mini | ## iPad Previews on iPad use Apple Mail, in landscape. | Device | |--------| | iPad (10th generation) | | iPad (10th generation) (Dark mode) | | iPad Air (6th generation) | | iPad mini (6th generation) | | iPad Pro (7th generation) | | iPad Pro (7th generation) (Dark mode) | ## Android | Email client | Device | |--------------|--------| | Gmail | Android 15 | | Gmail (Dark mode) | Android 15 | | Gmail | Android 14 | | Gmail (Dark mode) | Android 14 | | Outlook app | Android 15 | | Outlook app (Dark mode) | Android 15 | ## Related pages - [Generate email previews](/docs/email-previews/generate-previews) - [Save devices as a preset](/docs/email-previews/presets) --- Source: https://mailosaur.com/docs/email-testing # Email Testing Learn how to use our virtual SMTP inboxes to test account verification emails, password resets, email tracking, and more. > [!LINK](/docs/email-testing/sending-to-mailosaur) > ### Sending test email to Mailosaur > Discover efficient test email software with Mailosaur. Learn to send test emails seamlessly, create throwaway addresses, and use SMTP directly. Enhance your development process and cut costs. > [!LINK](/docs/email-testing/forwarding) > ### Forwarding email > Learn how to forward individual emails and set up automatic forwarding rules to send emails outside of Mailosaur. > [!LINK](/docs/email-testing/replying) > ### Replying to email > Improve your email testing with Mailosaur's reply function. Simulate user responses seamlessly, enhancing your product's capabilities. > [!LINK](/docs/email-testing/sending-from-mailosaur) > ### Sending email out from Mailosaur > Simulate test email sending with Mailosaur's feature to trigger functionality in your product. Send test emails via the Dashboard or API, including attachments. > [!LINK](/docs/email-testing/pop3-imap) > ### Testing with POP3 & IMAP > Test emails in real-time by connecting to your Mailosaur inbox with POP3 and IMAP. Retrieve and interact with emails using popular email clients. > [!LINK](/docs/email-testing/smtp) > ### Testing with SMTP > Efficiently test your product's emails with Mailosaur's dummy/virtual SMTP. Save costs, prevent unintended customer emails, and easily find SMTP credentials in the Mailosaur Dashboard. > [!LINK](/docs/automation/cypress/email-testing) > ### How to test email with Cypress > Learn how to automate email testing with Cypress by using Mailosaur > [!LINK](/docs/email-testing/nodejs) > ### Email testing with Node.js and Mailosaur > This guide shows you how to easily test email in Node.js and test frameworks like Playwright > [!LINK](/docs/automation/playwright/email-testing) > ### Email testing with Playwright and Mailosaur > This guide shows you how to easily test email in Node.js and Playwright --- Source: https://mailosaur.com/docs/email-testing/deliverability # Overview of deliverability reporting Deliverability reporting (also known as spam testing) helps you understand whether your emails are likely to reach recipients' inboxes or get caught by spam filters. ## Why deliverability matters Even well-designed emails can end up in spam folders if they fail authentication checks, trigger spam filters, or are sent from blocklisted IP addresses. Deliverability reporting identifies these issues so you can fix them before sending to real recipients. ## How it works Deliverability reports are generated from messages captured in your Mailosaur inboxes. When you view a message in the message viewer, you can run a deliverability report from the sidebar. The report analyses the message and returns results across several categories. ## What the report checks | Category | What it checks | |----------|---------------| | **SPF** | Whether the sending server is authorised to send on behalf of the domain | | **DKIM** | Whether the email's digital signature is valid | | **DMARC** | Whether the domain's DMARC policy is configured and the email passes | | **Blocklists** | Whether the sending IP address appears on known spam blocklists | | **SpamAssassin** | Spam score based on SpamAssassin rules | | **Content indicators** | Known spam content patterns detected in the email | | **DNS configuration** | Issues with A, MX, and PTR records for the sending domain | --- Source: https://mailosaur.com/docs/email-testing/forwarding # Forwarding email Learn how to forward individual emails and set up automatic forwarding rules to send messages outside of Mailosaur. Teams often need to forward emails to an email address outside of Mailosaur. For example, to send messages to colleagues for further review/analysis, or to test email handling functionality within a product. You can forward messages from your Mailosaur account to external email addresses either one-by-one, or via the creation of automated forwarding rules. Before you can forward messages, you must first verify an [external email address](/docs/managing-your-account/external-email-addresses) or [domain name](/docs/managing-your-account/managing-domains) so that you can send email to it. ## Forwarding individual emails You can forward emails within the Mailosaur Dashboard, or via the API: 1. Open one of your emails within the Mailosaur Dashboard. 2. Click the Forward button, at the top of the screen. 3. Select the email address to send to. Remember that you can only send to verified external email addresses. 4. Enter the message body for the forwarded email. 5. When you are finished, click **Send**. ```nodejs // MESSAGE_ID: The `id` of the message you want to forward await mailosaur.messages.forward('{MESSAGE_ID}', { to: 'someone@example.com', // must be a verified address html: '

Hello world.

' }); ``` ```cypress // MESSAGE_ID: The `id` of the message you want to forward cy.mailosaurForwardMessage('{MESSAGE_ID}', { to: 'someone@example.com', // must be a verified address html: '

Hello world.

' }); ``` ```python recipient = "someone@example.com" # must be a verified address body = "

Hello world.

" options = MessageForwardOptions(recipient, html=body) # MESSAGE_ID: The `id` of the message you want to forward mailosaur.messages.forward("{MESSAGE_ID}", options) ``` ```java MessageForwardOptions options = new MessageForwardOptions(); options.withTo("someone@example.com") // must be a verified address .withHtml("

Hello world.

"); // MESSAGE_ID: The `id` of the message you want to forward mailosaur.messages().forward("{MESSAGE_ID}", options); ``` ```csharp // MESSAGE_ID: The `id` of the message you want to forward mailosaur.Messages.Forward("{MESSAGE_ID}", new MessageForwardOptions() { To = "someone@example.com", // must be a verified address Html = "

Hello world.

" } ); ``` ```ruby options = Mailosaur::Models::MessageForwardOptions.new() options.to = 'someone@example.com' # must be a verified address options.html = '

Hello world.

' # MESSAGE_ID: The `id` of the message you want to forward mailosaur.messages.forward('{MESSAGE_ID}', options) ``` ```php $options = new MessageForwardOptions(); $options->to = 'someone@example.com'; // must be a verified address $options->html = '

Hello world.

'; // MESSAGE_ID: The `id` of the message you want to forward $mailosaur->messages->forward('{MESSAGE_ID}', $options); ``` ```go // MESSAGE_ID: The `id` of the message you want to forward m.Messages.Forward("{MESSAGE_ID}", &MessageForwardOptions{ To: "someone@example.com", // must be a verified address Html: "

Hello world.

", }) ```
## Automatic forwarding rules You can also set up rules to automatically forward messages that match given criteria. See [Forwarding Rules](/docs/inboxes/forwarding-rules) for full details on creating, editing, and deleting forwarding rules. --- Source: https://mailosaur.com/docs/email-testing/nodejs # How to test email in Node.js Learn how to create email tests in Node.js, using Mailosaur. ## What is Mailosaur? Mailosaur is a service that captures email and SMS messages and lets you test them, both via its web dashboard and via the Mailosaur testing API. If you don’t already have one, [create a free trial account](/app/signup) now, and [send an email into Mailosaur](/docs/email-testing/sending-to-mailosaur) first. Once you have this working, you’re ready to start testing! ## Install the Mailosaur API client Mailosaur provides an official library with everything you need to easily automate email testing in Playwright or any other Node.js tests. ### Install the Mailosaur Node.js library via `npm` ```bash npm install mailosaur ``` ### Import Mailosaur into your project In order to connect to Mailosaur, you need an [API key](/docs/managing-your-account/api-keys). You access your API key in the [account settings](/app/keys) area. In your tests, simply import the Mailosaur library, using your API key: ```js const MailosaurClient = require("mailosaur"); const mailosaur = new MailosaurClient("YOUR_API_KEY_HERE"); ``` ## Basic usage The `messages.get` method automatically waits for the first email to arrive that matches the search criteria you provide. ```js const MailosaurClient = require("mailosaur"); const mailosaur = new MailosaurClient("YOUR_API_KEY_HERE"); const email = await mailosaur.messages.get("SERVER_ID", { sentTo: "anything@SERVER_ID.mailosaur.net", }); console.log(email.subject); ``` To learn about Server IDs, and what to replace `SERVER_ID` with, see [sending email to Mailosaur](/docs/email-testing/sending-to-mailosaur). This example searches for the email address a message was sent to, but you can also search using any of these criteria: | PARAMETER | DESCRIPTION | | ------------ | -------------------------------------------------------------- | | **sentTo** | The full email address to which the target message was sent. | | **sentFrom** | The full email address from which the target message was sent. | | **subject** | Find emails where the subject line contains this text. | | **body** | Finds messages where the message body contains this text. | The `messages.get` method returns the [message object](/docs/api), which contains everything you need to perform in-depth automated testing. ### Increasing the wait time By default, the `messages.get` method will wait for 10 seconds for a matching message to arrive. You can increase this wait time by using the `timeout` option: ```js const email = await mailosaur.messages.get( "SERVER_ID", { sentTo: "anything@SERVER_ID.mailosaur.net", }, { timeout: 20000, // 20 seconds (in milliseconds) } ); console.log(email.subject); ``` ### Searching for older messages By default, the `messages.get` method will only find messages received in the last hour. You can change this by setting the `receivedAfter` option. ```js const testStart = new Date(); // TODO Do something here to send an email into your account // Find any email received after `testStart` was set const email = await mailosaur.messages.get( "SERVER_ID", { sentTo: "anything@SERVER_ID.mailosaur.net", }, { receivedAfter: testStart, } ); console.log(email.subject); ``` ## Test email addresses Because Mailosaur email addresses use a wildcard pattern, all plans give you access to unlimited test email addresses. Any address ending `@YOUR_SERVER_ID.mailosaur.net` will work. You can use your own logic to make up an email address, or use the `servers.generateEmailAddress` helper method to generate a random string for you: ```js // Returns a random email address for this server, e.g. "bgwqj@SERVER_ID.mailosaur.net" const emailAddress = mailosaur.servers.generateEmailAddress("SERVER_ID"); ``` ## Testing basic properties Once you have fetched an email (e.g. using `messages.get`), you can easily test the properties of that email: ```js // Test the email subject line expect(email.subject).toBe("Password reset"); // Test sender information expect(email.from[0].name).toBe("Support"); expect(email.from[0].email).toBe("noreply@acme.com"); // Test recipient information expect(email.to[0].name).toBe("John Smith"); expect(email.to[0].email).toBe("john.smith@example.com"); ``` ### Testing carbon-copy recipients ```js // Carbon copy (CC) recipients expect(email.cc[0].name).toBe("Jane Smith"); expect(email.cc[0].email).toBe("jane.smith@example.com"); // Blind carbon copy (BCC) recipients expect(email.bcc[0].name).toBe("Jill Smith"); expect(email.bcc[0].email).toBe("jill.smith@example.com"); ``` ## Testing email contents Most emails will contain separate HTML and plain text content. You can see below how to test either content type: ### Plain text content ```js // Check that the email contains some text expect(email.text.body).toContain("Expected text"); ``` ### HTML content When testing HTML content, you can perform basic `contains` or `equals` assertions in the same way as with plain text content: ```js // Check that raw HTML contains some expected content expect(email.html.body).toContain("Hello world"); ``` In addition, if you want to perform lookups using CSS selectors, etc. you can use [jsdom](https://github.com/jsdom/jsdom) alongside Mailosaur. You can install jsdom using `npm`: ```sh npm install jsdom ``` Import the library at the start of your test file: ```js const jsdom = require("jsdom"); ``` Now perform HTML operations like this: ```js // Use a CSS selector to find the target element const dom = new JSDOM(email.html.body); const el = dom.window.document.querySelector(".customer-ref"); // Check the contents of the target element expect(el.textContent).toBe("XYZ123"); ``` ## Testing links Any links that are found in the content of your email are instantly available via the `html.links` or `text.links` arrays, depending on which content the link was found in: ```js console.log(`${email.html.links.length} links found in HTML content`); console.log(`${email.text.links.length} links found in plain text content`); // Check the first link found in HTML content expect(email.html.links[0].href).toBe("https://google.com"); expect(email.html.links[0].text).toBe("Google"); ``` ### Navigating to a link If you are using an automation framework like Playwright or Cypress, you can navigate the browser to links within your tests: ```js // Playwright Example: Navigating to a link found in an email await page.goto(email.html.links[0].href); ``` ### Clicking a link If you just need to simulate a link being clicked and do not need to do anything on the target page, you can do this with `https`. Import `https` at the top of your test file: ```js const https = require("https"); ``` Then use this in your test to perform a 'click': ```js // Make an HTTP call to simulate someone clicking a link https.get(email.html.links[0].href, (r) => console.log(r.statusCode)); // 200 ``` ## Testing verification codes Codes are automatically extracted from the content of your email. Just like links, codes are made available via the `html.codes` or `text.codes` arrays, depending on which content the code was found in: ```js console.log(`${email.html.codes.length} codes found in HTML content`); console.log(`${email.text.codes.length} codes found in plain text content`); // Check the first code found in HTML content expect(email.html.codes[0].value).toBe("432123"); ``` ## Testing attachments Any email attachments are made available via the `attachments` array: ```js console.log(`${email.attachments.length} attachments found`); // Get the first attachment const attachment = email.attachments[0]; // Check attachment attributes expect(attachment.fileName).toBe("example.pdf"); expect(attachment.contentType).toBe("application/pdf"); // Check the file size (in bytes) expect(attachment.length).toBe(4028); ``` ### Save an attachment to disk You can download and save attachments using the `files.getAttachment` and `writeFile` methods: ```js console.log(`${email.attachments.length} attachments found`); const file = await mailosaur.files.getAttachment(email.attachments[0].id); // Save file to disk fs.writeFile("some-file.pdf", file, () => console.log("File saved.")); ``` ### Encoding attachments In some scenarios you may need a base64-encoded copy of an attachment. You can achieve this using `toString('base64')`: ```js console.log(`${email.attachments.length} attachments found`); const file = await mailosaur.files.getAttachment(email.attachments[0].id); const base64 = file.toString("base64"); ``` ## Testing images and web beacons Any images found within the HTML content of an email are made available via the `html.images` array: ```js console.log(`${email.html.images.length} images found`); // Get the first attachment const image = email.html.images[0]; // Check image attributes expect(image.src).toBe("https://example.com/balloon.png"); expect(image.alt).toBe("A green hot air balloon in the sky"); ``` To test whether an image is accessible online, or that a [web beacon](https://en.wikipedia.org/wiki/Web_beacon) is working as expected, you can simply perform an HTTP request, using `https`. Import `https` at the top of your test file: ```js const https = require("https"); ``` Then use this in your test to fetch the image: ```js console.log(`${email.html.images.length} images found`); // Get the first attachment const image = email.html.images[0]; // Fetch the image https.get(image.src, (r) => console.log(r.statusCode)); // 200 ``` ## Testing deliverability The `analysis.spam` method runs a SpamAssassin test against an email. This will return an overall SpamAssassin score (see [understand your SpamAssassin score](/blog/understanding-and-improving-your-spamassassin-score)). The lower the score the better and, in most cases, a score higher than 5.0 will result in an email being seen as spam. ```js const result = await mailosaur.analysis.spam(email.id); // Overall SpamAssassin score. In most cases a score of expect(result.score).toBeLessThan(3); result.spamFilterResults.spamAssassin.forEach((r) => { console.log(r.rule); console.log(r.description); console.log(r.score); }); ``` ## List all messages **Recommendation:** We strongly recommend using the [`messages.get` method](#basic-usage) for most use cases. This method has been purposely optimised for the most common automated testing scenarios. If you simply need to list the current emails in an inbox, you can use `messages.list`: ```js const result = await mailosaur.messages.list("SERVER_ID"); console.log(`${result.items.length} messages in inbox`); const match = result.items[0]; expect(match.subject).toBe("Password reset"); // Note: List results only contain summary information. To get // the HTML/text content of an email, use `messages.getById` const email = await mailosaur.messages.getById(match.id); console.log(email.html.body); ``` ## Alternative search for messages **Recommendation:** We strongly recommend using the [`messages.get` method](#basic-usage) for most use cases. This method automatically waits for a matching result, and also returns the whole message object in the result, rather than just a summary. Using the `messages.search` method: ```js const result = await mailosaur.messages.search("SERVER_ID", { sentTo: "anything@SERVER_ID.mailosaur.net", }); console.log(`${result.items.length} matching messages found`); // Get the first result const match = result.items[0]; expect(match.subject).toBe("Password reset"); // Note: Results only contain summary information. To get // the HTML/text content of an email, use `messages.getById` const email = await mailosaur.messages.getById(match.id); console.log(email.html.body); ``` ### Wait for matches to arrive By default the `messages.search` method will only return _current_ matches. By setting the `timeout` option, the method will automatically wait for a match: ```js const result = await mailosaur.messages.search( "SERVER_ID", { sentTo: "anything@SERVER_ID.mailosaur.net", }, { timeout: 10000, // Wait 10 seconds (in milliseconds) for a match } ); ``` ### Testing that no matching messages are found By default, an error will be thrown if no matches are found in time. However, if you are expecting no messages to arrive in a certain period of time, then simply set `errorOnTimeout: false` to prevent an exception being thrown: ```js const result = await mailosaur.messages.search( "SERVER_ID", { sentTo: "anything@SERVER_ID.mailosaur.net", }, { timeout: 10000, errorOnTimeout: false, } ); ``` ## Deleting messages ### Delete all messages To permanently delete all messages held in a specific inbox, use the `messages.deleteAll` method. This also deletes any attachments related to each message. This operation cannot be undone. ```js await mailosaur.messages.deleteAll("SERVER_ID"); ``` ### Deleting an individual message To permanently delete a single message, use `messages.del`. This also deletes any attachments related to the message. This operation cannot be undone. ```js await mailosaur.messages.del("MESSAGE_ID"); ``` ## Download an email (.EML) If you need to download a copy of an email, you can do this using the `files.getEmail` method. This will download a `.EML` format file, allowing you to save an email offline and outside of Mailosaur or any other email software. ```js const file = await mailosaur.files.getEmail(email.id); // Save file to disk fs.writeFile("email.eml", file, () => console.log("Email saved.")); ``` ## Replying to an email If your product is capable of handling email replies from your customers, you can use Mailosaur’s reply feature to simulate such a scenario. When you reply, the email is sent back to the email address it was originally sent to Mailosaur from. Before you can reply, you must first add this address as a [verified external email address](/docs/managing-your-account/external-email-addresses). ```js await mailosaur.messages.reply("MESSAGE_ID", { text: "FYI", }); ``` The options available to use with the `messages.reply` method are: | PARAMETER | DESCRIPTION | | --------------- | ------------------------------------------------------- | | **text** | Any additional text content to reply to the email with. | | **html** | Any additional HTML content to reply to the email with. | | **subject** | Optionally override the default subject line. | | **attachments** | Optional attachments (see 'Include attachments' below). | ### Include attachments You can include attachments in emails sent via the API, by including an array of base64-encoded attachment objects: ```js const attachments = [ { fileName: "cat.png", contentType: "image/png", content: "{BASE64_ENCODED_FILE}", }, ]; await mailosaur.messages.reply("MESSAGE_ID", { to: "verified-address@example.com", subject: "Email from Mailosaur", html: "

Hello world.

", attachments: attachments, }); ``` ## Forwarding an email Teams often need to forward emails to an email address outside of Mailosaur. For example, to send messages to colleagues for further review/analysis, or to test email handling functionality within a product. You can forward messages from your Mailosaur account to external email addresses either one-by-one, or via the creation of automated forwarding rules. Before you can forward messages, you must set up a [verified external email address](/docs/managing-your-account/external-email-addresses), so that you can send email to it. ```js await mailosaur.messages.forward("MESSAGE_ID", { to: "verified-address@example.com", text: "Hello world", }); ``` The options available to use with the `messages.forward` method are: | PARAMETER | DESCRIPTION | | ----------- | ------------------------------------------------------------------------------------ | | **to** | The email address to which the email will be sent. Must be a verified email address. | | **text** | Any additional text content to forward the email with. | | **html** | Any additional HTML content to forward the email with. | | **subject** | Optionally override the default subject line. | ## Sending an email If your product is capable of handling inbound emails, you can use Mailosaur’s sending feature to trigger this functionality in your product. The `messages.create` method creates and sends an email to a [verified external email address](/docs/managing-your-account/external-email-addresses): ```js await mailosaur.messages.create("SERVER_ID", { to: "verified-address@example.com", send: true, subject: "Request", text: "Please can you give us a call back?", }); ``` The options available to use with the `messages.create` method are: | PARAMETER | DESCRIPTION | | --------------- | ------------------------------------------------------------------------------------ | | **send** | This must be set to `true` if you are sending an outbound email. | | **to** | The email address to which the email will be sent. Must be a verified email address. | | **subject** | The email subject line. | | **text** | Any additional text content to send the email with. | | **html** | Any additional HTML content to send the email with. | | **attachments** | Optional attachments (see 'Include attachments' below). | ### Include attachments You can include attachments in emails sent via the API, by including an array of base64-encoded attachment objects: ```js const attachments = [ { fileName: "cat.png", contentType: "image/png", content: "{BASE64_ENCODED_FILE}", }, ]; await mailosaur.messages.create("SERVER_ID", { to: "verified-address@example.com", send: true, subject: "Email from Mailosaur", html: "

Hello world.

", attachments: attachments, }); ``` ## Working with inboxes ### List inboxes Return a list of your inboxes. Inboxes are returned sorted in alphabetical order: ```js const result = await mailosaur.servers.list(); console.log("You have an inbox called:", result.items[0].name); ``` ### Create a new inbox Create a new inbox. Only the `name` property is required to create a new inbox via the API: ```js const result = await mailosaur.servers.create({ name: "My email tests", }); ``` ### Retrieve an inbox Retrieve the detail for a single inbox. Simply supply the unique identifier for the required inbox: ```js const server = await mailosaur.servers.get("SERVER_ID"); console.log(server.name); ``` ### Retrieve the SMTP/POP3 password for an inbox Retrieve the password, for use with SMTP and POP3, for a single inbox. Simply supply the unique identifier for the required inbox: ```js const password = await mailosaur.servers.getPassword("SERVER_ID"); console.log(password); ``` ### Update an inbox Updates a single inbox: ```js retrievedServer.name = "Updated server name"; await mailosaur.servers.update(retrievedServer.id, retrievedServer); ``` ### Delete an inbox Permanently delete an inbox. Also deletes all messages and associated attachments within the inbox. This operation cannot be undone: ```js await mailosaur.servers.del("SERVER_ID"); ``` --- Source: https://mailosaur.com/docs/email-testing/pop3-imap # Testing with POP3 and IMAP Connect to your Mailosaur inbox with POP3 or IMAP to pull emails into an email client or other service. ## Overview If you need to interact with email from a Mailosaur inbox in real-time — for example, inside an email client or another service — you can connect using POP3 or IMAP. To check how your emails look across different email clients and devices, see [Email Previews](/docs/email-previews) instead. ## What is POP3? POP3 (Post Office Protocol version 3) downloads email from a server to a local client. Messages remain on the Mailosaur server by default after download. POP3 is a one-way protocol: it retrieves messages but does not sync changes such as read status or folder moves back to the server. ## What is IMAP? IMAP (Internet Message Access Protocol) provides two-way access to email stored on a server. Unlike POP3, IMAP syncs changes between the client and the server. This makes IMAP a better choice when you access the same inbox from multiple clients or need to keep messages organised on the server. ## When to use POP3 or IMAP - Use **POP3** when you only need to download messages to a single client. - Use **IMAP** when you need to access the inbox from multiple clients or keep server-side state in sync. ## Plan availability **POP3** and **IMAP** require the **Core** or **Enterprise** plan. ## Find your connection details Each inbox has unique POP3 and IMAP credentials. To view them: 1. Navigate to the inbox you want to connect to. 2. Click the **Connect** tab. 3. Copy the POP3 or IMAP credentials shown on screen. For full connection details, including port numbers and security options, see [SMTP, POP3, and IMAP connection details](/docs/inboxes/smtp-pop3-imap). You can use these credentials with any email client or service that supports POP3 or IMAP. --- Source: https://mailosaur.com/docs/email-testing/replying # Replying to email Use the reply function to simulate a user replying to one of your emails. If your product is capable of handling email replies from your customers, you can use Mailosaur’s reply feature to simulate such a scenario. When you reply, the email is sent back to the email address it was originally sent to Mailosaur from. Before you can reply, you must either verify the address as an [external email address](/docs/managing-your-account/external-email-addresses) or verify the [domain name](/docs/managing-your-account/managing-domains) as a whole. ## Replying to a test email You can reply to emails within the Mailosaur Dashboard, or via the API: 1. Open one of your emails within the Mailosaur Dashboard. 2. Click the **Reply** button, at the top of the screen. 3. Enter the message body for the reply. 4. When you are finished, click **Send**. ```nodejs // MESSAGE_ID: The `id` of the message you want to reply to await mailosaur.messages.reply('{MESSAGE_ID}', { html: '

Hello world.

' }); ``` ```cypress // MESSAGE_ID: The `id` of the message you want to reply to cy.mailosaurReplyToMessage('{MESSAGE_ID}', { html: '

Hello world.

' }); ``` ```python body = "

Hello world.

" options = MessageReplyOptions(html=body) # MESSAGE_ID: The `id` of the message you want to reply to mailosaur.messages.reply("{MESSAGE_ID}", options) ``` ```java MessageReplyOptions options = new MessageReplyOptions(); options.withHtml("

Hello world.

"); // MESSAGE_ID: The `id` of the message you want to reply to mailosaur.messages().reply("{MESSAGE_ID}", options); ``` ```csharp // MESSAGE_ID: The `id` of the message you want to reply to mailosaur.Messages.Reply("{MESSAGE_ID}", new MessageReplyOptions() { Html = "

Hello world.

" } ); ``` ```ruby options = Mailosaur::Models::MessageReplyOptions.new() options.html = '

Hello world.

' # MESSAGE_ID: The `id` of the message you want to reply to mailosaur.messages.reply('{MESSAGE_ID}', options) ``` ```php $options = new MessageReplyOptions(); $options->html = '

Hello world.

'; // MESSAGE_ID: The `id` of the message you want to reply to $mailosaur->messages->reply('{MESSAGE_ID}', $options); ``` ```go // MESSAGE_ID: The `id` of the message you want to reply to m.Messages.Reply("{MESSAGE_ID}", &MessageReplyOptions{ Html: "

Hello world.

", }) ```
## Attachments You can include attachments in replies requested via the API, by including an array of base64-encoded attachment objects: ```nodejs const attachments = [{ fileName: 'cat.png', contentType: 'image/png', content: '{BASE64_ENCODED_FILE}' }]; await mailosaur.messages.reply('{MESSAGE_ID}', { html: '

Hello world.

', attachments: attachments }); ``` ```cypress const attachments = [{ fileName: 'cat.png', contentType: 'image/png', content: '{BASE64_ENCODED_FILE}' }]; cy.mailosaurReplyToMessage('{MESSAGE_ID}', { html: '

Hello world.

', attachments: attachments }); ``` ```python attachment = Attachment() attachment.file_name = "cat.png" attachment.content_type = "image/png" attachment.content = "{BASE64_ENCODED_FILE}" attachments = [attachment] body = "

Hello world.

" options = MessageReplyOptions(html=body, attachments=attachments) mailosaur.messages.reply("{MESSAGE_ID}", options) ``` ```java Attachment attachment = new Attachment(); attachment.withFileName("cat.png"); attachment.withContentType("image/png"); attachment.withContent("{BASE64_ENCODED_FILE}"); MessageReplyOptions options = new MessageReplyOptions(); options.withHtml("

Hello world.

") .withAttachments(Arrays.asList(new Attachment[] { attachment })); mailosaur.messages().reply("{MESSAGE_ID}", options); ``` ```csharp var attachment = new Attachment() { FileName = "cat.png", ContentType = "image/png", Content = "{BASE64_ENCODED_FILE}" }; mailosaur.Messages.Reply("{MESSAGE_ID}", new MessageReplyOptions() { Html = "

Hello world.

", Attachments = new List() { attachment } } ); ``` ```ruby attachment = Mailosaur::Models::Attachment.new() attachment.file_name = 'cat.png' attachment.content_type = 'image/png' attachment.content = '{BASE64_ENCODED_FILE}' options = Mailosaur::Models::MessageReplyOptions.new() options.html = '

Hello world.

' options.attachments = [attachment] mailosaur.messages.reply('{MESSAGE_ID}', options) ``` ```php $attachment = new Attachment((object)[ "fileName" => "cat.png", "contentType" => "image/png", "content" => "{BASE64_ENCODED_FILE}" ]); $options = new MessageReplyOptions(); $options->html = '

Hello world.

'; $options->attachments = [$attachment]; $mailosaur->messages->reply('{MESSAGE_ID}', $options); ``` ```go var attachment = Attachment{ FileName: "cat.png", ContentType: "image/png", Content: "{BASE64_ENCODED_FILE}", } m.Messages.Reply("{MESSAGE_ID}", &MessageReplyOptions{ Html: "

Hello world.

", Attachments: []Attachment{attachment}, }) ``` The `content` property of an attachment should be the base64-encoded content of the file you want to attach. Here’s an example of how to base64-encode a file: ```nodejs const fs = require('fs'); // ... const buffer = fs.readFileSync('/path/to/file.txt'); const content = buffer.toString('base64'); ``` ```python import base64 # ... file = open('/path/to/file.txt', 'rb') content = base64.b64encode(file.read()).decode('ascii') ``` ```java byte[] data = Files.readAllBytes(Paths.get("file.txt")); String content = new String(Base64.getEncoder().encode(data)); ``` ```csharp var data = File.ReadAllBytes("/path/to/file.txt"); var content = Convert.ToBase64String(data); ``` ```ruby require 'base64' # ... data = File.open('/path/to/file.txt').read content = Base64.encode64(data) ``` ```php $data = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'path/to/file.txt'); $content = base64_encode($data); ``` ```go data, _ := ioutil.ReadFile("/path/to/file.txt") content := base64.StdEncoding.EncodeToString(data) ``` --- Source: https://mailosaur.com/docs/email-testing/sending-from-mailosaur # Sending email out from Mailosaur Use the sending function in Mailosaur to simulate someone sending an email to your product. If your product is capable of handling inbound emails, you can use Mailosaur’s sending feature to trigger this functionality in your product. Before you can send emails, you must first verify an [external email address](/docs/managing-your-account/external-email-addresses) or [domain name](/docs/managing-your-account/managing-domains) so that you can send email to it. ## Sending an email to start a test You can send emails within the Mailosaur Dashboard, or via the API: 1. In the left-hand navigation, locate the **Inboxes** section. 2. Click on the name of an inbox. 3. Click on **Compose** at the top of the page. 4. Select the email address to send to. You can only send to [verified external email addresses](/docs/managing-your-account/external-email-addresses). 5. Enter the subject and message body for the email. 6. When you are finished, click **Send**. ```nodejs await mailosaur.messages.create('{SERVER_ID}', { to: 'someone@example.com', // must be a verified address subject: 'Email from Mailosaur', html: '

Hello world.

', send: true }); ``` ```cypress cy.mailosaurCreateMessage('{SERVER_ID}', { to: 'someone@example.com', // must be a verified address subject: 'Email from Mailosaur', html: '

Hello world.

', send: true }); ``` ```python recipient = "someone@example.com" # must be a verified address subject = "Email from Mailosaur" body = "

Hello world.

" options = MessageCreateOptions( recipient, True, subject, html=body ) mailosaur.messages.create("{SERVER_ID}", options) ``` ```java MessageCreateOptions options = new MessageCreateOptions(); options.withTo("someone@example.com") // must be a verified address .withSubject("Email from Mailosaur") .withHtml("

Hello world.

") .withSend(true); mailosaur.messages().create("{SERVER_ID}", options); ``` ```csharp mailosaur.Messages.Create("{SERVER_ID}", new MessageCreateOptions() { To = "someone@example.com", // must be a verified address Subject = "Email from Mailosaur", Html = "

Hello world.

", Send = true } ); ``` ```ruby options = Mailosaur::Models::MessageCreateOptions.new() options.to = 'someone@example.com' # must be a verified address options.subject = 'Email from Mailosaur' options.html = '

Hello world.

' options.send = true mailosaur.messages.create('{SERVER_ID}', options) ``` ```php $options = new MessageCreateOptions(); $options->to = 'someone@example.com'; // must be a verified address $options->subject = 'Email from Mailosaur'; $options->html = '

Hello world.

'; $options->send = TRUE; $mailosaur->messages->create('{SERVER_ID}', $options); ``` ```go m.Messages.Create("{SERVER_ID}", &MessageCreateOptions{ To: "someone@example.com", // must be a verified address Subject: "Email from Mailosaur", Html: "

Hello world.

", Send: true, }) ```
## Attachments You can include attachments in emails sent via the API, by including an array of base64-encoded attachment objects: ```nodejs const attachments = [{ fileName: 'cat.png', contentType: 'image/png', content: '{BASE64_ENCODED_FILE}' }]; await mailosaur.messages.create('{SERVER_ID}', { to: 'someone@example.com', // must be a verified address subject: 'Email from Mailosaur', html: '

Hello world.

', send: true, attachments: attachments }); ``` ```cypress const attachments = [{ fileName: 'cat.png', contentType: 'image/png', content: '{BASE64_ENCODED_FILE}' }]; cy.mailosaurCreateMessage('{SERVER_ID}', { to: 'someone@example.com', // must be a verified address subject: 'Email from Mailosaur', html: '

Hello world.

', send: true, attachments: attachments }); ``` ```python attachment = Attachment() attachment.file_name = "cat.png" attachment.content_type = "image/png" attachment.content = "{BASE64_ENCODED_FILE}" attachments = [attachment] recipient = "someone@example.com" # must be a verified address subject = "Email from Mailosaur" body = "

Hello world.

" options = MessageCreateOptions( recipient, True, subject, html=body, attachments=attachments ) mailosaur.messages.create("{SERVER_ID}", options) ``` ```java Attachment attachment = new Attachment(); attachment.withFileName("cat.png"); attachment.withContentType("image/png"); attachment.withContent("{BASE64_ENCODED_FILE}"); MessageCreateOptions options = new MessageCreateOptions(); options.withTo("someone@example.com") // must be a verified address .withSubject("Email from Mailosaur") .withHtml("

Hello world.

") .withSend(true) .withAttachments(Arrays.asList(new Attachment[] { attachment })); mailosaur.messages().create("{SERVER_ID}", options); ``` ```csharp var attachment = new Attachment() { FileName = "cat.png", ContentType = "image/png", Content = "{BASE64_ENCODED_FILE}" }; mailosaur.Messages.Create("{SERVER_ID}", new MessageCreateOptions() { To = "someone@example.com", // must be a verified address Subject = "Email from Mailosaur", Html = "

Hello world.

", Send = true, Attachments = new List() { attachment } } ); ``` ```ruby attachment = Mailosaur::Models::Attachment.new() attachment.file_name = 'cat.png' attachment.content_type = 'image/png' attachment.content = '{BASE64_ENCODED_FILE}' options = Mailosaur::Models::MessageCreateOptions.new() options.to = 'someone@example.com' # must be a verified address options.subject = 'Email from Mailosaur' options.html = '

Hello world.

' options.send = true options.attachments = [attachment] mailosaur.messages.create('{SERVER_ID}', options) ``` ```php $attachment = new Attachment((object)[ "fileName" => "cat.png", "contentType" => "image/png", "content" => "{BASE64_ENCODED_FILE}" ]); $options = new MessageCreateOptions(); $options->to = 'someone@example.com'; // must be a verified address $options->subject = 'Email from Mailosaur'; $options->html = '

Hello world.

'; $options->send = TRUE; $options->attachments = [$attachment]; $mailosaur->messages->create('{SERVER_ID}', $options); ``` ```go var attachment = Attachment{ FileName: "cat.png", ContentType: "image/png", Content: "{BASE64_ENCODED_FILE}", } m.Messages.Create("{SERVER_ID}", &MessageCreateOptions{ To: "someone@example.com", // must be a verified address Subject: "Email from Mailosaur", Html: "

Hello world.

", Send: true, Attachments: []Attachment{attachment}, }) ``` The `content` property of an attachment should be the base64-encoded content of the file you want to attach. Here’s an example of how to base64-encode a file: ```nodejs const fs = require('fs'); // ... const buffer = fs.readFileSync('/path/to/file.txt'); const content = buffer.toString('base64'); ``` ```python import base64 # ... file = open('/path/to/file.txt', 'rb') content = base64.b64encode(file.read()).decode('ascii') ``` ```java byte[] data = Files.readAllBytes(Paths.get("file.txt")); String content = new String(Base64.getEncoder().encode(data)); ``` ```csharp var data = File.ReadAllBytes("/path/to/file.txt"); var content = Convert.ToBase64String(data); ``` ```ruby require 'base64' # ... data = File.open('/path/to/file.txt').read content = Base64.encode64(data) ``` ```php $data = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'path/to/file.txt'); $content = base64_encode($data); ``` ```go data, _ := ioutil.ReadFile("/path/to/file.txt") content := base64.StdEncoding.EncodeToString(data) ``` --- Source: https://mailosaur.com/docs/email-testing/sending-to-mailosaur # Sending test email to Mailosaur Learn how to send emails to Mailosaur for testing and demonstration purposes. ## Before you begin 1. If you don’t already have one, [create a Mailosaur account](/app/signup). 2. You will also need to choose what [inbox](/docs/inboxes) you want to send email to. Inboxes allow you to group tests together (for example, by project, environment, team, etc.). ## Test email addresses When developing and testing products, you will often need a set of throwaway email addresses to test features, workflows, and email content itself. Every Mailosaur plan provides an unlimited number of fully-functional email addresses to test with. ### How do I create test email addresses? You don't need to create email addresses. Instead, every inbox within your account has its own, unique domain name, and any email sent to this domain will be captured. For example, if your inbox had the domain `abcd1234.mailosaur.net`, then every one of these email addresses will work, with no setup required: ```bash # Using build numbers build-56@abcd1234.mailosaur.net build-58@abcd1234.mailosaur.net # Using random user names jill.doe@abcd1234.mailosaur.net jack.smith@abcd1234.mailosaur.net # Using a random string 405fca91@abcd1234.mailosaur.net ``` > [!INFO] > **Testing a platform that does not allow subdomains?** Some signup forms and applications reject email addresses that contain a subdomain. In that case, put the inbox ID in the local part of the address instead, just before the `@`. For example, `build-56.abcd1234@mailosaur.net` reaches the same inbox as `build-56@abcd1234.mailosaur.net`. Both formats work in exactly the same way. You can make up an email address pattern that works for your needs. However, if you just want a random address each time, Mailosaur’s [client libraries](/docs/automation) each provide a helper method to generate one for you. You can use these addresses in the same way you would any other email address. ### Locating the domain name for an inbox You can locate the domain name of an inbox by following these steps: 1. In the left-hand navigation, locate the **Inboxes** section. 2. Click the name of the inbox you want to use. 3. In the page that appears, the inbox domain is shown in the top-right corner of the screen. ## Sending directly via SMTP Every Mailosaur inbox is a full-featured virtual email server. This means that instead of using test email addresses, you can point your product [directly to your inbox via SMTP](/docs/email-testing/smtp). This is useful in cases where you want to prevent staging environments from sending email to real customers. It is also a great way of reducing development costs, as you do not need to pay to send test emails via your regular Email Service Provider (ESP) on staging environments. Check out our [guide on testing directly via SMTP](/docs/email-testing/smtp). --- Source: https://mailosaur.com/docs/email-testing/smtp # Testing with SMTP Send email directly to Mailosaur via SMTP to capture every message your product sends. ## Why send via SMTP? Each Mailosaur inbox has its own SMTP server. Pointing your application at this server means every email it sends is captured inside Mailosaur, regardless of the recipient address. This is useful when you want to: - **Avoid email service provider costs.** Sending thousands of test emails through a provider such as SendGrid or Amazon SES adds unnecessary cost. Providers also queue messages and send them in batches, which slows delivery. - **Prevent emails reaching real customers.** In development and staging environments, connecting to Mailosaur ensures no email is accidentally delivered to an external recipient. ## Find your SMTP credentials Each inbox has a unique SMTP username and password. To view them: 1. Navigate to the inbox you want to use. 2. Click the **Connect** tab. 3. Copy the SMTP credentials shown on screen. For full connection details, including port numbers and security options, see [SMTP, POP3, and IMAP connection details](/docs/inboxes/smtp-pop3-imap). ## Send email via SMTP The following examples show how to send email directly to Mailosaur. Replace `SERVER_ID` and `SMTP_PASSWORD` with the credentials from your inbox. ```nodejs const nodemailer = require('nodemailer'); (async () => { const transport = nodemailer.createTransport({ service: 'Mailosaur', auth: { user: 'SERVER_ID@mailosaur.net', pass: 'SMTP_PASSWORD' } }); await transport.sendMail({ subject: 'A test email', from: 'Our Company ', to: 'Test User ', html: '

Hello world.

', text: 'Hello world.' }); })(); ``` ```python import smtplib sender = "Our Company " recipient = "Test User " message = f"""\ Subject: A test email To: {recipient} From: {sender} Hello world.""" with smtplib.SMTP("smtp.mailosaur.net", 2525) as server: server.login("SERVER_ID@mailosaur.net", "SMTP_PASSWORD") server.sendmail(sender, recipient, message) ``` ```java // Uses javax.mail Properties props = new Properties(); props.put("mail.smtp.host", "smtp.mailosaur.net"); props.put("mail.smtp.port", "2525"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.ssl.protocols", "TLSv1.2"); props.put("mail.smtp.ssl.trust", "smtp.mailosaur.net"); Session session = Session.getInstance(props, new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("SERVER_ID@mailosaur.net", "SMTP_PASSWORD"); } }); MimeMessage message = new MimeMessage(session); message.setSubject("A test email"); message.setFrom(new InternetAddress("Our Company ")); message.setRecipient(MimeMessage.RecipientType.TO, new InternetAddress("Test User ")); MimeBodyPart mimeBodyPart = new MimeBodyPart(); mimeBodyPart.setContent("

Hello world.

", "text/html; charset=utf-8"); Multipart multipart = new MimeMultipart(); multipart.addBodyPart(mimeBodyPart); message.setContent(multipart); session.getTransport("smtp").send(message); ``` ```csharp using MimeKit; using MailKit.Security; using MimeKit.Text; var message = new MimeMessage(); message.From.Add(new MailboxAddress("Our Company", "from@example.com")); message.To.Add(new MailboxAddress("Test User", "to@example.com")); message.Subject = "A test email"; message.Body = new TextPart(TextFormat.Html) { Text = "

Hello world.

" }; using (var emailClient = new MailKit.Net.Smtp.SmtpClient()) { emailClient.Connect("smtp.mailosaur.net", 2525, SecureSocketOptions.StartTls) emailClient.Authenticate("SERVER_ID@mailosaur.net", "SMTP_PASSWORD"); emailClient.Send(message); emailClient.Disconnect(true); } ``` ```ruby require 'net/smtp' message = < To: Test User Subject: A test email Hello world. MESSAGE_END Net::SMTP.start( 'smtp.mailosaur.net', 2525, 'smtp.mailosaur.net', 'SERVER_ID@mailosaur.net', 'SMTP_PASSWORD', :cram_md5 ) do |smtp| smtp.send_message message, 'from@example.com', 'to@example.com' end ``` ```php // Install with `composer require nette/mail` require_once('vendor/autoload.php'); $smtp = new Nette\Mail\SmtpMailer([ 'host' => 'smtp.mailosaur.net', 'port' => 2525, 'username' => 'SERVER_ID@mailosaur.net', 'password' => 'SMTP_PASSWORD', 'secure' => 'starttls', ]); $message = new Nette\Mail\Message; $message->setFrom('Our Company ') ->addTo('Test User ') ->setSubject('A test email') ->setHtmlBody('

Hello world.

'); $smtp->send($message); ``` ```go import ( "fmt" "log" "net/smtp" ) func main() { from := "from@example.com" to := []string{ "to@example.com", } msg := []byte("From: Our Company \r\n" + "To: Test User \r\n" + "Subject: A test email\r\n\r\n" + "Hello world.\r\n" ) auth := smtp.CRAMMD5Auth("INBOX_ID@mailosaur.net", "SMTP_PASSWORD") err := smtp.SendMail("smtp.mailosaur.net:2525", auth, from, to, msg) if err != nil { log.Fatal(err) } fmt.Println("Mail sent successfully!") } ``` --- Source: https://mailosaur.com/docs/inboxes # Inboxes overview An inbox is one of the core building blocks of Mailosaur. It captures emails and SMS messages, groups your tests and settings, and manages access for your team. > [!INFO] > From time-to-time you'll see inboxes also referred to as "servers". The terms are interchangeable. ## How inboxes work Each inbox has a unique domain name in the format `INBOX_ID.mailosaur.net`. Any email address that uses this domain automatically works — there is no need to create or configure individual email addresses. For example, if your inbox domain is `abc123.mailosaur.net`, you can send to `test@abc123.mailosaur.net`, `signup@abc123.mailosaur.net`, or any other address on the domain. > [!INFO] > If the platform you are testing does not allow subdomains in email addresses, you can put the inbox ID in the local part instead. For example, `test.abc123@mailosaur.net` reaches the same inbox as `test@abc123.mailosaur.net`. See [Sending test email to Mailosaur](/docs/email-testing/sending-to-mailosaur) for more detail. Messages sent to an inbox are only visible within that inbox. You cannot view messages across multiple inboxes at the same time. You can also use a custom domain for inbound email instead of the default `mailosaur.net` domain. See [External domains](/docs/managing-your-account/managing-domains) for details. ## What is an inbox ID (or server ID) Each inbox has a unique identifier. This is used when communicating with the Mailosaur API. You can find your inbox ID (a.k.a. server ID) by typing the name of the inbox into the search bar in the Mailosaur Dashboard. ## Which project an inbox belongs to Every inbox belongs to a project, which controls who can see it. Every member of a project can see the inboxes in that project. See [Projects](/docs/projects). ## What inboxes contain An inbox groups the following together: - **Messages** — Emails and SMS messages captured by the inbox - **Phone numbers** — SMS phone numbers linked to the inbox - **Connection details** — SMTP, POP3, and IMAP credentials for connecting to the inbox - **Forwarding rules** — Rules that automatically forward emails matching given criteria - **Access settings** — Controls for restricting who can access the inbox ## Inbox limits The number of inboxes available to your account is determined by your plan. If you need more inboxes, contact the [Mailosaur sales team](/contact). ## Related pages - [Projects](/docs/projects) - [Create an inbox](/docs/inboxes/create-an-inbox) - [Inbox settings](/docs/inboxes/inbox-settings) - [Inbox usage limits](/docs/inboxes/usage-limits) - [Manage inbox access](/docs/inboxes/manage-inbox-access) - [SMTP, POP3, and IMAP connection details](/docs/inboxes/smtp-pop3-imap) - [Inbox forwarding rules](/docs/inboxes/forwarding-rules) - [Delete an inbox](/docs/inboxes/delete-an-inbox) --- Source: https://mailosaur.com/docs/inboxes/create-an-inbox # Create an inbox Create a new inbox to start capturing emails and SMS messages. > [!INFO] > You cannot create additional inboxes on the **Personal** plan. Upgrade to **Core** or **Enterprise** to create more inboxes. ## Before you get started - You must be an **Editor** or **Admin** of the project you are creating the inbox in, or an Account Administrator. ## Create an inbox in the Dashboard 1. In the left-hand navigation, locate the **Inboxes** section. 2. Click the **+** icon, or click the **Inboxes** section title and select **New inbox**. 3. In the dialog that appears, enter a name for your inbox. 4. Click **Create**. Your new inbox is assigned a unique domain name (e.g. `INBOX_ID.mailosaur.net`). You can immediately start sending emails to any address on that domain. ## Which project the inbox belongs to Every inbox belongs to a project. The create dialog includes a **Project** field, which defaults to the project you are working in, shown in the project switcher at the top of the left-hand navigation. See [Projects](/docs/projects). To configure settings such as message retention or Performance mode after creation, see [Inbox settings](/docs/inboxes/inbox-settings). ## Create an inbox via the API Send a `POST` request to the servers endpoint: ```bash curl -X POST \ -u "key:YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"name": "My Inbox"}' \ "https://mailosaur.com/api/servers" ``` Replace `YOUR_API_KEY` with your API key. > [!WARNING] > Inbox-restricted API keys cannot create inboxes. Use a standard API key for this operation. --- Source: https://mailosaur.com/docs/inboxes/delete-an-inbox # Delete an inbox Deleting an inbox permanently removes it and all of its messages. This action cannot be undone. ## Delete an inbox in the Dashboard 1. Navigate to the inbox you want to delete. 2. Click the **Settings** tab. 3. Scroll to the bottom and click **Delete**. 4. Confirm the deletion. ## Delete an inbox via the API Send a `DELETE` request to the servers endpoint: ```bash curl -X DELETE \ -u "key:YOUR_API_KEY" \ "https://mailosaur.com/api/servers/SERVER_ID" ``` Replace `YOUR_API_KEY` with your API key and `SERVER_ID` with the inbox ID. > [!WARNING] > Inbox-restricted API keys cannot delete inboxes. Use a standard API key for this operation. ## What happens when you delete an inbox - All messages in the inbox are permanently deleted. - Any phone numbers linked to the inbox are unlinked. - Any forwarding rules configured on the inbox are deleted. - The inbox's unique domain and ID are released and cannot be recovered. --- Source: https://mailosaur.com/docs/inboxes/forwarding-rules # Forwarding Rules Forwarding rules automatically forward emails or SMS messages that match given criteria to an external email address. The original message remains in your inbox. > [!WARNING] > Forwarding Rules require the **Core** or **Enterprise** plan. ## Before you get started The forwarding destination must be either: - A verified [external email address](/docs/managing-your-account/external-email-addresses), or - An address on a verified [external domain](/docs/managing-your-account/managing-domains) ## View forwarding rules 1. Navigate to the inbox you want to configure. 2. Click the **Forwarding Rules** tab. Existing rules are displayed on screen, each with **Edit rule** and **Delete** options. ## Create a forwarding rule 1. Navigate to the inbox's **Forwarding Rules** tab. 2. Click **Add new rule**. 3. Under **When all these conditions are met**, click **Add condition**. 4. Select a property: **Sent from**, **Sent to**, or **Subject**. 5. Choose an operator: **Contains**, **Equals**, **Starts with**, or **Ends with**. 6. Enter the value to match against. 7. To add more conditions, click **Add condition** again. All conditions must be met for the rule to trigger. 8. Under **Forward the message to**, enter the destination email address. 9. Click **Create**. To remove a condition before saving, click the **X** icon next to it. ## Edit a forwarding rule 1. Navigate to the inbox's **Forwarding Rules** tab. 2. Click **Edit rule** next to the rule you want to modify. 3. Update the conditions or forwarding address in the dialog. 4. Save your changes. ## Delete a forwarding rule 1. Navigate to the inbox's **Forwarding Rules** tab. 2. Click **Delete** next to the rule you want to remove. 3. In the confirmation dialog, click **Delete** to confirm. --- Source: https://mailosaur.com/docs/inboxes/inbox-settings # Inbox settings Each inbox has configurable settings that control its name, message retention, and performance behavior. ## Before you get started - You must have administrator privileges to manage an inbox. ## Access inbox settings 1. Navigate to the inbox you want to configure. 2. Click the **Settings** tab. ## Available settings ### Inbox name Change the display name of your inbox. This does not affect the inbox domain name or its unique ID. ### Message retention Set the number of days that messages are kept before being automatically deleted. After the retention period expires, messages are permanently removed. > [!INFO] > The maximum retention period that you set is determined by the plan that you are currently on. Speak to our [sales team](/contact) to learn more. ### Performance mode If you have a requirement to send very large volumes of email to an inbox, then enabling performance mode maximizes the throughput available, and reduces the risk of timeouts or throttling. When performance mode is enabled, message content is not processed and is not made available via the Dashboard or API. Instead, emails are immediately deleted upon receipt. ### Usage limits Account administrators can set daily email and monthly SMS limits for an inbox. See [usage limits](/docs/inboxes/usage-limits) for details. ### Delete inbox You can delete the inbox from the settings page. See [Delete an inbox](/docs/inboxes/delete-an-inbox) for details. --- Source: https://mailosaur.com/docs/inboxes/manage-inbox-access # Manage inbox access Every member of a project can see the inboxes in it. You can restrict an individual inbox so that only specific users and teams can access it. ## Before you get started - You must have administrator privileges to manage an inbox. ## How inbox access works An inbox belongs to a project, and the project controls who can reach it. Every member of a project can see the inboxes in that project and work with the messages in them. Someone who is not a member of the project cannot see its inboxes at all. See [Manage project access](/docs/projects/manage-project-access). Restricting an inbox narrows access further, to named users and teams, within a project whose members would otherwise all see it. ## Restrict access to an inbox 1. Navigate to the inbox you want to restrict. 2. Click the **Manage access** tab. 3. Toggle **Restricted access** on. This reveals options to configure which users and teams can access the inbox. 4. Click **Add user** or **Add team**. 5. Select the user or team you want to grant access to and click **Add**. 6. Choose a role for the newly added user or team: | Role | What they can do | |------|-----------------| | **Viewer** | View messages in the inbox, and open screenshots other people have generated | | **Writer** | View messages, send, reply or forward from the inbox, generate screenshots, and manage the inbox's own API keys and rules | | **Admin** | Full control, including managing inbox settings and access | You can assign different roles to different users and teams on the same inbox. ## Who can access a restricted inbox - **Account Administrators always have access to all inboxes**, including restricted ones. - **Editors and Admins of the project** the inbox belongs to. Restricting an inbox does not withdraw what their project role already granted. - Users and teams you explicitly add in the **Manage access** tab, with the role you assign. Project **Viewers** cannot see the restricted inbox unless you add them in the **Manage access** tab. Neither can anyone who is not a member of the project. ## Remove access restrictions To make a restricted inbox visible to every member of its project again: 1. Navigate to the inbox's **Manage access** tab. 2. Toggle **Restricted access** off. ## Related pages - [Manage project access](/docs/projects/manage-project-access) — control who can see a project and its inboxes - [Permissions](/docs/managing-your-account/permissions) — how account, project and inbox permissions fit together --- Source: https://mailosaur.com/docs/inboxes/smtp-pop3-imap # SMTP, POP3, and IMAP connection details You can connect to a Mailosaur inbox using standard email protocols: SMTP, POP3, and IMAP. This is useful for integrating Mailosaur with email clients, legacy systems, or applications that send or retrieve email via these protocols. These protocols are only for pushing or pulling content into and out of your Mailosaur inbox. They do not send email to external recipients. ## Plan availability - **SMTP** is available on all plans. - **POP3** and **IMAP** require the **Core** or **Enterprise** plan. ## View connection details 1. Navigate to the inbox you want to connect to. 2. Click the **Connect** tab. The page displays connection details for each protocol. You must have **Writer** or **Admin** privileges on the inbox to reveal the password. ## Connection security Each protocol offers a dropdown where you choose how to connect: - **Use SSL to connect** (recommended) - **StartTLS** - **None** ## SMTP Use these settings to send email via SMTP to your Mailosaur inbox. | Setting | Description | |---------|-------------| | **SMTP outgoing server** | The hostname to connect to | | **Port** | The port number (varies by security setting) | | **Username** | Your inbox-specific username | | **Password** | Click **Reveal password** to view | ## POP3 Use these settings to retrieve email from your Mailosaur inbox using POP3. | Setting | Description | |---------|-------------| | **POP3 incoming server** | The hostname to connect to | | **Port** | The port number (varies by security setting) | | **Username** | Your inbox-specific username | | **Password** | Click **Reveal password** to view | ## IMAP Use these settings to retrieve email from your Mailosaur inbox using IMAP. | Setting | Description | |---------|-------------| | **IMAP incoming server** | The hostname to connect to | | **Port** | The port number (varies by security setting) | | **Username** | Your inbox-specific username | | **Password** | Click **Reveal password** to view | --- Source: https://mailosaur.com/docs/inboxes/usage-limits # Inbox usage limits Set email and SMS limits on individual inboxes, so a single team or project cannot consume your whole account allowance. Inbox usage limits extend your [account usage limits](/docs/managing-your-account/usage-limits) to individual inboxes. They are useful when several teams share one account, because they cap how much of the account allowance any one inbox can use. ## Prerequisites - Your account must have inbox usage limits enabled via the **Enterprise plan**. - You must be an account administrator to change a limit. ## How inbox limits work Account limits and inbox limits apply together. A message is rejected when it would exceed either the account limit or the inbox limit, whichever is reached first. By default, an inbox has no limits of its own, so only your [account limits](/docs/managing-your-account/usage-limits) apply. Setting an inbox limit does not change your account limits. The following limits can be set on an inbox: - **Daily email limit** - A combined limit for the emails an inbox receives and sends each day. Once the limit is reached, the inbox stops processing further emails until the count resets. - **Monthly inbound SMS limit** - The number of SMS messages an inbox can receive each month. Once the limit is reached, further received messages are silently dropped. - **Monthly outbound SMS limit** - The number of SMS messages an inbox can send each month. Once the limit is reached, a request to send a message returns a validation error. Inbox usage counters reset at the same time as your [account limits](/docs/managing-your-account/usage-limits). ## Set an inbox limit 1. Open the inbox you want to configure. 2. Click the **Settings** tab, then select **Usage limits**. 3. Turn on the limit you want to apply, then set the limit value. 4. Click **Save changes** and confirm. Limits take effect immediately. ## Remove an inbox limit 1. Open the inbox, then go to **Settings** and select **Usage limits**. 2. Turn off the limit you no longer need. 3. Click **Save changes** and confirm. With the limit turned off, only your global account limits apply. ## Related pages - [Account usage limits](/docs/managing-your-account/usage-limits) - [Usage alerts](/docs/managing-your-account/usage-alerts) - [Inbox settings](/docs/inboxes/inbox-settings) --- Source: https://mailosaur.com/docs # Documentation Explore our guides and API documentation to learn how to test email and SMS with Mailosaur. ## Frameworks and tools Explore frameworks and tools for seamless email and SMS testing automation with Mailosaur. - [Selenium](/docs/automation/selenium) - [Cypress](/docs/automation/cypress) - [Playwright](/docs/automation/playwright) - [Cucumber](/docs/automation/cucumber) - [Robot Framework](/docs/automation/robot-framework) [See all frameworks](/docs/automation) ## Languages Explore comprehensive guides on testing email and SMS messages in various programming languages. - [Node.js](/docs/automation/nodejs) - [Java](/docs/automation/java) - [Python](/docs/automation/python) - [.NET](/docs/automation/dotnet) - [Ruby](/docs/automation/ruby) [See all languages](/docs/automation) ## Start a new project Using this command in your terminal will start our speedy setup wizard. This will generate a sample test project, using one of the most popular test frameworks. ```bash npm create mailosaur@latest ``` Need help with automation? Connect with our [QA automation experts](/contact) who can help answer questions on automated testing with Mailosaur. ## Email Testing Learn how to use our virtual SMTP servers to test account verification emails, password resets, email tracking, and more. - [Sending test emails to Mailosaur](/docs/email-testing/sending-to-mailosaur) - [Forwarding emails](/docs/email-testing/forwarding) - [Replying to emails](/docs/email-testing/replying) - [Sending emails out from Mailosaur](/docs/email-testing/sending-from-mailosaur) [See all Email Testing documentation](/docs/email-testing) ## SMS Testing Learn how to use Mailosaur phone numbers to create end-to-end tests that cover identity verification, alerting, promotional messages and more. - [Managing phone numbers](/docs/sms-testing/phone-numbers) - [Common test cases](/docs/automation) - [Replying to SMS messages](/docs/sms-testing/replying) [See all SMS documentation](/docs/sms-testing) ## API Reference The Mailosaur API lets you test email using a simple REST API. You can make the API calls yourself, however because email and SMS messages can take time to arrive, we highly recommend using one of our official clients. [Go to documentation](/docs/api) ## Common test cases Learn common email and SMS tests with Mailosaur. Explore text and HTML content, codes and links, test attachments, images, web beacons, message properties, and spam scores. [Go to documentation](/docs/automation) ## Managing inboxes Manage inboxes with Mailosaur. Explore guides and API documentation for creating and managing inboxes, grouping tests effectively. [Go to documentation](/docs/inboxes) ## Projects Separate your account by team, product or business unit. Each project holds its own inboxes, designs and authenticators, and its own list of who can see them. [Go to documentation](/docs/projects) ## MFA, 2FA and OTP testing Learn how to effectively test Multifactor Authentication (MFA/2FA) with Mailosaur. [Go to documentation](/docs/authenticator) ## Managing your account Manage your Mailosaur account with our intuitive Dashboard. Explore guides on email and SMS testing, API keys, domain ownership, user management, and more. [Go to documentation](/docs/managing-your-account) --- Source: https://mailosaur.com/docs/managing-your-account # Managing your account Learn how to use the Dashboard to operate your Mailosaur account. The Mailosaur Dashboard is the user interface that allows you to operate and configure your Mailosaur account. You can use it to manage your inboxes, emails and SMS messages, manage users and permissions, and more. ## Browser compatibility The Dashboard officially supports the following web browsers and mobile environments: - The last two versions of Chrome, Firefox, Safari, and Edge - The last two versions of mobile Safari on iOS > [!LINK](/docs/managing-your-account/api-keys) > ### API Keys > API keys and their role in automating email and SMS testing with Mailosaur. Learn about account-level and inbox-level API keys, how to create them, and how to ensure secure access to functions and data. > [!LINK](/docs/managing-your-account/deleting-your-account) > ### Deleting your account > Maybe you have a duplicate account or perhaps you want to leave Mailosaur. Either way, here is how to delete an account. > [!LINK](/docs/managing-your-account/managing-domains) > ### Verifying Domain Ownership > Learn how to verify a domain you own, so that you can use it with your Mailosaur account for email and SMS testing. > [!LINK](/docs/managing-your-account/external-email-addresses) > ### Managing External Email Addresses > Learn how to manage external email addresses with Mailosaur. Verify ownership for sending, replying, and forwarding emails. > [!LINK](/docs/managing-your-account/ip-addresses) > ### IP addresses and ports > Learn how to configure Mailosaur for corporate networks blocking unknown IP addresses or port numbers. Optimize email and SMS testing for your network. > [!LINK](/docs/managing-your-account/ip-allowlisting) > ### IP allowlisting > Only allow access to your Mailosaur account from the IP addresses and ranges you trust, such as your office network or VPN. > [!LINK](/docs/managing-your-account/managing-users) > ### Managing Users and Teams > Learn how to manage user permissions in Mailosaur. Control team access and actions, configure user permissions. > [!LINK](/docs/managing-your-account/permissions) > ### Permissions > Understand how account, project and inbox permissions fit together, what each role can do, and where you grant each one. > [!LINK](/docs/managing-your-account/usage-limits) > ### Account usage limits > Understand the email and SMS usage limits included with your plan, how to view your current usage, and what happens when a limit is reached. > [!LINK](/docs/managing-your-account/usage-alerts) > ### Usage alerts > Get an email when your account approaches its email or SMS limits, so you can act before messages are blocked. > [!LINK](/docs/managing-your-account/billing) > ### Billing and plans > Choose or change your plan, add seats and add-ons, update your payment details, and manage invoices and billing contacts. > [!LINK](/docs/managing-your-account/sso) > ### Single sign-on > Enhance your Mailosaur Dashboard security with Single Sign-On (SSO). Implement SAML or OpenID Connect for seamless authentication and access control. > [!LINK](/docs/managing-your-account/scim) > ### SCIM > Efficiently manage user access with Mailosaur's SCIM API. Automate provisioning, access, and team organization with SCIM-enabled Identity Providers. > [!LINK](/docs/managing-your-account/sso-mailosaur-okta) > ### Configure Single Sign On (SSO) with Mailosaur and Okta > Learn how to secure Mailosaur using SSO with Okta. > [!LINK](/docs/managing-your-account/sso-mailosaur-microsoft-entra) > ### Configure SSO with Mailosaur and Microsoft Entra > Learn how to secure Mailosaur using SSO with Microsoft Entra (Azure). --- Source: https://mailosaur.com/docs/managing-your-account/api-keys # API keys API keys authenticate your requests to the Mailosaur API. You need an API key to use the API or any of the official Mailosaur SDKs. ## Before you get started - You must be an Account Administrator to manage API keys. ## Types of API keys Mailosaur supports two types of API keys: | Type | Scope | Use case | |------|-------|----------| | **Standard** | Account-wide | Full access to all inboxes and API operations, including creating and deleting inboxes | | **Server-restricted** | Single inbox | Access limited to one specific inbox; cannot create or delete inboxes | ### Standard keys A standard API key grants access to all inboxes in your account and supports all API operations. Use standard keys when you need broad access across your account — for example, in a CI/CD pipeline that manages multiple inboxes. ### Server-restricted keys A server-restricted API key is scoped to a single inbox. It can only be used to perform email and SMS functions and cannot create or delete inboxes. Use server-restricted keys when you want to limit access — for example, giving a specific integration access to only one inbox. > [!INFO] > In the API, inboxes are referred to as "servers". The term "server-restricted" reflects this API-level naming. ## Key limits and expiry - There is no limit on the number of API keys you can create. - API keys do not expire. They remain active until you delete them. - API keys cannot be renamed. To change a key's name, delete it and create a new one. ## Permissions Only **Account Administrators** can create, reveal, and delete API keys. ## Create a standard API key 1. Navigate to the [**API Keys**](/app/keys) section in the dashboard. 2. Click **Create standard key**. 3. Enter a name for the key. 4. Click **Create**. The new API key is displayed. Click **Reveal Key** to see its value, then copy and store it securely. ## Create a server-restricted API key 1. Navigate to the [**API Keys**](/app/keys) section in the dashboard. 2. Click **Create server-restricted key**. 3. Enter a name for the key. 4. Select the inbox from the dropdown. 5. Click **Create**. The new API key is displayed. Click **Reveal Key** to see its value, then copy and store it securely. ## Reveal an API key Use this when you need to copy a key value again. 1. Navigate to the [**API Keys**](/app/keys) section in the dashboard. 2. Find the API key you want to reveal. 3. Click **Reveal Key** (or the eye icon) next to the key. 4. Copy the key and store it securely. ## Delete an API key Before deleting a key, confirm that no active integrations depend on it and consider creating a replacement key to avoid downtime. 1. Navigate to the **API Keys** section in the dashboard. 2. Find the API key you want to delete. 3. Open the **Actions** dropdown next to the key and select **Delete**. 4. In the confirmation dialog, type the name of the API key. 5. Click **Delete** to confirm. The key is immediately revoked. Any API requests using this key will receive an authentication error. > [!WARNING] > This action cannot be undone. A deleted key cannot be restored. > [!INFO] > API keys cannot be deleted via the API. You must use the dashboard. ## Security best practices - **Keep keys secret.** Do not commit API keys to version control or share them in plain text. - **Use server-restricted keys** where possible to limit the blast radius if a key is compromised. - **Rotate keys regularly.** Delete old keys and create new ones periodically. - **Delete unused keys** to reduce your attack surface. --- Source: https://mailosaur.com/docs/managing-your-account/billing # Billing and plans Choose or change your plan, add seats and add-ons, update your payment details, and manage invoices and billing contacts. ## Who can manage billing You must be a **Billing Administrator** to change your plan, update payment details and view invoices. Being an Account Administrator does not give you access to these, but Account Administrators can manage billing contacts. A user can have both roles. See [Managing users and teams](/docs/managing-your-account/managing-users). ## Find your billing settings Go to **Account settings**, then select **Billing**. It has these pages: - **Plan & usage**: your plan, seats, usage, payment details and billing information - **Invoices**: view, download and pay your invoices - **Billing contacts**: choose who receives invoices and billing emails - **Usage alerts**: get an email before you reach a limit. See [Usage alerts](/docs/managing-your-account/usage-alerts). ## Plans | Plan | Who it is for | Add-ons | |------|---------------|---------| | **Personal** | Email Testing for individuals | Email Previews and SMS Testing are not available | | **Core** | Full quality assurance for your team | Email Previews and SMS Testing are available as add-ons | | **Enterprise** | Larger teams that need single sign-on and higher limits | SMS Testing is included. Email Previews are available as an add-on | You can buy the Personal and Core plans in the Dashboard. To move to the Enterprise plan, [contact our sales team](/contact). For prices, see [Pricing](/pricing). ## Choose or change your plan 1. Go to **Account settings**, then select **Billing** > **Plan & usage**. 2. Click **Choose a plan**. If you already have a subscription, click **Change plan**. 3. Under **Choose plan type and customize**, select **Personal** or **Core**, then choose the number of users and emails per day. 4. On the Core plan, turn on **SMS Testing** or **Email Previews** if you need them, and choose your limits. 5. If this is a new subscription, click **Continue**, then enter your billing information. 6. Under **Your plan**, select **Annual** or **Monthly** billing. Annual billing saves 20%. 7. Click **Securely pay via Stripe** for a new subscription, or **Securely pay now** to change your plan. If your new plan allows fewer users, phone numbers, projects or inboxes than you use now, the summary lists what to review before you can continue. If your subscription has expired, click **Resubscribe** on the **Plan & usage** page to choose a plan again. ### Upgrades and downgrades - **Upgrades** take effect straight away. You pay for the rest of your billing period. - **Downgrades** take effect at the end of your current billing period. The payment button reads **Schedule downgrade**. While a downgrade is waiting to take effect, the **Plan & usage** page shows when it starts, and you cannot make other changes to your plan. To keep your current plan, click **Cancel downgrade**. ## Add or remove seats Each user on your account uses a seat. 1. Go to **Account settings**, then select **Billing** > **Plan & usage**. 2. In the **Seats** panel, click **Add seats** or **Reduce seats**. 3. Choose your new limit, and confirm. ## Change your usage limits On the **Plan & usage** page, the **Email Testing usage**, **Previews usage** and **SMS Testing usage** panels show how much of each limit you have used. To raise or lower a limit, click **Customize plan limits**, then follow the steps to [change your plan](#choose-or-change-your-plan). ## Update your payment details In the **Payment information** panel on the **Plan & usage** page: - To change the card you pay with, click **Update payment information**. You enter your new card details securely with Stripe. - To change how often you pay, click **Switch to annual billing** or **Switch to monthly billing**. To pay by invoice instead of by card, click **Switch to invoice** in the **Invoices** panel and contact our account management team. Payment by invoice is available on the Core and Enterprise plans. ## Update your billing information Your billing information appears on your invoices. It includes your address, your tax ID and your own reference. 1. Go to **Account settings**, then select **Billing** > **Plan & usage**. 2. In the **Billing information** panel, click **Update billing information**. 3. Make your changes and save them. ## View and pay invoices Go to **Account settings**, then select **Billing** > **Invoices**. The page shows your most recent invoice, your next expected invoice, and your invoice history. - To download an invoice as a PDF, click **Download**. - If a payment failed, the invoice shows **Pay**. Click it to pay with a new card. ## Manage billing contacts Billing Administrators automatically receive emails about billing, such as new invoices. To keep other people informed, add their email addresses as billing contacts. 1. Go to **Account settings**, then select **Billing** > **Billing contacts**. 2. Click **Add email address**. 3. Enter the email address, then click **Add billing contact**. To remove a billing contact, open the actions menu at the end of their row, then select **Delete**. To change who is a Billing Administrator, click **Update administrators**. ## Cancel your subscription See [Cancelling your subscription](/docs/managing-your-account/deleting-your-account#cancelling-your-subscription). ## Accounts billed by invoice or through a reseller If you pay by invoice, or through a reseller, some of these options are not shown in the Dashboard. To change your plan or payment details, contact your account manager or reseller. ## Related pages - [Account usage limits](/docs/managing-your-account/usage-limits) - [Usage alerts](/docs/managing-your-account/usage-alerts) - [Deleting your account](/docs/managing-your-account/deleting-your-account) --- Source: https://mailosaur.com/docs/managing-your-account/deleting-your-account # Deleting your account Maybe you have a duplicate account or perhaps you want to leave Mailosaur. Either way, here is how to delete an account. ## How to delete a trial account To delete an account, you must be both an Account Administrator and a Billing Administrator. If you are, you can delete your account using the Mailosaur Dashboard. If you pay by invoice or through a reseller, contact the support team to delete your account instead. 1. Go to **Account settings**, then select **Billing** > **Plan & usage**. 2. At the bottom of the page, click **Delete your account**. If you do not see this button, you’ll need to contact the support team. 3. Follow the on-screen instructions. ## Cancelling your subscription If you want to pause or cancel your subscription on your account, you can do so using the Mailosaur Dashboard. You must be a Billing Administrator for this to work. 1. Go to **Account settings**, then select **Billing** > **Plan & usage**. 2. In the **Plan details** panel, click **Cancel subscription**. If you do not see this button, you’ll need to contact the support team. 3. Follow the on-screen instructions. Once cancelled, you will still be able to use your account until your next renewal date. --- Source: https://mailosaur.com/docs/managing-your-account/external-email-addresses # Managing External Email Addresses Verify ownership of email addresses outside of Mailosaur, allowing you to send, reply and forward emails. You can send, reply and forward emails with Mailosaur, for the purpose of testing functionality in your product or website. However, as Mailosaur is not an email service provider (ESP), you must first verify that you have the consent of the email address owner. To begin the process of verifying ownership of an external email address, you must be an Administrator on the account. This access can be granted by another Administrator on your account if you do not already have this. ## Verifying ownership of an external email address 1. Log in to the [Mailosaur Dashboard](/app). 2. Go to **Account settings**. 3. Select **Domains & addresses** > **Email addresses**. 4. Click the **Add email address** button. 5. Enter the email address that you want to verify, and submit the form. 6. An email will then be sent to this address, with instructions on how to complete the process. Once an email address has been verified, you’ll see a green checkmark next to it, meaning it is ready for use. ## Verifying an entire domain If you need to send to a wide range of emails on a domain you own (for example, if you’re testing a helpdesk/ticketing product), then you can also verify an entire domain. For more information, see [verifying domain ownership](/docs/managing-your-account/managing-domains). --- Source: https://mailosaur.com/docs/managing-your-account/ip-addresses # IP addresses and ports If your corporate network blocks unknown IP addresses or port numbers, this page explains what you’ll need to configure in order for Mailosaur to work. ## Overview Some organisations operate security policies that deny outbound traffic by default. If your organisation does this, you’ll need to add Mailosaur’s services to your allowlist. We may change our IP addresses from time to time, and so we recommend allowing by domain name rather than IP address wherever possible. > [!INFO] > To limit where people can access your Mailosaur account from, see [IP allowlisting](/docs/managing-your-account/ip-allowlisting). ## Domains and IP addresses Mailosaur is accessible via three primary IP addresses: `34.149.187.159`, `35.187.177.145` and `35.233.95.121`: | SERVICE | DOMAIN NAME | IP ADDRESS | | --------- | --------- | --------- | | Website | mailosaur.com | 34.149.187.159 | | Dashboard | mailosaur.com | 34.149.187.159 | | API | mailosaur.com | 34.149.187.159 | | SMTP | mailosaur.net | 35.187.177.145 | | POP3 | mailosaur.net | 35.187.177.145 | | SMTP (Legacy) | mailosaur.io | 35.233.95.121 | | POP3 (Legacy) | mailosaur.io | 35.233.95.121 | Note that the Legacy SMTP & POP3 services only apply to customers connecting to `mailosaur.io` in their test code. ## Port numbers For services to function, you must allow the following TCP ports: | SERVICE | PORT NUMBER(S) | | --------- | --------- | | Website, Dashboard, API | 443 | | SMTP | 25, 2525, 465 and 587 | | POP3 | 110 and 995 | --- Source: https://mailosaur.com/docs/managing-your-account/ip-allowlisting # IP allowlisting Only allow access to your Mailosaur account from the IP addresses and ranges you trust. IP allowlisting limits access to your Mailosaur account to the networks you trust, such as your office network or VPN. When it is on, Mailosaur rejects access to your account from any IP address that is not on your allowlist. This includes signing in to the Dashboard and requests made with your API keys. > [!INFO] > This page is about controlling where people can access your account from. To let traffic to and from Mailosaur through your own firewall, see [IP addresses and ports](/docs/managing-your-account/ip-addresses). ## Before you start - IP allowlisting is available as an add-on to the **Enterprise** plan. To add it to your account, [contact our sales team](/contact). - You must be an Account Administrator to manage the allowlist. ## What IP allowlisting affects When IP allowlisting is on, all access to your account must come from an address on the allowlist. This applies to everyone on your account, and to every way of using it, including the Dashboard and the API. Some things are not affected: - Email and SMS messages still arrive in your inboxes, whatever address they are sent from. - Links that you share to email previews keep working. ## Open the IP allowlisting page Go to **Account settings**, then select **Security** > **IP allowlisting**. ## Add addresses to the allowlist 1. In **Add addresses**, enter one or more entries. Separate entries with commas or new lines. 2. Click **Add**. Your entries are saved straight away. The allowlist can hold up to 100 entries, in any of these formats: | Format | Example | |--------|---------| | A single IPv4 address | `51.52.137.39` | | A CIDR block | `10.0.0.0/24` | | A range of addresses | `203.0.113.10-203.0.113.20` | Do not put spaces around the hyphen in a range. The entry that covers the IP address you are using now is marked **Your current IP**. ## Turn on IP allowlisting To turn on IP allowlisting, your current IP address must be on the allowlist so you do not lock yourself out. If it is not on the allowlist yet, the page displays your current IP address. Click **Add current IP** to add it. To turn on IP allowlisting: 1. Click the **Enable IP allowlisting** switch. 2. Click **Enable** to confirm. If anyone on your account has used Mailosaur in the last 30 days from an address that is not on the allowlist, a dialog lists them instead, with the IP address each person last used. They lose access as soon as you turn on IP allowlisting. To keep their access, click **Cancel**, add their addresses to the allowlist, and try again. Click **Copy all IP addresses** to copy the list of addresses. ## Remove an address 1. Open the actions menu at the end of the entry's row, then select **Remove**. 2. Click **Remove** to confirm. While IP allowlisting is on, you cannot remove the entry that covers your current IP address. To change an entry, remove it and add the new entry. ## Turn off IP allowlisting 1. Click the **Disable IP allowlisting** switch. 2. Click **Disable** to confirm. Mailosaur then accepts access to your account from any IP address. Your allowlist is kept, so you can turn IP allowlisting on again later. ## What blocked users see If someone signs in to the Dashboard from an address that is not on the allowlist, Mailosaur signs them out and shows an **Access blocked** message. Requests from that address that use your account's API keys are rejected with a `403 Forbidden` response. To give them access, add their IP address to the allowlist. ## If you are locked out If everyone on your account is locked out, contact our support team at support@mailosaur.com. ## Related pages - [IP addresses and ports](/docs/managing-your-account/ip-addresses) - [Single sign-on](/docs/managing-your-account/sso) - [Managing users and teams](/docs/managing-your-account/managing-users) --- Source: https://mailosaur.com/docs/managing-your-account/managing-domains # Verifying Domain Ownership Learn how to verify a domain you own, so that you can use it with your Mailosaur account for email and SMS testing. ## Why verify a domain? There are 3 main reasons for verifying ownership of a domain: 1. To use a custom inbound domain for emails sent into Mailosaur (Enterprise plan only). 2. To use the [mailosaur.js](/docs/automation/javascript) library (e.g. with Ghost Inspector). 3. To send, reply and forward email to [external email addresses](/docs/managing-your-account/external-email-addresses) on that domain. ## Verifying ownership of a domain 1. Log in to the [Mailosaur Dashboard](/app). 2. Go to **Account settings**. 3. Select **Domains & addresses** > **Domains**. 4. Click the **Add domain** button and enter the domain name you want to verify (e.g. `example.com`) 5. If you also want to be able to receive inbound email on this domain, select **Allow email to be sent to this domain** and answer any additional questions (only available to Enterprise plan customers). 6. Once you’re ready, submit the form. 7. You will be presented with on-screen instructions on how to verify ownership of the domain. This will require technical knowledge. Share this information with an IT team member if this is not your thing. 8. Once you have followed the on-screen instructions, it may take up to 30 minutes for the domain to be verified. 9. Once a domain is verified, you’ll see a green checkmark next to it, meaning it is ready to use. ## Allow email to be sent into Mailosaur via this domain **Note:** Only available to Enterprise plan customers. By default, Mailosaur gives you access to email addresses ending `@{server_id}.mailosaur.net`. You can, however, use your own domain instead (e.g. `@yourdomain.com`). To do this, follow the instructions above and select **Allow email to be sent to this domain** when setting up or configuring a domain. You can link your domain to a single Mailosaur server, or use a wildcard pattern (replacing `@{server_id}.mailosaur.net` with `@{server_id}.yourdomain.com`). You’ll be presented with instructions on how you need to confirm the DNS records of your domain. This will require technical knowledge. Share this information with an IT team member if this is not your thing. It can take up to 24 hours for new DNS records to propagate, but once set up, any email sent to email addresses using that domain will appear in your Mailosaur inbox. --- Source: https://mailosaur.com/docs/managing-your-account/managing-users # Managing Users and Teams Control how your team members are able to access your Mailosaur account. You can invite your colleagues to access your Mailosaur account so that you can collaborate together. Each user can have different permission levels. You can also create Teams, which allow you to easily configure the permissions for groups of users. ## Inviting, editing and removing users You must be an Account Administrator in order to manage users. If you know a person's email address, you can invite them to your account by clicking **Invite User** on the [Users](/app/account/users) page. To find it, go to **Account settings**, then select **People** > **Users**. To edit or delete a user, open the actions menu at the end of their row in the list of users, then select **Edit** or **Delete**. You cannot edit or delete your own user from this list. ## Managing teams If you want to apply the same permissions and access to a group of users, you can do so by creating teams. You can create teams by clicking **Create Team** on the [Teams](/app/account/teams) page. To find it, go to **Account settings**, then select **People** > **Teams**. Once a team is created, you can add or remove users as members of that team. ## Administrator permissions When configuring users or teams on your account, you can optionally assign one or both of the following administration privileges: - **Account Administrator:** This role is for people who need access to manage account-wide API keys, settings, etc. This role can see and manage almost everything on the account. - **Billing Administrator:** This role is for people who need to manage your account subscription, plan level and billing settings. --- Source: https://mailosaur.com/docs/managing-your-account/permissions # Permissions Permissions work in three layers: your account, each project, and individual inboxes. This page explains what each layer covers and how they combine. ## The three layers Each layer is granted separately, and a role at one layer does not imply a role at another. Account Administrators are the exception: they can access every project and every inbox on the account. Billing is separate: only Billing Administrators can manage your plan, payment details and invoices. | Layer | What it covers | Where you grant it | Roles | |-------|----------------|--------------------|-------| | **Account** | Account-wide settings, users, teams, API keys and billing | [Users](/app/account/users) and [Teams](/app/account/teams) pages | Account Administrator, Billing Administrator | | **Project** | One project, and the inboxes, designs and authenticators in it | Project switcher, then the project's settings | Admin, Editor, Viewer | | **Inbox** | One inbox, when that inbox is restricted | The inbox's **Manage access** tab | Admin, Writer, Viewer | ## Account roles You can give a user or team either or both of the account roles. Anyone without one is a standard user. | Role | What they can do | |------|-----------------| | **Account Administrator** | Manage account-wide settings, users, teams and API keys. Access every project and every inbox, including restricted ones | | **Billing Administrator** | Manage your subscription, plan level, billing contacts and invoices | ## Project roles A user or team must be a member of a project to see it. Members of a project can see every inbox in it that is not restricted. | Role | What they can do | |------|-----------------| | **Viewer** | View the project and everything inside it. In any inbox that is not restricted, the same access as an inbox **Writer**. Read TOTP codes from authenticator devices | | **Editor** | Everything a Viewer can do, plus create and delete inboxes, inbox **Admin** access to every inbox in the project, and create, edit and delete designs and authenticator devices | | **Admin** | Everything an Editor can do, plus rename the project, manage its members, and delete it | See [Manage project access](/docs/projects/manage-project-access). ## Inbox roles You grant inbox roles only on an inbox that is restricted. An inbox that is not restricted takes its access from its project instead, and every member of that project already holds an effective role on it: - A project **Viewer** has the same access as an inbox **Writer**. - A project **Editor** or **Admin** has the same access as an inbox **Admin**, whether the inbox is restricted or not. Restricting an inbox therefore does not grant access, it withdraws it. The inbox disappears for project Viewers until you give them a role on it directly. | Role | What they can do | |------|-----------------| | **Viewer** | View messages in the inbox, and open screenshots other people have generated | | **Writer** | View messages, send, reply or forward from the inbox, generate screenshots, and manage the inbox's own API keys and rules | | **Admin** | Full control, including managing inbox settings and access | See [Manage inbox access](/docs/inboxes/manage-inbox-access). ## How the layers combine - An Account Administrator can access every project and every inbox on the account. - Everyone else sees a project only if they have been added to it. Without project membership, they see nothing inside that project. - Within a project, every member sees each inbox that is not restricted. A Viewer works with it as an inbox Writer would; an Editor or Admin as an inbox Admin would. - A restricted inbox is narrower than its project. It is visible to Account Administrators, to the project's Editors and Admins, and to the users and teams granted access on the inbox itself. - Where someone holds a role at more than one layer, the more permissive role applies. ## Related pages - [Managing users and teams](/docs/managing-your-account/managing-users) — invite people and group them into teams - [Manage project access](/docs/projects/manage-project-access) — add users and teams to a project - [Manage inbox access](/docs/inboxes/manage-inbox-access) — restrict an individual inbox - [API keys](/docs/managing-your-account/api-keys) — account-level and inbox-level keys --- Source: https://mailosaur.com/docs/managing-your-account/scim # SCIM Manage the access granted to your users using the SCIM API. ## SCIM Provisioning The SCIM API is used by SCIM-enabled Identity Providers (IdPs) to automate provisioning and manage access for user accounts and teams (groups). The Mailosaur API is based on version 2.0 of the SCIM standard. The SCIM endpoint that an IdP should use is: `https://mailosaur.com/api/scim/`. The SCIM API is only available to customers with an Enterprise plan, with [Enterprise SSO](/docs/managing-your-account/sso) enabled. ## Authentication To authenticate with the Mailosaur SCIM API, you must first create an [account-level API key](/docs/managing-your-account/api-keys). As with all other authenticated calls to the Mailosaur API, this key must be passed using HTTP Basic Auth. Learn more about [API authentication](/docs/api#4-authentication) in our [API reference](/docs/api#4-authentication). ## SCIM user attributes The following table maps SCIM attributes to the relevant fields that Mailosaur uses. Most of these profile fields are exposed directly in a person’s profile in the Mailosaur Dashboard: | NAME | TYPE | DESCRIPTION | | ------- | ------- | ------- | | displayName | string | The full name of the user. When provisioning a user, the name attributes are preferred to displayName. | | name.givenName | string | The first name of the user. | | name.familyName | string | The last name of the user. | | emails | array | Whilst this is a list of user emails, Mailosaur only uses one, which will be associated with their Mailosaur account. If Mailosaur finds an email marked as primary (or one that is marked as the user’s “work” email address) then this will be used. Otherwise, the first email in the list will be selected. | | userName | string | The email address associated with the Mailosaur user. May be used to set the email address for a user, if not set via the emails array. | | id | string | Identifier generated by the Mailosaur SCIM endpoint. | | externalId | string | This identifier is generated by the Identity Provider (IdP), and is used as a unique ID by the IdP to match against a Mailosaur user. You can find the externalId for a user either at the IdP, or using the List SCIM provisioned identities endpoint and filtering on other known attributes, such as a user's GitHub username or email address. | | active | boolean | Indicates whether the identity is active (true) or should be deprovisioned (false). | **NOTE:** Endpoint URLs for the SCIM API are case sensitive. For example, the first letter in the `Users` endpoint must be capitalized. ### List users `GET https://mailosaur.com/api/scim/Users` Retrieves a paginated list of all users. If you provide the filter parameter, the resources for all matching provisioned users are returned. #### Parameters | Name | Type | Location | Required | Description | | --- | --- | --- | --- | --- | | startIndex | integer | query | No | Used for pagination: the index of the first result to return. | | count | integer | query | No | Used for pagination: the number of results to return. | | filter | string | query | No | Filters results using the equals query parameter operator (eq). You can only filter results that are equal to the userName. For example, to search for an identity with the userName bob@yourdomain.com, you would use this query: ?filter=userName%20eq%20"bob@yourdomain.com". | ### Provision a user `POST https://mailosaur.com/api/scim/Users` Creates a new user. Must include at least one email address. If an email address is marked as `primary`, it will be used. This is an example request body for a typical provisioning request. In this example `you@work.com` will be used as it is marked as the `primary` email address (it would also have been used because it has the type `work`): #### Request ```json { "schemas": [ "urn:scim:schemas:core:1.0", "urn:scim:schemas:extension:enterprise:1.0" ], "name": { "familyName": "Last", "givenName": "First" }, "displayName": "First Last", "emails": [ { "value": "you@work.com", "type": "work", "primary": true }, { "value": "you@home.com", "type": "home" } ], "userType": "Employee", "active": true } ``` ### Retrieve a user `GET https://mailosaur.com/api/scim/Users/{scim_user_id}` Returns the attributes of an existing user. ### Update a user `PUT https://mailosaur.com/api/scim/Users/{scim_user_id}` Updates an existing user resource, overwriting all values for a user even if an attribute is empty or not provided. If an attribute that had been set previously is left blank during a PUT operation, the new value will be blank in accordance with the data type of the attribute and the storage provider. ### Delete a user `DELETE https://mailosaur.com/api/scim/Users/{scim_user_id}` Deletes a user from your Mailosaur account ## Groups (Teams) SCIM groups are mapped to Mailosaur “Teams”, which can be used for organizing users in logical divisions across a workspace, such as by team or affinity. | NAME | TYPE | DESCRIPTION | | ------ | ------ | ------ | | displayName | string | The team (group) name. | | members | array | Users that are assigned to this team (group). | ### List groups `GET https://mailosaur.com/api/scim/Groups` Returns a paginated list of groups. ### Retrieve a single group `GET https://mailosaur.com/api/scim/Groups/{scim_group_id}` Retrieves a single group resource. ### Create a group `POST https://mailosaur.com/api/scim/Groups` Must include the `displayName` attribute (as defined in the schema specification). Users can be added to the group during creation by supplying their ID values in the members array attribute. Here is an example of a typical request body for provisioning a new group: #### Request ```json { "schemas": [ "urn:scim:schemas:core:1.0" ], "displayName": "My New Team", "members": [ { "value": "fd98493c-c875-440f-be8f-7fbec0f50e43" }, { "value": "4f02f207-b90e-4b72-9ac4-6ea1c0368bc9" } ] } ``` ### Update an existing group `PUT https://mailosaur.com/api/scim/Groups/{scim_group_id}` Updates an existing group resource, overwriting all values for a group even if an attribute is empty or not provided. If an attribute that had been set previously is left blank during a PUT operation, the new value will be blank in accordance with the data type of the attribute and the storage provider. ### Delete a single SCIM group `DELETE https://mailosaur.com/api/scim/Groups/{scim_group_id}` Deletes an existing group from your Mailosaur account. --- Source: https://mailosaur.com/docs/managing-your-account/sso # Single sign-on Secure the Mailosaur Dashboard using your organisation’s SAML or OpenID Connect Identity Provider. ## What is SSO? Single sign-on (SSO) is an authentication scheme that allows customers to mandate sign-in requirements and team member access to systems like the Mailosaur Dashboard. Mailosaur allows users to log in via Google, GitHub and Microsoft authentication, but also supports Enterprise SSO providers via Security Assertion Markup Language (SAML) and OpenID Connect (OIDC), allowing authentication and team member account creation to be deferred to an Identity Provider (IdP) like Okta, Microsoft Entra ID, Ping Identity and more. ## Benefits of SSO Using SSO to authenticate to the Mailosaur Dashboard has two main benefits: - Security improvements - Allow team members to access the Dashboard without needing to create a password. - Leverage authentication decisions defined through an IdP, such as password policies and mandating two-factor authentication. - Configure your account to mandate SSO for all team members. - Easily manage access - Allow new team members to instantly sign in to the Dashboard using Just-in-Time account provisioning. - Revoke Dashboard access as needed, such as when a user leaves your organisation. - Manage users, teams and team membership with [SCIM](/docs/managing-your-account/scim). ## Setting up Enterprise SSO (SAML or OpenID Connect) ### What we need from you If you’re using a SAML-based provider, then all our team need is the **metadata URL** for your identity provider (e.g. `https://example.com/metadata/idp.xml`). However, if you can’t find this, simply send us the **entity ID**, **SSO/redirect URL** and **certificate**. If you’re using an OpenID Connect-based provider, we just need the **client ID** and **issuer URL**. ### What you need from us If you’re using SAML, you’ll need to set a ‘Single sign on URL’ (or recipient/destination URL), which is `https://mailosaur.com/__/auth/handler`. You will also need to set the ‘Audience URI’ (or entity ID) for the Mailosaur service, which is `https://id.mailosaur.com/saml`. For OpenID Connect, you’ll need the ‘Authorization Callback URL (ACS)’ for Mailosaur, which is `https://mailosaur.com/__/auth/handler`. ## Enforcing single sign-on When we first set up Enterprise SSO for you, it will be configured as _optional_, which means your users can still log in via another mechanism (e.g. their own username/password). Once you are happy with the SSO configuration, just let our team know and we’ll make SSO mandatory for your account. ## Just-in-time (JIT) provisioning Mailosaur supports just-in-time (JIT) provisioning of users. When enabled, whenever a user visits Mailosaur for the first time, we’ll add them to your account, as long as they are authorised by your identity provider. This saves time when adding new users; as you just need to grant them access to Mailosaur within your organisation’s IT systems. When someone no longer requires Mailosaur access, blocking them via your SSO provider will immediately prevent them from logging in, but you’ll also want to log in to Mailosaur and delete their user record, to free up a seat on your account. You do not need to do this manual step if you have [SCIM](/docs/managing-your-account/scim) enabled. ## SCIM SCIM (System for Cross-domain Identity Management) allows for the advanced management of users and teams. It can be used instead of JIT to provision new users, but moreover can also create teams, assign users to teams, and delete users when they leave your organisation. [SCIM is available](/docs/managing-your-account/scim) to Enterprise plan customers, just [speak to the team](/contact) to learn more. --- Source: https://mailosaur.com/docs/managing-your-account/sso-mailosaur-microsoft-entra # Configure Single Sign On (SSO) with Mailosaur and Microsoft Entra ## Before you get started Mailosaur's Entra ID integration supports authentication via SAML and SCIM provisioning (depending on plan level). Before beginning, ensure that you have: - A Mailosaur account with SSO enabled. SSO is available on the Enterprise plan, and as an optional bolt-on to the Core plan. - Access with the role of Account Administrator. - A Microsoft Entra subscription. ## Supported Features - SP-initiated SSO - JIT (Just-In-Time) provisioning - SCIM provisioning (Enterprise plan only) ## Configuration Steps Follow these steps if you wish to integrate Microsoft Entra and Mailosaur using SAML. ### 1. Configuration within Microsoft Entra To configure the integration of Mailosaur into Microsoft Entra ID, you need to add Mailosaur from the gallery to your list of managed SaaS apps. 1. Sign in to the [Microsoft Entra admin center](https://entra.microsoft.com/) as at least a [Cloud Application Administrator](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/permissions-reference#cloud-application-administrator). 2. Browse to **Identity** > **Applications** > **Enterprise applications** > **New application**. 3. In the **Add from the gallery** section, type "Mailosaur" into the search box. 4. Select **Mailosaur** from results panel and then add the app. Wait a few seconds while the app is added to your tenant. 5. When the app is added to your tenant, select **Single sign-on** from the navigation sidebar. 6. On the **Select a single sign-on method** page, select **SAML**. 7. In the **Basic SAML Configuration** section, click **Edit** to edit the configuration. 1. In the **Identifier (Entity ID)** text box, type the URL: `https://id.mailosaur.com/saml` 2. In the **Reply URL** text box, type the URL: `https://mailosaur.com/__/auth/handler` 3. In the **Sign on URL** text box, type a URL using the following pattern: `https://mailosaur.com/sso/{company}`, where `{company}` is replaced with a short name for your organisation (e.g. `acmecorp`). Remember this Sign on URL as you will need it below. 4. **Save** your changes to **Basic SAML Configuration**. 8. In the **SAML Certificates** section, locate **App Federation Metadata Url** and copy the value, you will need this later. ### 2. Verify your company domain in Mailosaur So that your users can be automatically redirected to Microsoft Entra if they try to log in via the Mailosaur login page, you need to verify that you own the domain in their email address (for example, if your users used `some.person@example.com`, you would verify ownership of `example.com`). To do this: 1. Log in to the Mailosaur Dashboard. 2. Click **Account settings** at the bottom of the left-hand navigation, then select **Domains & addresses** > **Domains**. 3. Click **Add domain** and type in the domain that you wish to verify (e.g. `example.com`). 4. Leave all other options unchanged, and click **Add Domain**. 5. Follow the on-screen instructions to verify that you own this domain (contact our support team if you're unsure how to do this). ### 3. Set up SSO within Mailosaur 1. If you are not already logged in, then log in to the Mailosaur Dashboard. 2. Click **Account settings** at the bottom of the left-hand navigation, then select **Security** > **Single sign-on**. 3. Select your verified domain from the list of domains (see step above if you haven't verified a domain yet). 4. From the list of Identity providers, choose **Microsoft Azure AD / Entra**. 5. Now fill in the **Identity provider (IdP) metadata URL** field. The value for this is the **App Federation Metadata Url** that you copied above and can be found on the **Single sign-on** tab within the Microsoft Entra admin center. 6. Paste in this value and click **Save**. SSO is now configured on your account. You can optionally choose to enable JIT (Just-In-Time) Provisioning, which will automatically add any new users to your account when they first log in to Mailosaur. You can also make SSO mandatory (however, you must first log in with Microsoft Entra before you can do this). Users can now log in via the URL shown on-screen e.g. `https://mailosaur.com/sso/{company}` ## SCIM ### Supported Features - Create users - Update user attributes - Deactivate users - Push groups ### Configuration Steps #### Generate a token for use with SCIM 1. Log in to the Mailosaur Dashboard. 2. Click **Account settings** at the bottom of the left-hand navigation, then select **Integrations** > **API Keys**. 3. Click **Create standard key**, name the new key `SCIM` and click **Create**. 4. Find the newly-created key and click **Reveal Key**, copy the revealed value for use later (below). #### Configuring provisioning in Microsoft Entra 1. Sign in to the [Microsoft Entra admin center](https://entra.microsoft.com/) as at least a [Cloud Application Administrator](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/permissions-reference#cloud-application-administrator). 2. Browse to **Identity** > **Applications** > **Enterprise applications** and locate/click on **Mailosaur**. 3. Navigate to **Provisioning**. 4. Click **Get Started**, then select provisioning mode **Automatic**. 5. Input the following **Admin Credentials:** 1. In the **Tenant URL** field enter `https://mailosaur.com/api/scim/` 2. In the **Secret Token** field enter the key generated above (see _Generate a token for use with SCIM_). 3. Click **Test Connection** 4. Once the connection is successfully tested, click **Save** ## Known Issues / Troubleshooting Please contact our team at support@mailosaur.com if you encounter any issues. #### See also - [SSO with Okta](/docs/managing-your-account/sso-mailosaur-okta) --- Source: https://mailosaur.com/docs/managing-your-account/sso-mailosaur-okta # Configure Single Sign On (SSO) with Mailosaur and Okta ## Before you get started Mailosaur's Okta integration supports authentication via SAML, OpenID Connect (OIDC) and SCIM provisioning (depending on plan level). Before beginning, ensure that you have: - A Mailosaur account with SSO enabled. SSO is available on the Enterprise plan, and as an optional bolt-on to the Core plan. - Access with the role of Account Administrator. ## Supported Features - SP-initiated SSO - JIT (Just-In-Time) provisioning - SCIM provisioning (Enterprise plan only) ## SAML ### Configuration Steps Follow these steps if you wish to integrate Okta and Mailosaur using SAML. Alternatively, you can configure using OpenID Connect (OIDC). ### 1. Configuration within Okta 1. Log in to your Okta administrative portal. 2. Click **Applications** in the left-hand sidebar, and then **Browse App Catalog** near the top of the resulting page. 3. Search for "mailosaur" in the search bar, and then click the Mailosaur integration from the results. 4. Click the **Add Integration** button to add the Mailosaur integration to your Okta instance. 5. When the app integration is added to your Okta instance, you will be redirected to the applications assignments page. Click on the **Sign On** tab then copy the **Metadata URL** value, you will need this later. ### 2. Verify your company domain in Mailosaur So that your users can be automatically redirected to Okta if they try to log in via the Mailosaur login page, you need to verify that you own the domain in their email address (for example, if your users used `some.person@example.com`, you would verify ownership of `example.com`). To do this: 1. Log in to the Mailosaur Dashboard. 2. Click **Account settings** at the bottom of the left-hand navigation, then select **Domains & addresses** > **Domains**. 3. Click **Add domain** and type in the domain that you wish to verify (e.g. `example.com`). 4. Leave all other options unchanged, and click **Add Domain**. 5. Follow the on-screen instructions to verify that you own this domain (contact our support team if you're unsure how to do this). ### 3. Set up SSO within Mailosaur 1. If you are not already logged in, then log in to the Mailosaur Dashboard. 2. Click **Account settings** at the bottom of the left-hand navigation, then select **Security** > **Single sign-on**. 3. Select your verified domain from the list of domains (see step above if you haven't verified a domain yet). 4. From the list of Identity providers, choose **Okta**. 5. Now fill in the **Identity provider (IdP) metadata URL** field. The value for this is what you copied above and can be found on the **Sign On** tab within the Okta administrative portal. 6. Paste in this value and click **Save**. SSO is now configured on your account. You can optionally choose to enable JIT (Just-In-Time) Provisioning, which will automatically add any new users to your account when they first log in to Mailosaur. You can also make SSO mandatory (however, you must first log in with Okta before you can do this). Users can now log in via the URL shown on-screen e.g. `https://mailosaur.com/sso/{company}` ### 4. Configure a tile to allow users to log in via the Okta Dashboard Mailosaur only supports Service Provider Initiated (SP-initiated) logins. Because of this, users are unable to click on the application tile provided by Okta. Instead, you should hide this default tile, and create an [Okta Bookmark App](https://support.okta.com/help/s/article/create-a-bookmark-app) tile: 1. Log in to Okta as an administrator. 2. Open the configuration for the Mailosaur application, and ensure you have hidden its default tile by checking **Do not display application icon to users** under **General Settings** > **Application Visibility**. 3. Select **Applications** in the left drop-down menu. 4. Select **Browse App Catalog**. 5. Select **Bookmark App** and then **Add**. 6. Type in your desired name for the Mailosaur tile. 7. Enter `https://mailosaur.com/sso/{company}` into the URL box. 8. Save your bookmark. 9. Your users can now log in to Mailosaur by clicking this tile. ## OpenID Connect (OIDC) ### Configuration Steps Follow these steps if you wish to integrate Okta and Mailosaur using OpenID Connect (OIDC). Alternatively, you can configure using SAML. ### 1. Configuration within Okta 1. Log in to your Okta administrative portal. 2. Click **Applications** in the left-hand sidebar, and then **Browse App Catalog** near the top of the resulting page. 3. Search for "mailosaur" in the search bar, and then click the Mailosaur integration from the results. 4. Click the **Add Integration** button to add the Mailosaur integration to your Okta instance. 5. When the app integration is added to your Okta instance, you will be redirected to the applications assignments page. 6. On the **General** tab, make a note of the **Client ID** that is shown. 7. Click on the **Sign On** tab then make a note of the **Issuer** URL. 8. Contact support with the **Client ID** and **Issuer URL** noted above, so that our team can complete OIDC configuration on our side. 9. Our team will provide you information on how your users can login. 10. Configure tiles for your users, using an **Okta Bookmark App**. #### Configure a tile to allow users to log in via the Okta Dashboard Mailosaur only supports Service Provider Initiated (SP-initiated) logins. Because of this, users are unable to click on the application tile provided by Okta. Instead, you should hide this default tile, and create an [Okta Bookmark App](https://support.okta.com/help/s/article/create-a-bookmark-app) tile: 1. Log in to Okta as an administrator. 2. Open the configuration for the Mailosaur application, and ensure you have hidden its default tile by checking **Do not display application icon to users** under **General Settings** > **Application Visibility**. 3. Select **Applications** in the left drop-down menu. 4. Select **Browse App Catalog**. 5. Select **Bookmark App** and then **Add**. 6. Type in your desired name for the Mailosaur tile. 7. Enter `https://mailosaur.com/sso/{company}` into the URL box. 8. Save your bookmark. 9. Your users can now log in to Mailosaur by clicking this tile. ## SCIM ### Supported Features - Create users - Update user attributes - Deactivate users - Push groups For more information on the features listed above, we recommend visiting [this glossary from Okta](https://help.okta.com/en/prod/Content/Topics/Reference/glossary.htm). ### Configuration Steps ### 1. Generate a token for use with SCIM 1. Log in to the Mailosaur Dashboard. 2. Click **Account settings** at the bottom of the left-hand navigation, then select **Integrations** > **API Keys**. 3. Click **Create standard key**, name the new key `SCIM` and click **Create**. 4. Find the newly-created key and click **Reveal Key**, copy the revealed value for use later (below). ### 2. Configuring provisioning in Okta 1. Log in to your Okta administrative portal. 2. Click **Applications** in the left-hand sidebar, and navigate into the Mailosaur application that you already have configured (see configuration steps for SAML or OIDC above). 3. Select the **Provisioning** tab and check the **Configure API Integration** box. 4. Check the **Enable API integration** checkbox. 5. Paste in the API key that you created in the steps above. 6. Click **Test API Credentials** - a success message should appear. 7. Click **Save**. 8. Select **To App** in the left panel then click **Edit**. 9. Enable **Create users**, **Update User Attributes** and **Deactivate Users**, then click **Save**. ### 3. Select users to be provisioned - The **Assignments** tab will let you provision your Okta users to Mailosaur. #### Sync groups On the **Push Groups** tab: - Select **Push Groups**, then **Find groups by name**. - Enter the name of your group. - Click **Save & Add Another**. ## Known Issues / Troubleshooting Please contact our team at support@mailosaur.com if you encounter any issues. #### See also - [SSO with Microsoft Entra](/docs/managing-your-account/sso-mailosaur-microsoft-entra) --- Source: https://mailosaur.com/docs/managing-your-account/usage-alerts # Usage alerts Get an email when your account approaches its email or SMS limits, so you can act before messages are blocked. Usage alerts notify your team by email as your account nears its [usage limits](/docs/managing-your-account/usage-limits). You choose the thresholds that trigger an alert and the people who receive it. ## Prerequisites - Your account must have usage alerts enabled via the **Enterprise plan**. - You must be an account administrator to configure alerts. ## How usage alerts work - Alerts are sent by email only. - You set thresholds for email and SMS usage independently. - A threshold is a percentage of your limit, between 25% and 100%. You can set up to three thresholds for each of email and SMS. - Each threshold triggers at most once per reset period: once per day for email, and once per month for SMS. - Alerts are turned off by default. No alerts are sent until you add at least one threshold and one recipient. ## Set up usage alerts 1. Go to **Account settings**, then select **Billing** > **Usage alerts**. 2. Under **Alert thresholds**, add a threshold to the **Email usage** or **SMS usage** track. Drag the marker, or select it and use the arrow keys, to set the percentage. 3. Under **Notification recipients**, add the account users who should receive the alerts. 4. Click **Save changes** and confirm. ## Choose recipients Recipients must be existing users on your account (external email addresses are not supported). To stop someone receiving alerts, remove them from the recipient list and save your changes. ## When alerts are sent An alert is sent the first time your usage crosses a threshold within a reset period: - **Email** thresholds are measured against your daily email usage and reset each day. - **SMS** thresholds are measured against your monthly SMS usage and reset each month. For example, with a 75% email threshold, recipients receive one "75% of email limit" alert per day at most. ## Related pages - [Account usage limits](/docs/managing-your-account/usage-limits) - [Inbox usage limits](/docs/inboxes/usage-limits) - [Managing users and teams](/docs/managing-your-account/managing-users) --- Source: https://mailosaur.com/docs/managing-your-account/usage-limits # Account usage limits Your account usage limits cover the messages you process and the resources you can hold. This page explains how those limits work and where to track them. Usage from every inbox, in every project, counts toward the same account limits. You can see your email, SMS, screenshot and user usage, and your current position against each limit, on the [Usage](/app/usage) page in the Dashboard. ## Usage limits These limits cover what you process over time. Usage counts toward the limit until the period resets. - **Email** - a daily limit covering both the emails you receive and the emails you send (e.g. via replies) - **SMS** - a monthly limit, with received and sent messages counted separately - **Email Previews** - a monthly limit on the number of [previews](/docs/email-previews) you generate - **Screenshots** - a monthly limit on the number of screenshots you generate. A single email preview produces one screenshot for each email client or device you select ## Resource quotas These limits set how many of each item your account can have at once, rather than how much you use over time. These include: - **Projects** - the number of [projects](/docs/projects) on your account - **Inboxes** - the number of inboxes (also called servers) on your account - **Users** - the number of users you can invite to your account - **Phone numbers** - the number of SMS phone numbers you can hold ## View your usage 1. Open the **Usage** page from the main navigation in the Dashboard. 2. Review the **limits breakdown** to see your current usage against each limit. 3. Use the month selector to view a daily breakdown of usage for any of the last six months. ## What happens when you reach a limit > [!WARNING] > **Note:** It is possible that your sending server/service may decide to 're-queue' those rejected emails and send them again after your limit resets. This can cause your usage to be impacted on the following day, so it is always important to ensure you have a high enough limit to cover your regular expected usage. - **Email** - if you hit the daily email limit, further emails are automatically rejected. - **SMS** - further messages are no longer processed. - **Email Previews/screenshots** - you are unable to generate more until the count resets. - **Projects** - **Create a new project** is unavailable until you upgrade your plan. To raise your limits, a Billing Administrator can [change your plan or its limits](/docs/managing-your-account/billing) in the Dashboard. If you pay by invoice, are on the Enterprise plan, or need more than your plan allows, contact the [Mailosaur sales team](/contact). ## When usage resets The usage limits reset on a fixed schedule: - **Daily limits (i.e. email)** — the daily count resets at midnight UTC each day. - **Monthly limits (e.g. SMS, Email Previews)** — monthly counts reset at midnight UTC on the 1st of each calendar month. ## Related pages - [Projects](/docs/projects) — separate your account by team, product or business unit, and control who can see each one - [Inbox usage limits](/docs/inboxes/usage-limits) — set email and SMS limits on individual inboxes - [Usage alerts](/docs/managing-your-account/usage-alerts) — get an email before you reach a limit --- Source: https://mailosaur.com/docs/projects # Projects overview A project is a separate area of your account for a team, product or business unit. It holds their inboxes, designs and authenticators, and controls who can see them. ## How projects work Use a project wherever you need a boundary inside your account. Most accounts run one per team, product or business unit, so that each group works with its own inboxes and designs and cannot see anyone else's. Everything you create in Mailosaur belongs to a project. When you create an inbox, a design or an authenticator device, Mailosaur adds it to whichever one you are working in at the time. Access works the same way. Being a user on your account is not enough: you are added to each project separately, and until someone adds you, you cannot see it or anything inside it. See [Manage project access](/docs/projects/manage-project-access). ## What a project contains Each one groups the following together: - **Inboxes** — the inboxes capturing email and SMS - **Designs** — the email designs you build and preview in the [Designer](/app/builder) - **Authenticators** — the TOTP devices used to test multi-factor authentication Users, teams, API keys and usage limits belong to your account instead, so they apply everywhere. ## Switch between projects The project switcher sits at the top of the left-hand navigation and shows where you are working. 1. Click the name of the current project to open the switcher. 2. Start typing to filter the list, then select the one you want. ## The shared project Every account has one marked **Shared**. It is where you start, and you can rename it but never delete it, so your account always keeps at least one. ## Related pages - [Create and delete projects](/docs/projects/create-and-delete-projects) - [Manage project access](/docs/projects/manage-project-access) - [Permissions](/docs/managing-your-account/permissions) --- Source: https://mailosaur.com/docs/projects/create-and-delete-projects # Create and delete projects Create a project to give a team, product or business unit its own inboxes, designs and authenticators. A project must be empty before you can delete it. ## Before you get started To create a project: - You must be an Account Administrator. - You must have the Core plan at least. To delete one: - You must be a project **Admin**, or an Account Administrator. - It must be empty. Delete every inbox, design and authenticator device first. ## Create a project 1. Click the project switcher at the top of the left-hand navigation. 2. Click **Create a new project**. 3. Enter a **Project name**. This is required. 4. Optionally, add a **Project description** to record what it is for. 5. Add members. Search for a user or team by name or email address, then select it. Each member you add starts as a **Viewer**. Use the dropdown next to their name to choose a different role. 6. Click **Create**. Account Administrators can access every project, so there is no need to add them as members. For what each role can do, see [Manage project access](/docs/projects/manage-project-access). Mailosaur switches you into the new project, so anything you create next belongs there. It starts empty, with no inboxes, designs or authenticator devices. ## Delete a project 1. Click the project switcher at the top of the left-hand navigation. 2. Hover over the one you want to delete, then click the delete icon. 3. Type its name to confirm. 4. Click **Delete project**. --- Source: https://mailosaur.com/docs/projects/manage-project-access # Manage project access Users and teams are added to each project separately. Choose who can see a project and what they can do inside it. ## Before you get started - You must be a project **Admin**, or an Account Administrator, to manage who has access. ## How project access works A project is the outer gate. Users and teams are added to each one separately, and anyone who is not a member cannot see it, or any inbox, design or authenticator device inside it. Account Administrators are the exception. They reach every project on the account and are included by default, so you do not need to add them. ## Add a user or team to a project 1. Click the project switcher at the top of the left-hand navigation. 2. Hover over the one you want to change, then click the settings icon. 3. Under **Project members**, search for a user or team by name or email address. 4. Select the user or team. It is added as a **Viewer**. Use the dropdown next to the name to choose a different role. 5. Click **Save**. You can assign different roles to different users and teams on the same project. ## Project roles | Role | What they can do | |------|-----------------| | **Viewer** | View the project and everything inside it. In any inbox that is not restricted, the same access as an inbox **Writer**. Read TOTP codes from authenticator devices | | **Editor** | Everything a Viewer can do, plus create and delete inboxes, inbox **Admin** access to every inbox in the project, and create, edit and delete designs and authenticator devices | | **Admin** | Everything an Editor can do, plus rename the project, manage its members, and delete it | ## Remove a user or team from a project 1. Click the project switcher at the top of the left-hand navigation. 2. Hover over the one you want to change, then click the settings icon. 3. Under **Project members**, find the user or team you want to remove. 4. Select **Remove from project** from the dropdown next to their name. 5. Click **Save**. The member loses access to the project and everything inside it. Nothing is deleted, and the user remains on your account. To remove someone from the account entirely, see [Managing users and teams](/docs/managing-your-account/managing-users). ## Restricted inboxes An individual inbox can be restricted so that only named users and teams can see it. Project membership on its own does not open one. A restricted inbox is visible to: - Account Administrators - Project **Editors** and **Admins** of the project it belongs to - Users and teams granted access on the inbox itself Project **Viewers** cannot see a restricted inbox unless they are granted access on the inbox directly. Access granted on the inbox itself carries its own role. A **Viewer** on a restricted inbox can read its messages and open screenshots that other people have generated, but cannot generate new ones, because that needs write access to the inbox. See [Manage inbox access](/docs/inboxes/manage-inbox-access). ## Related pages - [Permissions](/docs/managing-your-account/permissions) — how account, project and inbox permissions fit together - [Manage inbox access](/docs/inboxes/manage-inbox-access) — restrict an individual inbox - [Managing users and teams](/docs/managing-your-account/managing-users) — invite people to your account --- Source: https://mailosaur.com/docs/sms-testing # How to test SMS messages with Mailosaur Learn how to use Mailosaur phone numbers to create end-to-end tests that cover identity verification, alerting, promotional messages and more. Using the [Mailosaur API](/docs/api), you can write SMS tests using common frameworks like Cypress, Playwright, Selenium, and Robot Framework, as well as in popular languages, using our [SDKs for SMS testing](/docs/automation). ## How it works Testing SMS messages is as simple as: 1. [Assign a phone number](/docs/sms-testing/phone-numbers) to one of your inboxes. 2. Send SMS messages to that number, just as you normally would. 3. Use the Mailosaur API to create end-to-end tests using the extracted content. ## Testing SMS messages Using Mailosaur's [client libraries](/docs/automation), you can fetch SMS messages with just a few lines of code. The code for [automating SMS tests](/docs/automation) is almost identical to testing emails. ```nodejs const mailosaur = new MailosaurClient('YOUR_API_KEY'); const testStart = new Date(); // Only look for messages after our test began // Send an SMS message to your test number... const message = await mailosaur.messages.get('SERVER_ID', { sentTo: '1234567890' // YOUR_TEST_NUMBER }, { receivedAfter: testStart }); console.log(message.text.body); // "Your order number is 51223" console.log(message.text.codes[0].value); // "51223" ``` ```cypress const testStart = new Date(); // Only look for messages after our test began // Send an SMS message to your test number... cy.mailosaurGetMessage('SERVER_ID', { sentTo: '1234567890' // YOUR_TEST_NUMBER }, { receivedAfter: testStart }).then(message => { cy.log(message.text.body); // "Your order number is 51223" cy.log(message.text.codes[0].value); // "51223" }) ``` ```python from mailosaur import MailosaurClient from mailosaur.models import SearchCriteria from datetime import datetime mailosaur = MailosaurClient("YOUR_API_KEY") test_start = datetime.now() # Only look for messages after our test began # Send an SMS message to your test number... criteria = SearchCriteria() criteria.sent_to = "1234567890" # YOUR_TEST_NUMBER message = mailosaur.messages.get("SERVER_ID", criteria, received_after=test_start) print(message.text.body) # "Your order number is 51223" print(message.text.codes[0].value) # "51223" ``` ```java MailosaurClient mailosaur = new MailosaurClient("YOUR_API_KEY"); Date testStart = new Date(); // Only look for messages after our test began // Send an SMS message to your test number... MessageSearchParams params = new MessageSearchParams(); params.withServer("SERVER_ID") .withReceivedAfter(testStart); SearchCriteria criteria = new SearchCriteria(); criteria.withSentTo("1234567890"); // YOUR_TEST_NUMBER Message message = mailosaur.messages().get(params, criteria); System.out.println(message.text().body()); // "Your order number is 51223" System.out.println(message.text().codes.get(0).value()); // "51223" ``` ```csharp var mailosaur = new MailosaurClient("YOUR_API_KEY"); var testStart = DateTime.Now; // Only look for messages after our test began // Send an SMS message to your test number... var criteria = new SearchCriteria() { SentTo = "1234567890" // YOUR_TEST_NUMBER }; var message = mailosaur.Messages.Get("SERVER_ID", criteria, receivedAfter: testStart); Console.WriteLine(message.Text.Body); // "Your order number is 51223" Console.WriteLine(message.Text.Codes[0].Value); // "51223" ``` ```ruby require 'mailosaur' mailosaur = Mailosaur::MailosaurClient.new("YOUR_API_KEY") test_start = DateTime.now # Only look for messages after our test began # Send an SMS message to your test number... criteria = Mailosaur::Models::SearchCriteria.new() criteria.sent_to = "1234567890" # YOUR_TEST_NUMBER message = mailosaur.messages.get("SERVER_ID", criteria, received_after: test_start) print(message.text.body) # "Your order number is 51223" print(message.text.codes[0].value) # "51223" ``` ```php require_once('vendor/autoload.php'); use Mailosaur\MailosaurClient; use Mailosaur\Models\SearchCriteria; $mailosaur = new MailosaurClient('YOUR_API_KEY'); $testStart = new \DateTime(); // Only look for messages after our test began // Send an SMS message to your test number... $criteria = new SearchCriteria(); $criteria->sentTo = '1234567890'; // YOUR_TEST_NUMBER $message = $mailosaur->messages->get('SERVER_ID', $criteria, 10000, $testStart); print($message->text->body); // "Your order number is 51223" print($message->text->codes[0]->value); // "51223" ``` ```go m := mailosaur.New("YOUR_API_KEY"); testStart := time.Now(); // Only look for messages after our test began // Send an SMS message to your test number... params := &mailosaur.MessageSearchParams { Server: "SERVER_ID", ReceivedAfter: testStart, } criteria := &mailosaur.SearchCriteria { SentTo: "1234567890", // YOUR_TEST_NUMBER } message, err := m.Messages.Get(params, criteria) if (err != nil) { t.Error(err) } if message != nil { fmt.Println(message.Text.Body); // "Your order number is 51223" fmt.Println(message.Text.Codes[0].Value); // "51223" } ``` > [!LINK](/docs/sms-testing/phone-numbers) > ### Test phone numbers > Learn to test SMS functionality with Mailosaur. Request, cost, and allocate mobile phone numbers for testing. > [!LINK](/docs/sms-testing/replying) > ### Replying to SMS messages > Enhance your SMS testing capabilities by simulating user replies. Utilize Mailosaur's reply function for a comprehensive SMS testing solution. --- Source: https://mailosaur.com/docs/sms-testing/phone-numbers # Test phone numbers Phone numbers let you receive SMS messages in Mailosaur. Each phone number is dedicated to your account and linked to an inbox — any SMS sent to that number appears as a message in the linked inbox. ## Number types ### Standard numbers Standard numbers are available for the following countries and are provisioned immediately: - United Kingdom (UK) - United States (US) - Canada Pricing for standard numbers is available on the [Mailosaur pricing page](/pricing). ### Premium numbers Premium numbers are available for countries outside the UK, US, and Canada. To set up a premium number, contact the [Mailosaur support team](/contact), who will guide you through the process. Some countries have additional regulatory requirements (such as address verification), which will be discussed during setup. ## Messaging support Mailosaur supports any type of SMS message, including plain text messages and OTP codes. Some numbers also support MMS — contact the [support team](/contact) if you are unsure whether your number supports MMS. ### Replying to SMS You can reply to SMS messages from within Mailosaur. If you are replying using a US number, that number must be set up for 10DLC (10-Digit Long Code) compliance. The Mailosaur support team can set up 10DLC for you. ### Sending SMS Outbound SMS sending is available to certain Enterprise customers only. Contact the [sales team](/contact) to learn more. ## Set up a phone number 1. Navigate to the **Phone numbers** section. 2. Click **Add phone number**. 3. Select the country for your new phone number from the available options. 4. Select the inbox to link the phone number to. 5. Click **Add**. The number is assigned randomly. If you need a specific area code, contact the [sales team](/contact). The number of phone numbers available to your account depends on your plan. If you need more, contact the [sales team](/contact). ## Change the inbox linked to a phone number You can reassign a phone number to a different inbox. After the change, new SMS messages sent to that number appear in the new inbox. Existing messages remain in the original inbox. 1. Navigate to the **Phone numbers** section, or click the edit icon next to the inbox name in the inbox's phone numbers tab. 2. Find the phone number you want to reassign. 3. Select the new inbox from the dropdown. 4. Click **Move phone number**. ## Delete a phone number 1. Navigate to the **Phone numbers** section. 2. Find the phone number you want to remove. 3. Click **Delete**. 4. Confirm the deletion. ### What happens when you delete a phone number - The phone number is released and can no longer receive SMS messages. - Existing SMS messages in the linked inbox are not affected. - When you next set up a phone number, any previously deleted numbers are automatically reassigned before a new number is provisioned. --- Source: https://mailosaur.com/docs/sms-testing/replying # Replying to SMS messages Use the reply function to simulate a user replying to one of your SMS messages. If your product is capable of handling SMS replies from your customers (e.g. to opt out of further messages), you can use Mailosaur’s reply feature to simulate such a scenario. When you reply, the SMS message is sent back to the phone number it was originally sent to Mailosaur from. Before you can reply to SMS for the first time, you may need to contact [our support team](/contact) to configure the number, so that it is able to reply. ## Content filtering In order to prevent misuse and ensure compliance with our industry obligations, Mailosaur restricts SMS replies to single words and certain pre-approved phrases (e.g. "Opt out", "Yes please", "No thanks"). These pre-approved phrases apply to all accounts. Enterprise customers have more fine-grained control over what they can send with their phone numbers. For more information on configuring these restrictions, [contact support](/contact). ## Replying to an SMS message You can reply to SMS messages within the Mailosaur Dashboard, or via the API: 1. Open one of your messages within the Mailosaur Dashboard. 2. Click the **Reply** button, at the top of the screen. 3. Enter a text body for the reply. 4. When you are finished, click **Send**. ```nodejs // MESSAGE_ID: The `id` of the message you want to reply to await mailosaur.messages.reply('{MESSAGE_ID}', { text: 'STOP' }); ``` ```cypress // MESSAGE_ID: The `id` of the message you want to reply to cy.mailosaurReplyToMessage('{MESSAGE_ID}', { text: 'STOP' }); ``` ```python body = "STOP" options = MessageReplyOptions(text=body) # MESSAGE_ID: The `id` of the message you want to reply to mailosaur.messages.reply("{MESSAGE_ID}", options) ``` ```java MessageReplyOptions options = new MessageReplyOptions(); options.withText("STOP"); // MESSAGE_ID: The `id` of the message you want to reply to mailosaur.messages().reply("{MESSAGE_ID}", options); ``` ```csharp // MESSAGE_ID: The `id` of the message you want to reply to mailosaur.Messages.Reply("{MESSAGE_ID}", new MessageReplyOptions() { Text = "STOP" } ); ``` ```ruby options = Mailosaur::Models::MessageReplyOptions.new() options.text = 'STOP' # MESSAGE_ID: The `id` of the message you want to reply to mailosaur.messages.reply('{MESSAGE_ID}', options) ``` ```php $options = new MessageReplyOptions(); $options->text = 'STOP'; // MESSAGE_ID: The `id` of the message you want to reply to $mailosaur->messages->reply('{MESSAGE_ID}', $options); ``` ```go // MESSAGE_ID: The `id` of the message you want to reply to m.Messages.Reply("{MESSAGE_ID}", &MessageReplyOptions{ Text: "STOP", }) ``` --- Source: https://mailosaur.com/automation # Automate tests you never thought you could No repetitive tasks, no cluttered inboxes, no time wasted. Mailosaur allows you to automate time-consuming email and SMS tests, like OTPs and password resets, so nothing gets missed. - [Book a demo](/demo) - [Start your free trial](/app/signup) ## Transform end-to-end testing in minutes, not days Set it up once and test the entire flow - from the moment a message is triggered to when your user acts on it. Create an end product you can rely on, ensuring your users never run into broken or missing messages, all without those repetitive and time consuming manual checks. ## Test what actually matters Logins, password resets, and [MFA](/mfa) flows are critical touchpoints that deserve full testing. Mailosaur tests your most important interactions, from secure authentication to transactional emails, so you can trust your users will receive all communications as intended. ## Stay in sync Collaboration is the key to ensuring a great end product, but communication takes time. Empower your team and easily stay in sync by giving them access to every message and all test results, in one simple dashboard. ## Generate previews within CI/CD Previews don't have to be separate from your workflows; our Enterprise plans allow you to automate preview generation across countless devices, email clients, and even light and dark modes to ensure all of your customers are getting the exact message you're aiming to send. - [More on previews](/email-previews) ## But what would happen if...? Simulate real-world scenarios, from out-of-office replies to server errors, and trust your product is ready for all possibilities. Uncover hidden issues without the leg work. ## Works with any test framework That’s right - Mailosaur works with the tools you’re already using. Support for multiple frameworks, even within one organisation. - [Cypress](/cypress) - [Ghost Inspector](/ghost-inspector) - [Insomnia ](/docs/automation/insomnia) - [Selenium](/docs/automation/selenium) - [Playwright](/playwright) - [Postman](/postman) - [Robot Framework](/robot-framework) - [TestCafe](/docs/automation/testcafe) - [WebdriverIO](/docs/automation/webdriverio) - [PowerShell](/docs/automation/powershell) ## Don't just take our word for it > Getting started with Mailosaur proved to be remarkably easy and convenient, paving the way for a seamless transition into a more automated and efficient testing framework. — Mekin Orun, Manager of Software Quality Engineering, Domino's [Learn more](/customers/dominos) ## Take the pressure off You shouldn’t have to write scripts for bounced emails or dig through cluttered test logs. Mailosaur makes it easy to: ### Easily organise tests Create new email addresses for every test, with no set up or configuration required ### View results See every test result in one simple, intuitive dashboard ### Empower your team Give every teammate their own inbox and virtual device to work independently ## Frequently asked questions ### Where can I find guides and documentation? Our [documentation pages](/docs) will show how quick and easy it is to integrate Mailosaur with your existing stack. There are specific guides for [popular test frameworks](/docs/automation) as well as for our [official API client libraries](/docs/automation). ### Does Mailosaur offer custom plans for enterprises or high-volume teams? Yes, we will work with you to build a solution tailored to you and your team's needs, which may include things like access to phone numbers in any of our supported countries, extra seats, high volume SMS capabilities and hands-on onboarding along with support throughout. [Reach out to our team](/contact) in order to discuss the possibilities. ### Can I try Mailosaur or speak to someone before committing to purchase? Yes. You can start with a [14‑day free trial](/app/signup) to explore Mailosaur on your own. If you’d prefer guidance, you can also [book a demo](/demo) to discuss your specific use case, whether that’s [marketing](/marketing) email [QA](//quality-assurance), automated transactional testing, or authentication workflows, before making a decision. ### Can I find out more about how other companies have used Mailosaur? Absolutely! We have a number of [customer stories](/customers) available on our website, ranging from startups to huge industry-leaders, with more added all the time. To start with, why not take a look at [Department for Education](/customers/the-department-for-education), [Domino's Pizza](/customers/dominos), or [OakNorth Bank](/customers/oaknorth). ## Ready to get started? Book a live demo with our sales team, or dive in independently Start automating your email and SMS in minutes with your free trial. - [Try it for free](/app/signup) - [Book a demo](/demo) --- Source: https://mailosaur.com/contact # Contact our team Get in touch and let us know how we can help. The Square Basing View Basingstoke Hampshire RG21 4EB United Kingdom - [sales@mailosaur.com](mailto:sales@mailosaur.com) - [support@mailosaur.com](mailto:support@mailosaur.com) --- Source: https://mailosaur.com/cucumber # Use Cucumber to test user interaction, in minutes From email notifications to SMS alerts, promotional offers to authentication Mailosaur lets you build end-to-end tests for common customer actions that would usually require manual testing, like resetting a password. - [Get started](/app/signup) - [How it works](#mailosaur-works-by-capturing-every-message-you-send) ## Trusted by leading brands worldwide ## Increase test coverage by testing these common scenarios Reduce manual testing, speed up releases and avoid test regression ### Links sent to end users Complete the end-to-end testing of password reset workflows, account verification, rescheduling a delivery, or unsubscribing. 
Use Cucumber to validate that [emails](/email-testing) and SMS messages contain the right content, target the right audience, and include valid links that work every time. Plus ensure links expire after a certain period of time. ### Multi-factor authentication Test [multi-factor authentication](/mfa) (MFA) and two-factor authentication (2FA) workflows end-to-end, from login attempt through to successful account access. 

Use Cucumber to verify that authentication emails or SMS messages are sent correctly, contain valid OTP codes, and are delivered to the right users.

 Validate the functionality and security of MFA and 2FA links and codes by ensuring they work as expected and expire within the defined time limit. ### Email notifications Automate and test [email](/email-testing) notification workflows, from trigger events to successful delivery. Use Cucumber to validate that notifications are sent with the correct content, reach the intended recipients, and include functional links or actions.

 Test for consistency, ensuring emails are formatted correctly across devices, contain accurate timestamps, and comply with expiration or time-sensitive requirements. ### SMS messages Thoroughly test SMS message workflows to ensure they function. Use Cucumber to validate that SMS messages are correctly targeted, deliver accurate content, and include operational links or codes.

 Focus on reliability by testing prompt delivery, proper formatting, and compliance with expiration timelines to ensure secure and user-friendly communication. ## Mailosaur ### Mailosaur works by capturing every message you send #### Unlimited test email addresses Every inbox in your account gives you instant access to an infinite number of email addresses to test with. With no setup required, you can use a unique address for every test case, scenario or team.  #### International phone numbers Instead of using personal devices, which rely on staff availability and geography. Access phone numbers from around the world and grant team member access so that you can test together. #### An API loved by testers Built for QA automation, Mailosaur’s API allows testers to integrate email, SMS and 2FA testing directly into their existing tech stack. Our customers love our easy-to-use documentation and the speed in which they got started. #### Assertions in your library It does not matter what programming language or test framework you use. With official API clients for all major programming languages, you can build test cases and write assertions in the way you’re used to. ## Automate tests in minutes With just a few lines of code added to your project When you test with [Python, Java, Javascript](/docs/automation), Mailosaur is quick to integrate within Cucumber, requiring just a few lines of code and a few minutes of your time. 

Enjoy seamless, reliable test automation with Mailosaur, enabling rapid validation of user interactions and ensuring consistent, high-quality results across all your test environments. ## Customer stories > Mailosaur's user-friendly API seamlessly integrates into existing workflows, delivering reliable automation that accelerates development cycles and enhances product quality. — Luke Elliot, Director of Engineering, OakNorth [Learn more](/customers/oaknorth) ## QA automation tailored to your industry Mailosaur is loved across all industries, helping test the world’s most popular products and services. ### Financial Automate the end-to-end testing of [fintech](/industries/financial) helpdesk responses and payment reminders for overdue payments to timely replies to enquiries. ### Healthcare Validate [patient alerts](/industries/healthcare), like appointment bookings to reminders. Test real scenarios, such as invalid contact details, to test alerts work. ### Media Test and automate to identify issues early. Test event invites & promos include correct details, RSVP links, codes, and subscription info. ### Retail Automate testing for [retail orders](/industries/retail), promo codes, and shipping updates to detect issues early and ensure a seamless customer experience. ### Travel Test [real-world scenarios](/industries/travel) like flight updates, delays, gate changes, booking confirmations, check-in reminders, and itinerary updates. ### Automotive Test updates for vehicles or parts. Like tracking numbers, delivery times, and shipping notifications. ## Automate anything your users might do Automate end-to-end scenarios, validate emails, and integrate with our API for seamless workflows. Start your 14 day free trial today. - [Book a demo](/demo) - [Start free trial ](/app/signup) --- Source: https://mailosaur.com/cypress # Use Cypress to test user interaction, in minutes From email notifications to SMS alerts, promotional offers to authentication Mailosaur lets you build end-to-end tests for common customer actions that would usually require manual testing, like resetting a password. - [Get started](/app/signup) - [How it works](#mailosaur-works-by-capturing-every-message-you-send) ## Trusted by leading brands worldwide ## Increase test coverage by testing these common scenarios Reduce manual testing, speed up releases and avoid test regression ### Links sent to end users Complete the end-to-end testing of password reset workflows, account verification, rescheduling a delivery, or unsubscribing. 
Use Cypress to validate that [emails](/email-testing) and SMS messages contain the right content, target the right audience, and include valid links that work every time. Plus ensure links expire after a certain period of time. ### Multi-factor authentication Test [multi-factor authentication](/mfa) (MFA) and two-factor authentication (2FA) workflows end-to-end, from login attempt through to successful account access. 

Use Cypress to verify that authentication emails or SMS messages are sent correctly, contain valid OTP codes, and are delivered to the right users.

 Validate the functionality and security of MFA and 2FA links and codes by ensuring they work as expected and expire within the defined time limit. ### Email notifications Automate and test email notification workflows, from trigger events to successful delivery. Use Cypress to validate that notifications are sent with the correct content, reach the intended recipients, and include functional links or actions.

 Test for consistency, ensuring emails are formatted correctly across devices, contain accurate timestamps, and comply with expiration or time-sensitive requirements. ### SMS messages Thoroughly test [SMS message](/sms-testing) workflows to ensure they function. Use Cypress to validate that SMS messages are correctly targeted, deliver accurate content, and include operational links or codes.

 Focus on reliability by testing prompt delivery, proper formatting, and compliance with expiration timelines to ensure secure and user-friendly communication. ## Mailosaur ### Mailosaur works by capturing every message you send #### Unlimited test email addresses Every inbox in your account gives you instant access to an infinite number of email addresses to test with. With no setup required, you can use a unique address for every test case, scenario or team.  #### International phone numbers Instead of using personal devices, which rely on staff availability and geography. Access phone numbers from around the world and grant team member access so that you can test together. #### An API loved by testers Built for QA automation, Mailosaur’s API allows testers to integrate email, SMS and 2FA testing directly into their existing tech stack. Our customers love our easy-to-use documentation and the speed in which they got started. #### Assertions in your library It does not matter what programming language or test framework you use. With official API clients for all major programming languages, you can build test cases and write assertions in the way you’re used to. ## Automate tests in minutes With just a few lines of code added to your project When you test with [Javascript or any other language](/docs/automation), Mailosaur is quick to integrate within Cypress, requiring just a few lines of code and a few minutes of your time. 

Enjoy seamless, reliable test automation with Mailosaur, enabling rapid validation of user interactions and ensuring consistent, high-quality results across all your test environments. - [Integrate Node.js ](/docs/automation/nodejs) ## Customer stories > Mailosaur's user-friendly API seamlessly integrates into existing workflows, delivering reliable automation that accelerates development cycles and enhances product quality. — Luke Elliot, Director of Engineering, OakNorth [Learn more](/customers/oaknorth) ## Need help getting started? Explore our comprehensive documentation, step-by-step guides, and code examples tailored for Cypress users. ### [How to test emails in Cypress](/docs/automation/cypress/email-testing) Follow our detailed guide to integrate email testing directly into your Cypress test scripts. ### [How to test SMS messages in Cypress](/docs/automation/cypress/sms-testing) Step-by-step guide to see how easily you can test SMS workflows directly within your Cypress test scripts. ### [Testing account verification with Cypress](/blog/testing-account-verification-with-cypress) Learn how to test account verification with Cypress. Step by step guide available here. ### [Cypress quickstart guide](/docs/automation/cypress/quickstart) Step by step guide to set up your testing environment, integrate Mailosaur with Cypress scripts to start testing. ## QA automation tailored to your industry Mailosaur is loved across all industries, helping test the world’s most popular products and services. ### Financial Automate the end-to-end testing of [fintech](/industries/financial) helpdesk responses and payment reminders for overdue payments to timely replies to enquiries. ### Healthcare Validate [patient alerts](/industries/healthcare), like appointment bookings to reminders. Test real scenarios, such as invalid contact details, to test alerts work. ### Media Test and automate to identify issues early. Test event invites & promos include correct details, RSVP links, codes, and subscription info. ### Retail Automate testing for [retail orders](/industries/retail), promo codes, and shipping updates to detect issues early and ensure a seamless customer experience. ### Travel Test [real-world scenarios](/industries/travel) like flight updates, delays, gate changes, booking confirmations, check-in reminders, and itinerary updates. ### Automotive Test updates for vehicles or parts. Like tracking numbers, delivery times, and shipping notifications. ## Automate anything your users might do Automate end-to-end scenarios, validate emails, and integrate with our API for seamless workflows. Start your 14 day free trial today. - [Start free trial ](/app/signup) --- Source: https://mailosaur.com/demo # Book a personalised demo We're here to answer questions and give a clear view of how Mailosaur fits into your workflow. - **Experience Mailosaur in action**, including the look and feel of the product. - **Find the right plan for you** with tailored guidance and advice. - **Get to grips with key features** ahead of your free trial. > The one email platform for testing. I like the simplicity, multiple inbox management, and integration with Cypress and Playwright. — Senior QA Engineer at a leading sustainable technologies company ## Trusted by businesses of all sizes ## What will you get out of a demo? - Make an informed decision - see the product for yourself and imagine how it'll fit into your workflows - Discuss what you hope to achieve and how Mailosaur can be customised 
to help you get there - Learn about the range of features, some of which you may not have even known about - Your questions answered - we've heard it all, there's no such thing as a silly question! ## Or why not try a free trial? Despite the huge benefits of a personalised demo, you may prefer to learn about Mailosaur in a more hands-on way.
 Why not start your 14-day free trial and see what you could achieve with Mailosaur. - [Start your free trial](/app/signup) ## Don’t just take our word for it... > If you couldn’t use Mailosaur anymore, it’d be a serious disruption. I’d only hope the replacement looks and works half as well. — Gabriel Peter-Tomas, Department for Education [Learn more](/customers/the-department-for-education) ## Frequently asked questions ### How long does a demo take? Demos usually take around 30 minutes, but we will always tailor the session to your requirements, ensuring you have plenty of time to fully understand the features you are interested in. ### Can I try the product myself after the demo? Yes, you can start a [free 14 day trial](app/signup) at any time, but setting up a demo with our team of experts is a great idea to get to grips with the product and make best use of your free trial. ### Who should attend the demo? It's up to you which members of your team and how many attend the demo. It makes sense for members of your team who will use Mailosaur most to attend the demo, as they can then have the opportunity to ask questions and see the product for themselves. ### Do I need to prepare anything before the call? No! Leave the preparation to us. If you'd like to get in touch to rearrange or ask any questions though, you are welcome to do so at any time. ## Booked your demo? Great! Why not learn more before your demo starts? From straightforward documentation for all frameworks and languages to countless customer stories, there's loads to discover to get ahead of the curve before your demo call. - [Guides for your stack](/docs) - [Customer stories](/customers) --- Source: https://mailosaur.com/early-release-group-signup # Shape what we build next Join our early release group: try new features before anyone else and help us get them right. - **Get early access** to new features and API updates, and test them in your own suites instead of a sandbox. - **Shape the roadmap** with your feedback, which goes straight to the product and engineering teams building each new feature. - **Fix the gaps** that affect your team most by telling us what’s missing, so we can get each new feature right before general release. > Mailosaur is a critical part of our test infrastructure. — QA Engineer at a leading .NET tech and performance marketing agency ## Trusted by businesses of all sizes --- Source: https://mailosaur.com/email-designer # Email designer Mailosaur’s email designer gives teams consistency, clarity, and confidence in every send. - [Start your trial](/app/signup) - [Book a demo](/demo) ## Trusted by companies of all sizes ## Preview emails exactly as customers see them Mailosaur shows how emails will appear across real email clients and devices, not simulations, allowing teams to catch layout issues and inconsistencies before they become customer-facing issues. Validating rendering early allows teams to confidently sign off, knowing the experience is consistent everywhere it matters. - [More about previews](/email-previews) ## Build accessible, inclusive email experiences Designing emails is one thing. Meeting accessibility standards and regulatory expectations is another. Mailosaur helps teams validate emails against [WCAG 2.2](https://www.w3.org/TR/WCAG22/) guidelines, so content is readable, structured correctly, and usable across a wide range of users and devices. This reduces compliance risk and delivers emails that are clearer, and more inclusive and effective. ## Design with confidence across teams Email design isn’t done in isolation. [Product](/product-management), [marketing](/marketing), [QA](/quality-assurance), and [engineering](/engineering) teams all need visibility into how messages look and perform. Mailosaur provides a shared environment for reviewing email content, gathering feedback, and approving changes. This makes review and sign-off faster, clearer, and more reliable. ## Understand compatibility before it becomes a problem Mailosaur allows teams to analyse how email code performs across environments, helping uncover compatibility issues before they affect real users. This includes identifying inconsistencies in layout, structure, and rendering across inboxes and devices. This results in a more predictable, consistent experience, regardless of where emails are opened. ## Create emails that work everywhere Mailosaur helps you move beyond guesswork and view emails exactly as your customers will, so every message feels polished, consistent, and user-ready. It helps teams collaborate more effectively, reduce last-minute changes, and deliver higher-quality email experiences with confidence. ## Now test your emails Emails do not exist in isolation, they are part of larger user journeys. Messages must be triggered at the right time, include the correct data, and support user interactions such as links, logins, and verification steps. Use Mailosaur's message testing to validate how messages behave across email and [SMS](/sms-testing), ensuring they are delivered, triggered, and used exactly as intended. - [More on message testing](/message-testing) ## Give it a go Test end-to-end scenarios, validate emails, and integrate with our API for seamless workflows. Start your 14-day free trial or book a demo with one of our experts. - [Start free trial](/app/signup) - [Book a demo](/demo) --- Source: https://mailosaur.com/email-on-acid-vs-mailosaur # Looking for an alternative to Email on Acid? Preview real emails, not test versions. Email on Acid helps you check how your email designs render across inboxes. Mailosaur goes beyond the preview, letting you capture real emails and test how they look, behave and function. - [Start for free](/app/signup) - [Request a demo](/demo) ## Trusted by leading brands worldwide ## See what your customers will see Emails can look great in one inbox and completely different in another. With Mailosaur, you can preview emails across popular email clients, devices and settings, helping you find problems before your customers do. ### Preview across email clients See how your emails render across Gmail, Outlook, Apple Mail and more. ### Check across desktop, mobile, light and dark modes Make sure your emails look right across different devices, screen sizes and settings. ### Preview real email content Check how emails with personalisation and dynamic content will appear to your customers. ### Catch rendering issues Find broken images, formatting problems, layout inconsistencies and dark mode issues while there’s still time to fix them. ## Test more than how your email looks End-to-end email QA that catches issues before your customers do. Mailosaur gives your teams a complete way to perform full QA email testing – not just see how your emails will look. Check rendering across inboxes and devices while also testing links, content, personalisation, attachments, accessibility and more. It's a simple way to spot problems before they reach your customers and keep the entire email testing process in one place. - [Try Mailosaur free](/app/signup) ## Preview your emails in minutes - Send your email directly to Mailosaur or paste in your HTML. - Choose the email clients and devices you want to check. - Generate your previews and see exactly how your email looks across different inboxes. - Spot the problem. Make your changes. Check again. ## Why choose Mailosaur? ### Preview every email See how personalisation and dynamic content renders across different devices and real inboxes, exactly as recipients will see them. ### Review together Go from review to sign-off faster by simplifying how you share previews and collect feedback from teammates and stakeholders. ### Automation-ready Start with manual [email previews](/email-previews) any team member can use, then automate previews as part of your QA workflow when you're ready. ## Go beyond Email Previews Mailosaur is built for teams that care about the quality of the emails their products and businesses send. Alongside Email Previews, Mailosaur helps teams [test email](/email-testing) and [SMS workflows](/sms-testing), check email content, validate links and codes, and [automate email testing](/automation) as part of their existing QA processes. Start with [Email Previews](/email-previews) and use more of Mailosaur when you need it. - [Request a demo](/demo) ## Customer stories > Getting started with Mailosaur was extremely easy. The interface was intuitive, easy to learn and navigate, making the transition seamless for our team. — Rohit Sonak Sr. Director, Quality Engineering [Learn more](/customers/malwarebytes) ## Find the right plan for your team Compare pricing plans to find the best fit for your team, company, and email preview needs. - [Explore pricing](/pricing#previews) ## QA automation tailored to your industry Mailosaur is loved across all industries, helping test the world’s most popular products and services. ### Financial Test banking alerts, two-factor authentication, account updates and more to ensure bulletproof quality with zero surprises. ### Healthcare Validate [patient alerts](/industries/healthcare), such as appointment bookings and reminders, by testing real scenarios like invalid contact details to test alerts work. ### Media Test and automate to identify issues early. Ensure event invites and promos include the correct details, RSVP links, codes, and subscription info. ### Retail Automate testing for [retail orders](/industries/retail), promo codes, and shipping updates to detect issues early and ensure a seamless customer experience. ### Travel Test [real-world scenarios](/industries/travel) like flight updates, delays, gate changes, booking confirmations, check-in reminders, and itinerary updates. ### Automotive Test updates for vehicles or parts – from tracking numbers and delivery times to shipping notifications. ## Ready for an Email on Acid alternative? Take the guesswork out of email previews with a simpler way to review, refine and approve every email. Get started with your free 14-day trial today. - [Start free trial](/app/signup) --- Source: https://mailosaur.com/email-previews # See how your emails look before you hit send Check how your emails render in every major client and device, from Gmail on Android to Apple Mail on macOS, before they reach customers. ## Join thousands of companies using Mailosaur ## Take the guesswork out of your emails ### Preview every email in every inbox Catch display differences early and make sure every message looks right before reaching customers- protecting your brand from small mistakes that can quickly become public. ### Validate dynamic content Whether the message was built by marketing, product, or design, preview emails exactly as your users receive them, including personalisation and conditional content. ### Catch rendering issues Identify broken images, layout inconsistencies, dark‑mode issues, and formatting problems instantly- without digging through code. ## Review, compare, share, sign off Share previews securely with teammates and stakeholders, without forwarding test emails or exposing real inboxes. Compare previews side by side to spot differences across inboxes and email clients. Pin comments to the exact spot that needs attention. Teammates can reply in threads and react with emojis, so feedback stays centralized and you move from review to sign-off faster. ## Coverage for different devices, email clients and settings Did you know your emails will render differently across different devices and [email clients](/message-testing)? Mailosaur’s real‑device previews show you how emails actually render in the inboxes your customers use, not just how they look in a sending tool or editor. Plus, you can save the clients and devices you test most often as presets to make repeat testing quicker.  ## Fix issues you'd never spot otherwise With the preview feature, it is easier than ever to see exactly which parts of an email are causing problems. Whether it’s a broken image, formatting errors, issues with dynamic fields - Mailosaur makes troubleshooting quick and easy. ## Why Mailosaur? There are so many reasons that Mailosaur is the best email preview tool for your workflow. ### Fully native device previews Mailosaur previews are fully native, providing the most accurate simulation of how content or applications will appear and function on actual physical hardware ### Team collaboration Keep everyone on the same page with options to share previews, leave comments and set permissions for specific projects. ### Broad client & device coverage With coverage across countless email clients and devices, you can be confident that Mailosaur covers everything you need to see. ### Built for review, ready to automate Built with QA and automation in mind, you can manually generate previews anyone on your team can use, or automate as part of your workflows. ## Save yourself time and automate it With one of our Enterprise plans, you can take your testing to the next level automating preview generation as part of your regular workflows. - [More on automation](/automation) ## Go beyond previews with HTML checks Email previews are essential for validating how your email renders across clients. However, they show the result, not the cause. Use Mailosaur’s compatibility checks to understand how your HTML is supported across email clients, and accessibility checks to validate your email against WCAG 2.2 guidelines. Together, they help you identify issues in your markup and fix them before send. - [More about compliance checks](/email-designer) ## Cover every message-driven journey Previews show how email look, but complete confidence comes from knowing they work. Test the behaviour of email and SMS across critical workflows like sign‑up, [authentication](/mfa), notifications, and recovery flows. Together, previews and testing ensure every message looks right and functions correctly before customers interact with it. - [More on Email Testing ](/email-testing) - [More on SMS Testing ](/sms-testing) ## Frequently asked questions ### What are Mailosaur Email Previews and how do they differ from emulated screenshots? Mailosaur [Email Previews](/email-previews) show exactly how emails render in real inboxes using real devices, not simulations. Unlike emulated screenshots, they reflect genuine client behaviour, including dark mode, [rendering quirks](/blog/fix-rendering), and layout differences so teams can spot issues that only appear in real-world email environments before sending. ### Why is email so hard to test properly? Email is one of the most fragile parts of a product. It [renders differently](/blog/fix-rendering) across inboxes and devices, relies on dynamic data, and often triggers critical user actions. Traditional testing methods (personal inboxes, manual checks, or ESP previews) don’t reflect the differences in those real conditions. Mailosaur gives teams a safe, realistic way to test email behaviour before it becomes customer facing. ### Can I use Mailosaur for visual review and sign‑off, not just testing? Absolutely. Many teams use Mailosaur [Email Previews](/email-previews) for visual review, stakeholder feedback, and sign‑off, even when no automation is involved. You can share previews securely and collect feedback asynchronously, without forwarding emails or cluttering personal inboxes. ### Should accessibility and compatibility checks be done instead of previews? No. These features are designed to work alongside [previews](/email-previews). Previews show how your email renders, compatibility explains why it renders that way, and accessibility ensures the content is usable. Using all three together gives you more complete test coverage. ### Is Mailosaur only for engineers and QA teams? No. While Mailosaur is widely used by engineers and QA teams for automation, it’s also used by Product Managers and Marketing teams, as well as other teams responsible for product messaging. Non‑technical users commonly use Mailosaur to review emails visually, share previews for approval, validate journeys end to end, and sign off campaigns or product flows without relying on personal inboxes or production sends. ### Is Mailosaur secure for testing sensitive and regulated workflows? Yes. Mailosaur is designed for testing sensitive workflows like account verification, password resets, payment alerts, and two-factor authentication notifications. You can test safely in development or staging, control data retention, and avoid using real customer data, making it suitable for teams with strict security or [compliance requirements](/blog/compliance-governance-security). ### Can I try Mailosaur or speak to someone before committing to purchase? Yes. You can start with a [14‑day free trial](/app/signup) to explore Mailosaur on your own. If you’d prefer guidance, you can also [book a demo](/demo) to discuss your specific use case, whether that’s [marketing](/marketing) email [QA](//quality-assurance), automated transactional testing, or authentication workflows, before making a decision. ## Test anything your users might do Automate end-to-end scenarios, validate emails, and integrate with our API for seamless workflows. Book a demo with one of our team or start your free trial today. - [Book a demo](/demo) - [Free trial](/app/signup) --- Source: https://mailosaur.com/email-testing # Test everything that relies on email Securely test every email‑driven workflow, from sign‑ups to alerts, across realistic environments before customers rely on them. - [Book a demo](/demo) - [Start your free trial](/app/sign-up) ## Join thousands of businesses who rely on Mailosaur ## Go beyond basic email testing Don't settle for being "pretty sure" your emails are hitting the mark. ### Unlimited test accounts Stop relying on personal inboxes and fragile workarounds.
 Create unlimited test addresses to simulate real users, edge cases, and journeys, without polluting real systems or inboxes. ### Capture every email Catch every email your product sends; whether emails arrive and render correctly, and even automatically extract and test links and dynamic content. ### Mimic real scenarios Mailosaur allows you the freedom to replicate real world scenarios including deliverability validation, and validating tokens and [OTPs](/mfa) (one-time passcodes). ## Eliminate mistakes before customers see them From broken layouts to missing data or failed verification emails, Mailosaur helps teams prevent issues that directly impact conversion, trust, and security. Whether you’re building, testing, or approving customer journeys, you can verify and preview emails in realistic conditions without relying on guesswork. ## Automate processes you never thought you could When email flows are automated, testing needs to be just as reliable. Use Mailosaur’s API to automate end‑to‑end testing for email‑driven journeys, from [OTP extraction](/mfa) to cancellation and recovery flows, as part of your CI/CD pipeline. - [More about automation](/automation) ## Check more than just visuals To fully validate an email, you also need to check the underlying HTML. Use Mailosaur's accessibility checks to ensure your content meets [WCAG 2.2](https://www.w3.org/TR/WCAG22/) guidelines and can be used with assistive technologies. Then use compatibility checks to identify elements that may not be supported across email clients, and fix them before a single customer receives them. - [More on compliance checks](/email-designer) ## What do our customers think? See reviews and [case studies](/customers) from companies who trust us with their email monitoring/ QA needs. > A lot of our automation that deals with email relies on [Mailosaur]. The setup for validating links inside of the emails was very easy to work with in the Mailosar API. — Ryan, Engineering Manager in Computer Software [Learn more](https://www.capterra.com/p/201911/Mailosaur/#Capterra___4797898) > Excellent customer support, they are very knowledgeable about their tool, every time I have ended conversations with Mailosaur support I have ended it with the solution to my problem. — Lee W, Senior Test Automation Engineer in Insurance [Learn more](https://www.capterra.com/p/201911/Mailosaur/#Capterra___6143208) > Our automated testing is a breeze with Mailosaur and I use for manual QA as well. The emails show up incredibly fast and it seamlessly integrates with Cypress. I recommend them unreservedly. — Caroline, CEO in Computer Software [Learn more](https://www.capterra.com/p/201911/Mailosaur/#Capterra___6144119) ## Don’t just assume consistency Cover all bases and generate previews of your emails across countless devices, email clients, and even light and dark modes to ensure all of your customers are getting the exact message you're aiming to send.  - [More about previews](/email-previews) ## It doesn't end when you hit send Email is rarely the end of a journey, it’s often the trigger for a longer flow. Test what happens when users interact with emails, including replies, forwards, incorrect OTP entry, and unexpected paths. - [More on replying and forwarding](/features/send-reply-forward) ## Why stop there? Mailosaur covers every message‑driven journey. Built for robust and comprehensive quality assurance, you can test all sorts of flows end to end.  ### Email Previews See exactly [how your emails will render](/email-previews) across devices, email clients, and settings (e.g. light and dark mode), and ensure every customer gets five-star communication. ### SMS Testing Ensure your [time-sensitive SMS](/sms-testing) are dispatched and delivered exactly when your customers need them, with the added benefit of dedicated test numbers. ## Used across teams and industries QA teams ensure reliability. Product teams protect journeys. Marketing teams avoid brand‑damaging mistakes. If your product sends emails, they’re part of the experience, and they need to be tested. ## Made to fit into your existing stack Mailosaur meets you where you are, integrating with frameworks you know and love, and unlocking new levels of QA for your messages. - [Cypress](/cypress) - [Ghost Inspector](/ghost-inspector) - [Insomnia ](/docs/automation/insomnia) - [Playwright](/playwright) - [TestCafe](/docs/automation/testcafe) - [Robot Framework](/robot-framework) - [PowerShell](/docs/automation/powershell) - [Postman](/postman) - [Selenium](/docs/automation/selenium) - [WebdriverIO](/docs/automation/webdriverio) - [See our docs](/docs) ## Frequently asked questions ### What do you mean by “email testing”? Email testing is about inspecting your emails, with the hope of ensuring they are sent and received as you intend. With Mailosaur, teams test how emails behave in real journeys, including sign‑ups, password resets, verification links and alerts. This helps catch issues that break trust, [security](/blog/compliance-governance-security), or conversion, so they can be fixed before customers ever encounter them, and can also help optimize key performance indicators such as open rates and click-through rates. ### Why is email so hard to test properly? Email is one of the most fragile parts of a product. It [renders differently](/blog/fix-rendering) across inboxes and devices, relies on dynamic data, and often triggers critical user actions. Traditional testing methods (personal inboxes, manual checks, or ESP previews) don’t reflect the differences in those real conditions. Mailosaur gives teams a safe, realistic way to test email behaviour before it becomes customer facing. ### Can Mailosaur be used for automated email and SMS testing? Yes. Mailosaur provides APIs designed specifically for automated testing of email and SMS within modern test frameworks and CI/CD pipelines. Engineering and QA teams commonly use Mailosaur to automate workflows such as account verification, [OTP delivery](/mfa), password reset flows, and negative testing scenarios using tools like [Cypress](/docs/automation/cypress), [Selenium](/docs/automation/selenium), [Playwright](/docs/automation/playwright), [Cucumber](/docs/automation/cucumber), and [Postman](/docs/automation/postman). ### What are Mailosaur's compliance checks? Mailosaur's [compliance checks](/email-designer) encompass the panel in Mailosaur which tests the accessibility and compatibility of your emails. By this, we mean your email's accessibility is tested against [WCAG 2.2](https://www.w3.org/TR/WCAG22/) guidelines, to level AA, and issues with accessibility are flagged for you to fix. Beyond this, you can check your email's compatibility across email clients, using its HTML alone. Mailosaur will flag HTML elements that won't render correctly on specific clients, and even flag where in your code the issues lie. ### Can Mailosaur test authentication flows like OTP, MFA, and password resets? Yes. Mailosaur is commonly used to automate testing of [authentication](/mfa) and verification flows, including OTP emails, SMS [codes](/features/links-and-codes), and multi‑factor authentication. Teams use it to confirm codes are delivered correctly, can be extracted automatically, expire as expected, and don’t fail under edge cases- reducing login issues and account lockouts in production. ### Can I use Mailosaur to validate email content and attachments? Yes. Mailosaur allows you to fetch messages, validate content such as [links, verification or promo codes, and attachments](/features/links-and-codes), as well as the ability to [preview emails](/email-previews) across devices and email clients so you can see exactly how they'll render for your audience. ### What kinds of assertions can I perform on links? With Mailosaur, you can inspect links in your email and SMS messages as part of your automated tests or manual QA process. You can check that a link exists and matches an expected URL pattern, verify the link text or CTA label (e.g. "Reset your password"), follow the link and test the destination URL or behavior, extract query parameters or tokens for validation. These assertions help you confirm that critical flows like account activation, password resets, and confirmation pages are working as expected before your customers ever see them. ### Does Mailosaur support parallel testing? Yes. Each inbox in Mailosaur can handle concurrent email and SMS tests. You can create multiple test accounts or servers to isolate parallel test runs. ### How does Mailosaur fit into CI/CD and modern test pipelines? Mailosaur is designed to work naturally within CI/CD workflows. Tests can trigger real email or SMS sends from your application, fetch messages via API, and assert on content, [links](/features/links-and-codes), codes, and timing. It can also test end-to-end flows across both email and SMS, such as multi-factor authentication. This makes Mailosaur suitable for continuous deployment, regression testing, and monitoring message‑driven workflows safely. ## New to Mailosaur? Get started with us for free Book your free personalised demo, or start your 14-day free trial. - [Book a demo](/demo) - [Start your free trial](/app/sign-up) --- Source: https://mailosaur.com/engineering # Email & SMS test automation for engineering teams Mailosaur gives teams an isolated way to test message‑driven workflows without building and maintaining testing infrastructure. - [Try for free](/app/login) ## Trusted by engineering teams building at scale ## Focus on building features, not test infrastructure Mailosaur lets engineering teams get on with development, rather than maintaining custom testing tools ### Developer sandboxes Allow developers to send, capture and analyze emails during development, with their own personal email and SMS sandbox. ### Test email and SMS in one place Use the same code to capture and test SMS messages, with a single platform that handles all communication testing consistently. ### Environment segregation Shield your development and staging environments by configuring them to send everything to Mailosaur. ## Unlimited email addresses Use any email address you want, no code required Use a unique email address for every test, build, team member, environment, or any other use case you have. With Mailosaur supporting an unlimited number of email addresses you can use from anywhere. ## Endorsed by engineers > Pretty easy to setup and use. Support is readily available. When there was an issue is recovered, Mailosaur team was able to rollout the fix in 2 days. That’s amazing. — Devadasan K., Software Engineering Leader in Information Technology and Services [More from Devadasan](https://www.capterra.com/p/201911/Mailosaur/#Capterra___6249389) > Powerful tool for Automated testing of Emails and SMS. Very positive, if I were to change company and they didn't have a Mailosaur license I would push to get one. — Lee W., Senior Test Automation Engineer in Insurance [More from Lee](https://www.capterra.com/p/201911/Mailosaur/#Capterra___6143208) > It is fast, reliable, easy to setup and use. The rollout at both companies I used it, Extend and Siemens, was successful, and easily adopted by all. — Murat O., Staff Engineer in Information Technology and Services [More from Murat](https://www.capterra.com/p/201911/Mailosaur/#Capterra___4796823) ## Prevent flaky tests caused by shared state Mailosaur gives you email addresses and dedicated phone numbers that can be used across tests, environments, builds, and team members. Each test can operate in complete isolation, eliminating race conditions, inbox collisions, and timing‑related failures, resulting in predictable test behaviour you can trust in CI and locally. ## Enforce strict environment isolation Development, staging, and test environments can be configured to send everything to Mailosaur, ensuring no test emails reach real customers, no cross‑environment contamination occurs, and you can employ production‑like workflows without production risk ## Works naturally inside your test stack Mailosaur is designed to fit directly into real engineering workflows, whether you’re running tests locally or at scale in CI. You can: - Trigger real email and SMS sends from your application - Fetch messages programmatically - Assert on content, links, codes, and timing - Validate full end‑to‑end flows ## Catch timing and delivery‑related failures early Email and SMS issues don’t just come from missing content, they’re often caused by delays, retries, or unexpected ordering. Mailosaur lets engineers inspect when messages arrive, correlate them with actions, and validate that systems behave correctly under real‑world timing conditions, surfacing issues that mock conditions can't. ## Our products Everything you need to test customer communication. ### Email Testing Create end-to-end tests that rely on email. Test account verification emails, password resets, email tracking and more. [Learn more](/email-testing) ### Email Previews Instantly see how your email will look to any recipient, no matter what email client they use, so there are no nasty surprises. [Learn more](/email-previews) ### SMS Testing Build text messages that work. Create end-to-end tests that cover identity verification, alerting, promotional messages, and more. [Learn more](/sms-testing) ## Test user interactions today Test end-to-end scenarios, validate emails, and integrate with our API for seamless workflows. Start your 14 day free trial today. - [Contact us](/contact) - [Get started](/app/signup) --- Source: https://mailosaur.com/enterprise # Email & SMS testing for enterprise When operating at scale, email and SMS testing can fragment across tools and environments. Mailosaur brings control and consistency to customer communications. - [Get a free personalised demo](/demo) ## Modernizing enterprises around the world ## One platform, one source of truth Give every team, department and region across your enterprise one place to test, preview, comment on and approve customer-facing email and SMS. Feedback and sign-off sit right beside each preview, replacing scattered tools with one centralized platform your organization can trust. ## Protect your brand, not just your releases Broken layouts, incorrect content or expired codes are immediately visible to customers. With Mailosaur, you can prevent these failures by isolating test environments from real customers and validating messages before they reach production. ## Access control that fits your setup ### Single sign-on (SSO) Sign in with Okta, Microsoft Entra ID or any SAML or OIDC provider, and make SSO mandatory for your team. ### SCIM provisioning Add and remove users automatically, with groups synced so access follows your existing structure. ### Role-based access control (RBAC) Set permissions for teams across your account, projects and inboxes, giving new people the right access the moment they join a team. ### IP allowlisting Only allow access from IP addresses you trust, such as your office network or VPN. ## Built for governance at scale Mailosaur standardises how communication is tested without blocking delivery, with: - Shared environments for email and SMS testing - Separate projects for each team, product or region - Consistent tooling across products and departments - Auditability for how critical messages are validated ## Loved by enterprises everywhere > Awesome, easy to use email tool with REST capabilities. After hand-rolling a Python script and trying various email providers and APIs, Mailosaur was a breath of fresh air. It had a simple interface and was easy to implement, first in Postman and then in Cypress. — Byron D., Enterprise customer [More from Byron](https://www.g2.com/products/mailosaur/reviews/mailosaur-review-8087631) ## Your business is safe with the world's leading email testing platform Automate end-to-end scenarios, validate emails, and integrate with our API for seamless workflows. Start your 14 day free trial today. - [Start free trial ](/app/signup) - [Talk to sales](/contact) ## Secure by design Mailosaur is built with enterprise security and data protection at its core. The platform is ISO 27001:2022 certified, GDPR compliant, and designed with strict controls around access, data handling, and retention. From configurable message retention policies to carefully managed permissions, every aspect of Mailosaur is designed to support secure, compliant testing at scale. ## Work the way you like ### Integrate with any CI platform Seamlessly integrate email and SMS testing into any build pipeline, including support for GitHub Actions, Jenkins, TeamCity and more. ### Work with your favorite framework Write tests with tools and frameworks. Mailosaur supports testing frameworks like, Cypress, Playwright, Selenium, Robot Framework, and more. ### Create tests in any language Mailosaur's straightforward client libraries provide support for major languages, including Node.js, Java, Python, .NET, Ruby, PHP and Go. ## Our products Everything you need to test customer communication ### Email Testing Create end-to-end tests that rely on email. Test account verification emails, password resets, email tracking, and more [Find out more](/email-testing) ### Email Previews Instantly see how your email will look to any recipient, no matter what email client they use, so there are no nasty surprises. [Find out more](/email-previews) ### SMS Testing Build text messages that work. Create end-to-end tests that cover identity verification, alerting, promotional messages, and more [Find out more](/sms-testing) ## Frequently asked questions ### What support do enterprise customers get? Enterprise customers get a dedicated account manager and can add an Enterprise SLA. The SLA covers 99.9% uptime for the API, SMTP, POP3 and SMS, a 2-hour support response time (06:00–22:00 UK time, Monday to Friday) and resolution within 24 hours, with service credits if uptime falls short. ### Can I test both email and SMS with Mailosaur? Yes, Mailosaur is unique in its ability to test both [email](/email-testing) and [SMS.](/sms-testing) This means that you can test product messaging functionality end to end, for example if a flow requires you to go from an email, to then get an [OTP code](/mfa) through SMS, and then an email confirmation. This allows you the greatest visibility of your customer journey and to optimise both email and SMS communications. ### Does Mailosaur offer custom plans for enterprises or high-volume teams? Yes, we will work with you to build a solution tailored to you and your team's needs, which may include things like access to phone numbers in any of our supported countries, extra seats, high volume SMS capabilities and hands-on onboarding along with support throughout. [Reach out to our team](/contact) in order to discuss the possibilities. ### Can Mailosaur test authentication flows like OTP, MFA, and password resets? Yes. Mailosaur is commonly used to automate testing of [authentication](/mfa) and verification flows, including OTP emails, SMS [codes](/features/links-and-codes), and multi‑factor authentication. Teams use it to confirm codes are delivered correctly, can be extracted automatically, expire as expected, and don’t fail under edge cases- reducing login issues and account lockouts in production. ### Can I preview how emails look across different email clients and devices with Mailosaur? Yes, Mailosaur offers the ability to preview how your emails will look across specific devices, email clients, and even light and dark mode. This is especially beneficial when trying to account for [common rendering issues](/blog/fix-rendering) that happen on particular email clients or devices. More information on this can be found on our [Email Previews page.](/email-previews) ### Does Mailosaur support parallel testing? Yes. Each inbox in Mailosaur can handle concurrent email and SMS tests. You can create multiple test accounts or servers to isolate parallel test runs. ### What security certifications does Mailosaur have? Mailosaur is SOC 2 Type II attested, ISO 27001:2022 certified, PCI DSS compliant and GDPR compliant. To see how your data is used and protected, visit our ['Security and Trust'](/security) page. If your team needs more detail for a security review, like our SOC 2 report or a Security Assessment Pack, [reach out](/contact) to our friendly team. ### Where can I find guides and documentation? Our [documentation pages](/docs) will show how quick and easy it is to integrate Mailosaur with your existing stack. There are specific guides for [popular test frameworks](/docs/automation) as well as for our [official API client libraries](/docs/automation). ## Ready to get started? Get in touch or create an account Start your 14 day free trial today. - [Contact us](/contact) - [Get started](/app/signup) --- Source: https://mailosaur.com/faqs # Frequently asked questions Everything you need to know about getting started with Mailosaur, the product and its features, and account management. - [I have a different question](/contact) ## Trusted by businesses of all sizes ## Getting started ### How do I create my first test with Mailosaur? You can find everything you need to know about getting started and creating your first test [in our docs](/docs/automation). ### Do I need coding knowledge to use Mailosaur? You don’t need to know how to code in order to use Mailosaur. You can access unlimited ad-hoc email addresses and view captured emails and SMS messages directly in the Mailosaur dashboard without writing any code. Coding knowledge may, however, be beneficial when it comes to integrating Mailosaur into an automated testing process, where you will need to use one of its client libraries (available for languages like [Python](/docs/automation/python), [Java](/docs/automation/java), [JavaScript](/docs/automation/javascript), [Ruby](/docs/automation/ruby), and [PHP](/docs/automation/php)). With a few lines of code, you’ll have access to more comprehensive features of Mailosaur, including the ability to fetch messages automatically and extract contents of messages. ### Where can I find the API key, and how is it used? If you want to automate email and SMS testing with Mailosaur, you need to make calls to the Mailosaur API. API keys are used to authenticate requests to this API. To create an account-level API key, you must be an Administrator or Account Owner on the account in question. This access can be granted by another Administrator on your account if you do not already have this. 1. Go to the Settings page in the Mailosaur Dashboard. 2. Go to the API Keys page. 3. Click the ‘Create a Key’ button. 4. In the dialog that appears, enter a name for your key. 5. When you are finished, click ‘Create’. Find out more [on our documentation.](/docs/managing-your-account/api-keys) ### Can I see a quick start guide/ code samples? Quick guides are available for [most frameworks](/docs/automation), from Cypress and Selenium to Cucumber. In terms of samples, we have loads available on our [common test cases page](/docs/automation), where there are easy-to-follow, step by step instructions to start testing. ## Email and SMS testing ### Can I preview how emails will look with Mailosaur? Yes, Mailosaur offers the ability to preview how your emails will look across specific devices, email clients, and even light and dark mode. More information on this can be found on our [Email Previews page.](/email-previews) ### Besides previews, how else can I test emails? Mailosaur offers a wide range of functional and content validation testing features. You can test not just what the email looks like, but what it contains and how it behaves. For example, you can check the content of a message, extract and test verification codes, detect missing or broken links/images, test auto-replies, support inboxes, or ticketing flows. The possibilities are endless! See for yourself on our [Email Testing page.](/email-testing) ### Can I test 2FA flows through SMS and email? Yes! Mailosaur is a great option for testing 2FA and multi-factor authentication (MFA) flows, especially since you can test both email and SMS. This means that you can use manual or automated testing on your end-to-end authentication flows and ensure that issues are fixed before real customers ever see them. There are also plans which allow you to test authenticator app functionality so you can ensure that your customers have no issues logging in to your product. You can find out more about 2FA in our [dedicated docs](/docs/authenticator). ### How do testing-specific phone numbers work? You don’t need a physical phone or SIM card for a Mailosaur number. When you [test SMS](/sms-testing), you're assigned a [virtual phone number](/docs/sms-testing/phone-numbers). These numbers work just like regular mobile numbers, but instead of going to a handset, the messages are routed to your Mailosaur inbox, allowing you to test sms flows without the added expense of a handset. Mailosaur can also provide phone numbers for countries around the world, from Australia to Canada, Thailand to USA. However, many countries have specific requirements that mean we must handle these requests on a case-by-case basis. [Contact our support team](/contact) to discuss. ### How do I keep track of usage/ remaining allowance? Fortunately, with Mailosaur, there are no nasty surprises – you cannot go over your limit without prior agreement, which means no unexpected additional costs. For your peace of mind, there is also a usage dashboard, where you can see exactly your message allowances and keep track of them as you go. ## Security and compliance ### Is Mailosaur secure? Is my data safe? Mailosaur is ISO 27001 certified and compliant with both EU and UK GDPR, as well as other global compliance regimes. We are completely transparent when it comes to security, so would encourage you to take a look at our ['Security and Trust'](/security) page. Beyond that, you are welcome to [reach out](/contact) to our friendly team, especially if you require something like a Security Assessment Pack. This includes everything you should need when performing security due diligence, such as our ISO 27001 certificate and answers to industry standard questionnaires. ### Can I use Mailosaur in ISO 27001 compliant flows? Yes! You can use Mailosaur in workflows that require SOC 2 or ISO 27001 compliance. Mailosaur itself is ISO 27001:2022 certified and is also PCI DSS compliant and adheres to GDPR, Data Protection Act, and CCPA standards. Mailosaur is also regularly audited by independent third-party experts to ensure high levels of information security controls. With this being said if you have any hesitations, you are more than welcome to [reach out and ask questions](/contact). ### How long are test messages retained? It's up to the individual customer how long their messages are retained for, which gives you complete control over your data retention. The only caveat is that the maximum number of days is dictated by the plan you're on. ### Can I get a Security Assessment Pack? Security Assessment Packs are available upon request. These include everything you should need when performing security due diligence, such as our ISO 27001 certificate and answers to industry standard questionnaires. ### Does Mailosaur support SSO/MFA for account access? Yes, Mailosaur allows Enterprise users to log in via Google, GitHub and Microsoft authentication, but also supports Enterprise SSO providers via SAML and OpenID Connect (OIDC). This means authentication and team member account creation can be deferred to an Identity Provider (IdP) like Okta, AzureAD, Ping Identity and more. Find out more on our [single sign-on page](/docs/managing-your-account/sso). ## Want to get to know Mailosaur better? Take a look at our documentation With docs for all frameworks and quickstart guides that'll get you testing in minutes, take a moment to check out our documentation and make the most of Mailosaur's features, fast. - [Check out docs](/docs) ## Features and integrations ### What frameworks can be used with Mailosaur? Mailosaur can be integrated with a wide range of frameworks, with our docs pages including guides for [Selenium](/docs/automation/selenium), [Cypress](/docs/automation/cypress), [Playwright](/docs/automation/playwright), [Cucumber](/docs/automation/cucumber), [Robot Framework](/docs/automation/robot-framework), [Postman](/docs/automation/postman), [Insomnia](/docs/automation/insomnia), [Webdriver.IO](/docs/automation/webdriverio), [TestCafe](/docs/automation/testcafe), [PowerShell](/docs/automation/powershell) and [Ghost Inspector](/docs/automation/ghost-inspector). ### What programming languages can be used? Mailosaur integrates with your existing stack, meaning you can also use your preferred language. Our [docs pages](/docs/automation) offer specific guides for Node.js, Java, Ruby, Python, .NET, PHP, Go and Javascript. ### What kinds of assertions can I perform on links? Mailosaur allows you to perform countless assertions on links, including (but not limited to) ensuring the correct number of links are included in your messages, testing if links are broken, if tracking parameters are included. ## Plans, billing and pricing ### What plans are available, and how do they differ? Mailosaur offers Personal, Core and Enterprise plans, all of which differ in email and SMS allowances, number of seats, and access to features such as two-factor authentication. For a full breakdown of our plans, take a look at our [pricing page](/pricing#calculator). ### How do I choose the right plan for my team? If you know how many seats, emails and SMS you need, we’d recommend taking a look at our [pricing page](/pricing#calculator) and picking a plan to suit your needs. If you’re a bit more unsure or would like to discuss your options (or even create a custom plan), feel free to [get in touch](/contact). ### What package do I need to be able to use SSO? Single sign-on (or SSO) is a feature offered in Mailosaur’s Enterprise plans, but can also be an optional add-on for Core plan customers. We’d recommend taking a look at [our pricing page](/pricing#calculator) to get a better understanding of what our plans include and what can be added. ### Does Mailosaur offer discounts for non-profits? We're happy to offer a discount to eligible non-profit organizations. Please [contact us](/contact) if you'd like to learn more. ### How do I upgrade or change my plan? You can upgrade your plan any time on the Mailosaur app under 'account settings'. The only exception to this is when you'd like to upgrade to an Enterprise plan, where you'll need to [get in touch](/contact) with one of our experts. ## Support and contact ### What if I don't have access to a feature? If there’s a feature that you believe you should have access to, we’d encourage you to first double check what plan you’re on and whether you have any additional add-ons, and if you still think there’s an issue [contact our friendly team](/contact). ### How can I contact Mailosaur if I have a problem? We're sorry you're having a problem! [Reach out to us](/contact) and one of our experts will get back to you as soon as they can. ### Where can I report bugs or suggest improvements? If you think you’ve found a bug within the product or you’d like to suggest improvements, you can get in touch [using our form](/contact). ## Yet to get started with your Mailosaur journey? Don't forget your freebies! Sign up for your free personalised demo and 14 day free trial now - [Personalised demo](/demo) - [Free trial](/app/signup) --- Source: https://mailosaur.com/ghost-inspector # Use Ghost Inspector to test user interaction From email notifications to SMS alerts, promotional offers to authentication Mailosaur lets you build end-to-end tests for common customer actions that would usually require manual testing, like resetting a password. - [Getting started](/app/signup) - [How it works](#mailosaur-works-by-capturing-every-message-you-send) ## Trusted by leading brands worldwide ## Increase test coverage by testing these common scenarios Reduce manual testing, speed up releases and avoid test regression ### Links sent to end users Complete the end-to-end testing of password reset workflows, account verification, rescheduling a delivery, or unsubscribing. 
Use Ghost Inspector to validate that emails and SMS messages contain the right content, target the right audience, and include valid links that work every time. Plus ensure links expire after a certain period of time. ### Multi-factor authentication Test [multi-factor authentication](/mfa) (MFA) and two-factor authentication (2FA) workflows end-to-end, from login attempt through to successful account access. 

Use Ghost Inspector to verify that authentication [emails](/email-testing) or SMS messages are sent correctly, contain valid OTP codes, and are delivered to the right users.

 Validate the functionality and security of MFA and 2FA links and codes by ensuring they work as expected and expire within the defined time limit. ### Email notifications Automate and test email notification workflows, from trigger events to successful delivery. Use Ghost Inspector to validate that notifications are sent with the correct content, reach the intended recipients, and include functional links or actions.

 Test for consistency, ensuring emails are formatted correctly across devices, contain accurate timestamps, and comply with expiration or time-sensitive requirements. ### SMS messages Thoroughly test [SMS message](sms-testing) workflows to ensure they function. Use Ghost Inspector to validate that SMS messages are correctly targeted, deliver accurate content, and include operational links or codes.

 Focus on reliability by testing prompt delivery, proper formatting, and compliance with expiration timelines to ensure secure and user-friendly communication. ## Mailosaur ### Mailosaur works by capturing every message you send #### Unlimited test email addresses Every inbox in your account gives you instant access to an infinite number of email addresses to test with. With no setup required, you can use a unique address for every test case, scenario or team.  #### International phone numbers Instead of using personal devices, which rely on staff availability and geography. Access phone numbers from around the world and grant team member access so that you can test together. #### An API loved by testers Built for QA automation, Mailosaur’s API allows testers to integrate email, SMS and 2FA testing directly into their existing tech stack. Our customers love our easy-to-use documentation and the speed in which they got started. #### Assertions in your library It does not matter what programming language or test framework you use. With official API clients for all major programming languages, you can build test cases and write assertions in the way you’re used to. ## Automate tests in minutes With just a few lines of code added to your project Whether you use [Javascript or any other language](/docs/automation), Mailosaur is quick to integrate within Cypress, requiring just a few lines of code and a few minutes of your time. 

Enjoy seamless, reliable test automation with Mailosaur, enabling rapid validation of user interactions and ensuring consistent, high-quality results across all your test environments. - [Integrate Javascript](/docs/automation/javascript) ## Customer stories > Mailosaur's user-friendly API seamlessly integrates into existing workflows, delivering reliable automation that accelerates development cycles and enhances product quality. — Luke Elliot, Director of Engineering, OakNorth [Learn more](/customers/oaknorth) ## Need help getting started? Explore our comprehensive documentation, step-by-step guides, and code examples tailored for Ghost Inspector users. ### [How to test emails in Ghost Inspector](/docs/automation/ghost-inspector#3-add-steps-that-trigger-an-email) ### [How to test SMS messages in Ghost Inspector](/docs/sms-testing) ### [Create a Ghost Inspector test suite](/docs/automation/ghost-inspector#testing-plain-text-content-2) Navigate to Ghost Inspector, and create a new test suite here. ### [Ghost Inspector quickstart guide](/docs/automation/ghost-inspector#1-get-started-2) Create automated website tests and set up monitoring suites here. ## QA automation tailored to your industry Mailosaur is loved across all industries, helping test the world’s most popular products and services. ### Financial Automate the end-to-end testing of [fintech](/industries/financial) helpdesk responses and payment reminders for overdue payments to timely replies to enquiries. ### Healthcare Validate [patient alerts](/industries/healthcare), like appointment bookings to reminders. Test real scenarios, such as invalid contact details, to test alerts work. ### Media Test and automate to identify issues early. Test event invites & promos include correct details, RSVP links, codes, and subscription info. ### Retail Automate testing for [retail orders](/industries/retail), promo codes, and shipping updates to detect issues early and ensure a seamless customer experience. ### Travel Test [real-world scenarios](/industries/travel) like flight updates, delays, gate changes, booking confirmations, check-in reminders, and itinerary updates. ### Automotive Test updates for vehicles or parts. Like tracking numbers, delivery times, and shipping notifications. ## Automate anything your users might do Automate end-to-end scenarios, validate emails, and integrate with our API for seamless workflows. Start your 14 day free trial today. - [Start free trial ](/app/signup) --- Source: https://mailosaur.com/give-ai-tools # Give your AI agent the tools a human has Mailosaur can provide your AI agent with - An inbox with unlimited email addresses - Phone numbers for SMS testing - Programmatic one-time passcode extraction > Mailosaur is one of our most valuable tools for ensuring our system works end-to-end and provides the signals we need to identify issues quickly. — Beau B, Quality Manager ## With infrastructure trusted by thousands ## Where your AI agent gets blocked An AI agent can open a browser, navigate your product, and begin signing up- the problem comes when the flow requires an email address, a phone number, or a one-time passcode. Some teams try to solve this by using shared inboxes or setting up accounts for their agents. These approaches do not scale well and often introduce security and access issues. They also rely on tools that were not designed for automation. ## Everything your agent needs to proceed Mailosaur provides controlled access to the same communication channels your users rely on, exposed through a simple API. ### A real inbox your AI can use Create email addresses on demand, register accounts, and retrieve messages programmatically. ### A phone number for SMS flows Receive verification messages, alerts, and passcodes without using personal numbers or physical devices. ### Programmatic OTP extraction Extract one-time passcodes directly in your test flow, so the agent can continue without manual input. ## How teams use this in practice Teams use Mailosaur in different ways depending on how they build their agents. Some give agents a persistent inbox and phone number, allowing them to complete flows in the same way as a user. Others use Mailosaur in automated test runs, where an agent signs up, logs in, triggers messages, and verifies outcomes across email and SMS. ## Why this problem keeps coming up Without purpose-built tooling, teams often connect agents to real inboxes or create temporary accounts just to complete verification steps. This leads to duplicated setup, inconsistent access, and extra overhead managing those accounts. Some tools offer isolated inboxes or numbers, but they sit outside the rest of the testing workflow and do not integrate cleanly. ## Built on infrastructure you already trust Created to test email and SMS workflows at scale, Mailosaur provides inboxes and phone numbers which are disposable, isolated, and accessible through a consistent API. You can create, use and remove them without affecting other environments. This approach fits naturally with AI agents- instead of adapting user tools for automation, you give your agent access to systems that are designed for programmatic use from the start. ## Still have questions? Get started for free The easiest way to get to know Mailosaur is through a free trial or a demo with one of our team. - [Book a demo](/demo) - [Start your free trial](/app/signup) --- Source: https://mailosaur.com/ # Preview, test and trust every customer touchpoint Test email and SMS end to end, with real-device previews built in. Validate critical user flows like sign-ups and authentication using secure inboxes, dedicated numbers, and accurate previews. ## [Email Testing](/email-testing) Verify every message before it hits an inbox - check content, layout, links, and flows end-to-end. ## [SMS Testing](/sms-testing) Test OTPs, MFA codes, and transactional messages with dedicated numbers and secure delivery. ## [Email Previews](/email-previews) See how your emails render across clients, devices and dark mode, with previews integrated into your email tests. - [Start for free](/app/signup) - [Request demo](/demo) ## Trusted at scale, proven over time - **1/3 billion** Emails tested by our customers - **7 million** SMS messages tested - **14 years** we've been helping customers - **98.9%** Customer Satisfaction (CSAT) score ## Built for your team Mailosaur gives your team a dedicated, scalable environment for stress-free message testing and email previews your whole team can rely on. No more dummy accounts or cluttered inboxes - create test addresses instantly, connect your CI/CD pipeline, and automate everything with flexible APIs and native integrations for Cypress, Selenium, and Playwright. Book a demo to see how Mailosaur keeps your tests clean, fast, and reliable. - [More on message testing](/message-testing) - [More on email design](/email-designer) ## Preview every message before you hit send - Check how emails [appear](/email-previews) across email clients, devices, and even light and dark modes before they reach real inboxes. - Spot layout bugs, broken links, missing content, and formatting problems before they affect users. - Generate, review and share email previews from the same dashboard your team uses for email and SMS testing - no extra tools required. - Real devices are used to generate previews, not inaccurate emulations, leaving you with authentic results that reflect real user experience. ## Works with any testing language and framework - [Playwright](/playwright) - [Cypress](/cypress) - [Cucumber](/cucumber) - [Postman](/postman) - [Selenium](/selenium) - [Java](/docs/automation/java) - [Ruby](/docs/automation/ruby) - [.NET](/docs/automation/dotnet) - [Python](/docs/automation/python) - [Node.js](/docs/automation/nodejs) ## Created for every team that touches communications ### Quality assurance - Reliably test email and SMS workflows like sign‑ups and password resets - Validate links, dynamic content, and one‑time codes/ magic links safely - Cover edge cases and negative scenarios with confidence - Combine manual checks with automation for full coverage ### Marketers - Preview emails across real inboxes, devices, and dark mode - Catch layout issues and broken links before campaigns go live - Share previews for fast feedback and sign‑off without forwarding emails - Hit send with confidence, knowing brand mistakes won’t reach customers ### Developers - Test email and SMS in code with flexible APIs and framework support - Eliminate flaky tests caused by real inboxes or timing issues - Integrate message testing into CI/CD pipelines easily - Ship features knowing message‑driven flows won’t break ### Product Managers - See how message‑driven journeys behave before customers rely on them - Catch issues that impact activation, trust, or conversion early - Align teams around one source of truth for message quality - Launch features confidently without email or SMS undermining UX ## Build accessible, inclusive email journeys Don’t settle for visual email inspections alone. With Mailosaur you can validate accessibility of your emails against universally recognised standards, and ensure that your HTML isn’t impacting how your email renders across specific clients.   Reduce compliance risk and deliver clear, inclusive, and effective emails your team is proud of. - [More on accessibility and compatibility testing](/email-designer) ## Customer stories > “If we couldn’t use Mailosaur anymore, it’d be a serious disruption. I’d only hope the replacement looks and works half as well.” — Gabriel Peter-Tomas, Department for Education [See case study](/customers/the-department-for-education) ## See Mailosaur in action See Mailosaur in action with a free, personalised demo led by one of our experts, or jump straight in with a 14-day free trial to explore the dashboard, preview messages, and experience how easy it is to test email and SMS in your own flows. - [Start free trial](/app/signup) - [Request your demo](/demo) ## Automate tests in minutes With just a few lines of code added to your project Integrate Mailosaur with any testing framework - Cypress, Playwright, Selenium, and more. Set it up in minutes with just a few lines of code, no matter your framework or language of choice. Automate flows you never thought you could, from MFA to password resets, and easily replicate real-world scenarios. To start, make sure you have a Mailosaur plan. Then, just visit our documentation to get started. - [Read documentation ](/docs) ## Why choose Mailosaur? ### Manual and automated testing Switch seamlessly between manual and automated testing, as you run end-to-end tests for critical flows. Simple setup, reliable results. ### Test secure features Stop skipping tests for secure areas of your product. Test features that are protected by two-step verification or MFA with Mailosaur. ### End-to-end visibility Inspect every detail of your messages, from subject lines to headers and links, in one intuitive dashboard. ## Chosen by QA, Product, and Marketing teams alike Hear from our customers about how Mailosaur became an integral part of their testing processes. > Powerful tool for automated testing of emails and SMS. > If I were to change company and they didn't have a Mailosaur license I would push to get one. — Lee W., Senior Test Automation Engineer in Insurance [Keep reading](https://www.capterra.com/p/201911/Mailosaur/#Capterra___6143208) > We've absolutely loved using Mailosaur. Our automated testing is a breeze with Mailosaur and I use for manual QA as well. — Caroline C., CEO in Computer Software [Keep reading](https://www.capterra.com/p/201911/Mailosaur/#Capterra___6144119) > The UI is really smooth and learning curve is minimal for this software. Even a beginner can get hold of their easy to use process and adapt very quickly. — Naman G., Quality Assurance Engineer in Marketing and Advertising [Keep reading](https://www.g2.com/products/mailosaur/reviews/mailosaur-review-9758302) ## Security standards you can trust We get it - starting any subscription comes with fresh concerns around security. Mailosaur is ISO 27001:2022 certified, GDPR compliant, and built with strict data controls - so every test message stays private and protected. - [Go to our trust centre](https://trust.mailosaur.com) ## Frequently asked questions ### Can I test both email and SMS with Mailosaur? Yes, Mailosaur is unique in its ability to test both [email](/email-testing) and [SMS.](/sms-testing) This means that you can test product messaging functionality end to end, for example if a flow requires you to go from an email, to then get an [OTP code](/mfa) through SMS, and then an email confirmation. This allows you the greatest visibility of your customer journey and to optimise both email and SMS communications. ### Can Mailosaur be used for automated email and SMS testing? Yes. Mailosaur provides APIs designed specifically for automated testing of email and SMS within modern test frameworks and CI/CD pipelines. Engineering and QA teams commonly use Mailosaur to automate workflows such as account verification, [OTP delivery](/mfa), password reset flows, and negative testing scenarios using tools like [Cypress](/docs/automation/cypress), [Selenium](/docs/automation/selenium), [Playwright](/docs/automation/playwright), [Cucumber](/docs/automation/cucumber), and [Postman](/docs/automation/postman). ### Is Mailosaur only for engineers and QA teams? No. While Mailosaur is widely used by engineers and QA teams for automation, it’s also used by Product Managers and Marketing teams, as well as other teams responsible for product messaging. Non‑technical users commonly use Mailosaur to review emails visually, share previews for approval, validate journeys end to end, and sign off campaigns or product flows without relying on personal inboxes or production sends. ### What are Mailosaur Email Previews and how do they differ from emulated screenshots? Mailosaur [Email Previews](/email-previews) show exactly how emails render in real inboxes using real devices, not simulations. Unlike emulated screenshots, they reflect genuine client behaviour, including dark mode, [rendering quirks](/blog/fix-rendering), and layout differences so teams can spot issues that only appear in real-world email environments before sending. ### Can I test accessibility with Mailosaur? Mailosaur's [email designer](/email-designer) offers the opportunity to test your individual email's accessibility against [WCAG 2.2](/docs/compliance) to level AA. These are globally recognised standards for accessibility, often part of legal compliance obligations (especially in regulated industries such as finance and healthcare). In Mailosaur, you'll be able to see the extent to which your email passes accessibility checks, as well as seeing the reasons certain elements are failing. You can find out more on our [docs pages](/docs/compliance). ### Can Mailosaur test authentication flows like OTP, MFA, and password resets? Yes. Mailosaur is commonly used to automate testing of [authentication](/mfa) and verification flows, including OTP emails, SMS [codes](/features/links-and-codes), and multi‑factor authentication. Teams use it to confirm codes are delivered correctly, can be extracted automatically, expire as expected, and don’t fail under edge cases- reducing login issues and account lockouts in production. ### Is Mailosaur secure for testing sensitive and regulated workflows? Yes. Mailosaur is designed for testing sensitive workflows like account verification, password resets, payment alerts, and two-factor authentication notifications. You can test safely in development or staging, control data retention, and avoid using real customer data, making it suitable for teams with strict security or [compliance requirements](/blog/compliance-governance-security). ### Can I try Mailosaur or speak to someone before committing to purchase? Yes. You can start with a [14‑day free trial](/app/signup) to explore Mailosaur on your own. If you’d prefer guidance, you can also [book a demo](/demo) to discuss your specific use case, whether that’s [marketing](/marketing) email [QA](//quality-assurance), automated transactional testing, or authentication workflows, before making a decision. ## Test anything your users might do Automate end-to-end scenarios, validate emails, and integrate with our API for seamless workflows. Start your 14 day free trial today. - [Start free trial](/app/signup) - [Book your free demo](/demo) --- Source: https://mailosaur.com/litmus-vs-mailosaur # Looking for a Litmus email preview alternative? Preview your emails across the clients and devices your customers use. Mailosaur lets you preview emails across popular devices and email clients, helping you catch rendering issues early and send with confidence. - [Start for free](/app/signup) - [Request a demo](/demo) ## Trusted by leading brands worldwide ## Email previews without the complexity Quickly see how your email renders across different inboxes and devices. ### Preview popular email clients See how your email looks in Gmail, Outlook, Apple Mail and more email clients your customers use. ### Check both desktop and mobile Make sure your emails look right across different screen sizes and devices without manually sending test emails everywhere. ### Catch rendering problems early Spot broken layouts, spacing issues and other visual problems before your campaign goes live. ### Keep email QA simple Give your team a straightforward way to review email designs without adding unnecessary complexity to your workflow. ## Mailosaur vs Litmus for email previews Already using Litmus, or comparing your options? Litmus offers a broad email marketing suite covering email previews alongside additional campaign testing, monitoring and optimisation tools. Mailosaur gives teams a simpler way to access the email preview capabilities they need, backed by a platform built around email quality and testing. If you want reliable email previews without paying for a much broader platform, Mailosaur could be the better fit. - [Request a demo](/demo) ## See your email before your customers do Email clients don't all render emails in the same way. Something that looks great in one inbox can have broken spacing, images or layouts somewhere else. Mailosaur Email Previews lets you check your email across different clients and devices from one place, so you can find problems before your customers do. It's a faster way to make sure your emails look the way you intended, without the guesswork or manually checking multiple inboxes. ## QA automation tailored to your industry Mailosaur is loved across all industries, helping test the world’s most popular products and services. ### Financial Automate the end-to-end testing of [fintech](/industries/financial) helpdesk responses and payment reminders for overdue payments to timely replies to enquiries. ### Healthcare Validate [patient alerts](/industries/healthcare), like appointment bookings to reminders. Test real scenarios, such as invalid contact details, to test alerts work. ### Media Test and automate to identify issues early. Test event invites & promos include correct details, RSVP links, codes, and subscription info. ### Retail Automate testing for [retail orders](/industries/retail), promo codes, and shipping updates to detect issues early and ensure a seamless customer experience. ### Travel Test [real-world scenarios](/industries/travel) like flight updates, delays, gate changes, booking confirmations, check-in reminders, and itinerary updates. ### Automotive Test updates for vehicles or parts. Like tracking numbers, delivery times, and shipping notifications. ## Much more than Email Previews Mailosaur is built for teams that care about the quality of the emails their products and businesses send. Alongside Email Previews, Mailosaur helps teams: - Test email and SMS workflows. - Check email content. - Validate links and codes. - Automate email testing as part of their existing QA processes. ## Find the right plan for your team Compare pricing plans to find the best fit for your team, company, and email preview needs. - [Explore pricing](/pricing#previews) ## Customer stories > Getting started with Mailosaur was extremely easy. The interface was intuitive, easy to learn and navigate, making the transition seamless for our team. — Rohit Sonak Sr. Director, Quality Engineering [Learn more](/customers/malwarebytes) ## Ready for an alternative to Litmus? Preview your emails across popular clients and devices with Mailosaur. Start your free 14-day trial today. - [Start free trial](/app/signup) --- Source: https://mailosaur.com/marketing # Confident communication for marketers The tool marketing professionals use to perfect their campaigns. - [Try it for free](/app/login) ## Trusted by marketing teams globally ## Marketing success with email and SMS Giving you peace of mind that your email and SMS campaigns run seamlessly. ### Test tracking Get accurate data from your campaigns and have the reassurance that open tracking functionality really works on your marketing emails. ### Preview emails [See what your emails really look like](/email-previews), on everything from Microsoft Outlook and IBM Notes on PC, to Apple Mail on iPhone. ### Get peace of mind Ensure emails and SMS messages are always sent to the right people at the right time and catch errors before they are sent to customers. ### Ensure high quality content Test your email design, functionality, and personalization and get peace of mind that everything is delivered to the highest standard. ## See how emails render before you hit send Generate previews of your emails across countless devices, email clients, and even light and dark modes to ensure your customers are getting the exact message you're aiming to send.  - [More on previews](/email-previews) ## What marketers think > Mailosaur is extremely reliable and offers ease of implementation. The support is thorough, responsive, and very personable. — QA Team at Checkout.com [Learn more](/customers) ## Unlimited email addresses Use any email address you want – no code required Use a unique email address for every test, build, team member, environment, or any other use case you have. Mailosaur supports an unlimited number of email addresses that you can send to from anywhere. ## Why Mailosaur? ### Test automated responses Ensuring customers receive the correct automated email response is vital to the reputation of your brand. With Mailosaur, you can rest easy that customers receive the correct response at any time. ### Get complete visibility With Mailosaur's preview feature, visualizing or presenting campaigns is made simple. Get screenshots of how any email appears to all customers, in any email platform, and even in things like dark mode. ### Bespoke testing for each campaign Not all campaigns are built equal, meaning a testing framework may work for one, but not be comprehensive enough for others. With Mailosaur, you have total confidence that your campaigns will always work as they should. ## Our products Everything you need to test customer communication ### Email Testing Create end-to-end tests that rely on email. Test account verification emails, password resets, email tracking and more. [Learn more](/email-testing) ### Email Previews Instantly see how your email will look to any recipient, no matter what email client they use, so there are no nasty surprises. [Learn more](/email-previews) ### SMS Testing Build text messages that work. Create end-to-end tests that cover identity verification, alerting, promotional messages, and more. [Learn more](/sms-testing) ## Test user interactions today Test end-to-end scenarios, validate emails, and integrate with our API for seamless workflows. Start your 14 day free trial today. - [Contact us](/contact) - [Get started](/app/signup) --- Source: https://mailosaur.com/message-testing # Message testing Email and SMS sit at the centre of critical user journeys. Ensure they function as intended and get customers to where they need to be. - [Start free trial](/app/signup) - [Book your demo](/demo) ## Trusted by companies across the board ## Test how emails and SMS behave in real user journeys From signing up and logging in to confirming transactions and receiving alerts, [email](/email-testing) and [SMS](/sms-testing) sit at the centre of critical user journeys. If they fail, the experience breaks immediately. Mailosaur helps teams test how messages behave in real workflows, so everything works as expected before it reaches customers. ## Validate every part of your message flow ### Timing and triggers Ensure messages are sent exactly when expected and reflect real user actions. ### User interactions Verify links, calls to action, and navigation paths behave as intended. ### Cross-channel journeys Test how email and SMS work together as part of a complete experience. ## Send the right message at the right moment Whether it’s a password reset, onboarding step, or transaction alert, even small delays or mistimed triggers can disrupt the user journey and reduce trust. Mailosaur allows teams to validate when and how messages are sent, ensuring they are triggered correctly, arrive in the right sequence, and reflect real user actions across both email and SMS. ## Test message behaviour, not just delivery Most tools confirm that a message was sent. Mailosaur helps you verify that it works, so you can: - Confirm messages trigger at the correct moment - Validate links and calls to action - Ensure navigation flows behave as expected - Test real user journeys end to end ## Validate authentication and critical flows Customers rely on one-time passcodes, magic links, and verification messages to access their accounts. When these fail, users are locked out, journeys break, and support requests increase. With Mailosaur, teams can validate expiry rules, retry behaviour, and edge cases as part of a complete authentication journey, covering real-life possibilities before you even hit send. - [More on authentication flows](/mfa) ## Reduce risk before it reaches production Mailosaur helps teams shift message validation earlier in the development process. - Catch issues before customers experience them - Reduce last-minute fixes and rework - Improve confidence at launch - Deliver more reliable user journeys ## Message behaviour is only part of the picture Functionality testing goes hand in hand with email rendering testing. Rendering issues such as broken layouts or accessibility problems impact how messages appear and whether users can engage with them. The email designer validates rendering across clients and ensures they meet accessibility standards, so they display correctly for every recipient. - [More on the email designer](/email-designer) ## Give it a go Get in touch or create an account With a free 14 day trial and easy integration, it couldn't be easier to get started with Mailosaur. - [Start free trial](/app/signup) - [Book a demo](/demo) --- Source: https://mailosaur.com/mfa # Multifactor authentication testing Mailosaur provides a safe and reliable way to test one‑time passwords and authentication messages before they reach real users. - [Book a demo](/demo) - [Start free trial](/app/signup) ## Trusted to test teams' most sensitive messages ## Why OTP and MFA messages matter One time passwords and authentication messages play a crucial role in how users access and trust your product, underpinning account sign up, login, and other sensitive actions. If an email is delayed, SMS code never arrives, or verification message contains the wrong content, users can be locked out or abandon the journey altogether. These issues are often only discovered too late, after a release or if users report problems. ## Support complete verification journeys OTP and MFA messages are part of wider user journeys. Mailosaur helps teams test these journeys end‑to‑end by confirming: ### Correct message triggered The correct authentication message is triggered at the right point in the journey ### Message is routed correctly The message is sent to the intended email address or phone number ### Arrives as intended The message arrives promptly and within expected timeframes ### Links and codes available Codes or links are present, readable, and usable ### Functional follow-on The user can successfully proceed after using the code or link ### Catch broken messages Missing, delayed, or incorrect messages are easy to identify before users are impacted ## Consistent testing across environments OTP and MFA issues can be difficult to track down and reproduce, making them difficult to replicate across environments. Mailosaur allows teams to test messages consistently across development, QA, staging, and pre production environments, helping teams verify changes behave as expected before they reach users, and reducing reliance on manual spot checks that are easy to miss or forget. ## Works with your existing authentication setup Mailosaur does not require changes to how your application sends authentication messages. Your system continues to send real emails and SMS messages using your existing providers and logic, they're simply received in a controlled environment, making it easier to inspect, test, and validate authentication behaviour. ## Reduce risk at critical points Authentication messages sit at some of the most fragile points in the user journey. When they fail, users can’t proceed and teams often only hear about it through support channels. By making OTP and MFA messages visible and testable earlier, teams can identify issues before they impact real users. This reduces release risk, improves reliability, and supports smoother login experiences, maintaining customer satisfaction. ## Secure by design Testing authentication messages shouldn’t introduce security risk. This is why Mailosaur provides safe, isolated test email addresses and phone numbers (so there's no risk of exposing real user data), full control over environments and access (including the ability to set hierarchal permissions by inbox), and enterprise‑ready security features for sensitive workflows. - [More on security](https://trust.mailosaur.com) ## Our products Everything you need to test customer communication ### Email Testing Create end-to-end tests that rely on email. Test account verification flows, password resets, email tracking and more. [Learn more](/email-testing) ### Email Previews Instantly see how your email will look to any recipient, no matter what email client they use, so there are no nasty surprises. [Learn more](/email-previews) ### SMS Testing Build text messages that work. Create end-to-end tests that cover identity verification, alerting, promotional messages and more. [Learn more](/sms-testing) ## Ready to give it a go? Start testing your authentication You can start testing your most crucial flows for free by signing up to one of our 14-day free trials, or book a demo with one of our experts. - [Free trial](/app/signup) - [Book demo](/demo) --- Source: https://mailosaur.com/partnerships # Embed email testing your customers will trust Mailosaur's partnership programme allows companies the opportunity to: - Embed Mailosaur's Email Testing capabilities, including end-to-end automated testing, into your product - Empower your customers to take control of their email rendering, using Mailosaur's real-device Email Previews across light and dark modes - Discuss reseller options, including referral discounts and white labelling > The one email platform for testing. I like the simplicity, multiple inbox management, and integration with Cypress and Playwright. — Senior QA Engineer at a leading sustainable technologies company ## Proven capabilities, trusted by thousands ## What you can embed Mailosaur lets you embed proven email testing capabilities directly into your product. From Email Previews to automated testing workflows, you can expose Mailosaur’s functionality inside your own UI or processes, helping your users validate how their emails look, what they contain, and how they behave, without sending anything to real inboxes. - [More on Email Testing](/email-testing) - [More on previews](/email-previews) ## Why choose us Email is business‑critical and hard to test well. Partnering with Mailosaur lets you offer proven email testing without the cost, risk, or distraction of building it yourself. With benefits including: - Faster time to market with a mature email testing platform - Reduced engineering effort and long‑term maintenance - Commercial models that scale with your business ## Resell email confidence Reselling Mailosaur lets you offer best‑in‑class email testing without building or maintaining it yourself. It’s a strong fit for agencies, consultancies, and platforms that want to give customers a proven solution for testing email quality, reliability, and edge cases. You focus on your services or product; Mailosaur provides the email testing capability behind the scenes. ## Frequently asked questions ### What types of partnerships do you offer? We support two partnership models: embedding Mailosaur’s capabilities into your product, and reselling Mailosaur to your customers. The right approach depends on how you want to use or offer email testing. Either way, we'd recommend using the form above to reach out and start a discussion! ### Who is a good fit for an embed partnership? Embed partnerships are a good fit for product teams that want to include email previews or testing directly inside their own platform without building it themselves. ### Who owns the customer relationship? Customer ownership depends on the partnership model, and is agreed clearly as part of the partnership terms. This is one of many key things that will be discussed once you reach out and express interest. ### How does pricing and revenue share work? Commercial terms vary by partnership type and use case, and are discussed during the partnership process. ### What support do partners and customers receive? Partner and customer support depends on whether Mailosaur is embedded or resold and is defined as part of the individual agreement we build with you. ### How complex is the integration? Mailosaur is API‑first. Integration complexity depends on which capabilities you want to expose and how deeply you plan to embed them. ## Try Mailosaur for yourself Book your personalised demo or start your 14-day free trial Give Mailosaur a go before your customers do - [Book a demo](/demo) - [Start your trial](/app/signup) --- Source: https://mailosaur.com/playwright # Use Playwright to test user interaction From email notifications to SMS alerts, promotional offers to authentication Mailosaur lets you build end-to-end tests for common customer actions that would usually require manual testing, like resetting a password. - [Get started](/app/signup) - [How it works](#mailosaur-works-by-capturing-every-message-you-send) ## Trusted by leading brands worldwide ## Increase test coverage by testing these common scenarios Reduce manual testing, speed up releases and avoid test regression ### Links sent to end users Complete the end-to-end testing of password reset workflows, account verification, rescheduling a delivery, or unsubscribing. 
Use Playwright to validate that emails and SMS messages contain the right content, target the right audience, and include valid links that work every time. Plus ensure links expire after a certain period of time. ### Multi-factor authentication Test multi-factor authentication (MFA) and two-factor authentication (2FA) workflows end-to-end, from login attempt through to successful account access.

 Use Playwright to verify that authentication emails or SMS messages are sent correctly, contain valid OTP codes, and are delivered to the right users.

 Validate the functionality and security of MFA and 2FA links and codes by ensuring they work as expected and expire within the defined time limit. ### Email notifications Automate and test email notification workflows, from trigger events to successful delivery. Use Playwright to validate that notifications are sent with the correct content, reach the intended recipients, and include functional links or actions.

 Test for consistency, ensuring emails are formatted correctly across devices, contain accurate timestamps, and comply with expiration or time-sensitive requirements. ### SMS messages Thoroughly test SMS message workflows to ensure they function. Use Playwright to validate that SMS messages are correctly targeted, deliver accurate content, and include operational links or codes.

 Focus on reliability by testing prompt delivery, proper formatting, and compliance with expiration timelines to ensure secure and user-friendly communication. ## Mailosaur ### Mailosaur works by capturing every message you send #### Unlimited test email addresses Every inbox in your account gives you instant access to an infinite number of email addresses to test with. With no setup required, you can use a unique address for every test case, scenario or team.  #### International phone numbers Instead of using personal devices, which rely on staff availability and geography. Access phone numbers from around the world and grant team member access so that you can test together. #### An API loved by testers Built for QA automation, Mailosaur’s API allows testers to integrate email, SMS and 2FA testing directly into their existing tech stack. Our customers love our easy-to-use documentation and the speed in which they got started. #### Assertions in your library It does not matter what programming language or test framework you use. With official API clients for all major programming languages, you can build test cases and write assertions in the way you’re used to. ## Automate tests in minutes With just a few lines of code added to your project Whether you use Python, .NET, Java, or Javascript, Mailosaur is quick to integrate within Playwright, requiring just a few lines of code and a few minutes of your time. 

Enjoy seamless, reliable test automation with Mailosaur, enabling rapid validation of user interactions and ensuring consistent, high-quality results across all your test environments. ## Customer stories > Mailosaur's user-friendly API seamlessly integrates into existing workflows, delivering reliable automation that accelerates development cycles and enhances product quality. — Luke Elliot, Director of Engineering, OakNorth [Learn more](/customers/oaknorth) ## Need help getting started? Explore our comprehensive documentation, step-by-step guides, and code examples tailored for Playwright users. ### [How to test emails in Playwright](/docs/automation/playwright/email-testing) Follow our detailed guide to integrate email testing directly into your Playwright test scripts. ### [How to test SMS messages in Playwright](/docs/automation/playwright/sms-testing) Step-by-step guide to see how easily you can test SMS workflows directly within your Playwright test scripts. ### [How to test login functionality ](/blog/testing-otp-playwright) Learn how to test login functionality with Playwright using OTP codes. ### [Playwright quickstart guide](/docs/automation/playwright/quickstart) Step by step guide to set up testing environments, integrate Mailosaur with Playwright scripts to start testing. ## QA automation tailored to your industry Mailosaur is loved across all industries, helping test the world’s most popular products and services. ### Financial Automate the end-to-end testing of fintech helpdesk responses and payment reminders for overdue payments to timely replies to enquiries. ### Healthcare Validate patient alerts, like appointment bookings to reminders. Test real scenarios, such as invalid contact details, to test alerts work. ### Media Test and automate to identify issues early. Test event invites & promos include correct details, RSVP links, codes, and subscription info. ### Retail Automate testing for retail orders, promo codes, and shipping updates to detect issues early and ensure a seamless customer experience. ### Travel Test real-world scenarios like flight updates, delays, gate changes, booking confirmations, check-in reminders, and itinerary updates. ### Automotive Test updates for vehicles or parts. Like tracking numbers, delivery times, and shipping notifications. ## Works with any flavor of Playwright It doesn’t matter which Playwright library you’re using, we support them all. From Java to Python, .NET to Javascript - [Java](/docs/automation/java) - [Javascript](/docs/automation/nodejs) - [Python](/docs/automation/python) - [.NET](/docs/automation/dotnet) ## Automate anything your users might do Automate end-to-end scenarios, validate emails, and integrate with our API for seamless workflows. Start your 14 day free trial today. - [Start free trial](/app/signup) --- Source: https://mailosaur.com/postman # Use Postman to test user interaction, in minutes From email notifications to SMS alerts, promotional offers to authentication Mailosaur lets you build end-to-end tests for common customer actions that would usually require manual testing, like resetting a password. - [Get started](/app/signup) - [How it works ](#mailosaur-works-by-capturing-every-message-you-send) ## Trusted by leading brands worldwide ## Increase test coverage by testing these common scenarios Reduce manual testing, speed up releases and avoid test regression ### Links sent to end users Complete the end-to-end testing of password reset workflows, account verification, rescheduling a delivery, or unsubscribing. 
Use Postman to validate that emails and [SMS messages](/sms-testing) contain the right content, target the right audience, and include valid links that work every time. Plus ensure links expire after a certain period of time. ### Multi-factor authentication Test [multi-factor authentication](/mfa) (MFA) and two-factor authentication (2FA) workflows end-to-end, from login attempt through to successful account access. 

Use Postman to verify that authentication emails or SMS messages are sent correctly, contain valid OTP codes, and are delivered to the right users.

 Validate the functionality and security of MFA and 2FA links and codes by ensuring they work as expected and expire within the defined time limit. ### Email notifications Automate and test email notification workflows, from trigger events to successful delivery. Use Postman to validate that notifications are sent with the correct content, reach the intended recipients, and include functional links or actions.

 Test for consistency, ensuring emails are formatted correctly across devices, contain accurate timestamps, and comply with expiration or time-sensitive requirements. ### SMS messages Thoroughly test [SMS message](/sms-testing) workflows to ensure they function. Use Postman to validate that SMS messages are correctly targeted, deliver accurate content, and include operational links or codes.

 Focus on reliability by testing prompt delivery, proper formatting, and compliance with expiration timelines to ensure secure and user-friendly communication. ## Mailosaur ### Mailosaur works by capturing every message you send #### Unlimited test email addresses Every inbox in your account gives you instant access to an infinite number of email addresses to test with. With no setup required, you can use a unique address for every test case, scenario or team.  #### International phone numbers Instead of using personal devices, which rely on staff availability and geography. Access phone numbers from around the world and grant team member access so that you can test together. #### An API loved by testers Built for QA automation, Mailosaur’s API allows testers to integrate email, SMS and 2FA testing directly into their existing tech stack. Our customers love our easy-to-use documentation and the speed in which they got started. #### Assertions in your library It does not matter what programming language or test framework you use. With official API clients for all major programming languages, you can build test cases and write assertions in the way you’re used to. ## Automate tests in minutes With just a few lines of code added to your project When you test with [JavaScript, Node.js, Python and Java](/docs/automation), Mailosaur is quick to integrate within Postman, requiring just a few lines of code and a few minutes of your time. 

Enjoy seamless, reliable test automation with Mailosaur, enabling rapid validation of user interactions and ensuring consistent, high-quality results across all your test environments. ## Customer stories > Mailosaur's user-friendly API seamlessly integrates into existing workflows, delivering reliable automation that accelerates development cycles and enhances product quality. — Luke Elliot, Director of Engineering, OakNorth [Learn more](/customers/oaknorth) ## Need help getting started? Explore our comprehensive documentation, step-by-step guides, and code examples tailored for Postman users. ### [How to test emails in Postman](/docs/automation/postman) Follow our detailed guide to integrate email testing directly into your Postman test scripts. ### [How to test SMS messages in Postman](/docs/automation/postman) Step-by-step guide to see how easily you can test SMS workflows directly within your Postman test scripts. ### [Getting started with Postman](/blog/getting-started-with-postman-for-api-testing) Learn how to use Postman for API testing with this step-by-step guide. ### [Access the Mailosaur Postman collection](https://app.getpostman.com/run-collection/6961255-6cc72dff-f576-451a-9023-b82dec84f95d?action=collection%2Ffork&collection-url=entityId%3D6961255-6cc72dff-f576-451a-9023-b82dec84f95d%26entityType%3Dcollection%26workspaceId%3D386a4af1-4293-4197-8f40-0eb49f831325) Mailosaur offers a public Postman Collection, access it here. ## QA automation tailored to your industry Mailosaur is loved across all industries, helping test the world’s most popular products and services. ### Financial Automate the end-to-end testing of [fintech](//industries/financial) helpdesk responses and payment reminders for overdue payments to timely replies to enquiries. ### Healthcare Validate [patient alerts](/industries/healthcare), like appointment bookings to reminders. Test real scenarios, such as invalid contact details, to test alerts work. ### Media Test and automate to identify issues early. Test event invites & promos include correct details, RSVP links, codes, and subscription info. ### Retail Automate testing for [retail orders](/industries/retail), promo codes, and shipping updates to detect issues early and ensure a seamless customer experience. ### Travel Test [real-world scenarios](/industries/travel) like flight updates, delays, gate changes, booking confirmations, check-in reminders, and itinerary updates. ### Automotive Test updates for vehicles or parts. Like tracking numbers, delivery times, and shipping notifications. ## Automate anything your users might do Automate end-to-end scenarios, validate emails, and integrate with our API for seamless workflows. Start your 14 day free trial today. - [Start free trial ](/app/signup) --- Source: https://mailosaur.com/pricing # One platform. Total testing confidence. ## QA Testing ### Personal Best for individuals who require email testing essentials to create automated end-to-end tests. - Annual billing: From $20 per month, billed annually - Monthly billing: From $25 per month [Try free for 14 days](/app/signup) #### Included features - Includes 1 user — With support for up to 3 users - 1 inbox (with **unlimited** email addresses) — Each inbox has a unique domain name — Unlike others, Mailosaur inboxes have a unique domain name, giving you unlimited email addresses with no setup required. - From 15,000 inbound emails/month — Based on a daily limit of 500 - Email compatibility testing — See if the HTML in your email is compatible with a long list of email clients. - API for test automation - Forward individual emails to external addresses ### Core (Popular) Collaborative email testing that scales with your automation. - Annual billing: From $50 per month, billed annually - Monthly billing: From $62.50 per month [Sign up](/app/signup) #### Everything in Personal, plus - Team access — 5 seats included - Multiple inboxes — Each with unlimited email addresses — Unlike others, Mailosaur inboxes have a unique domain name, giving you unlimited email addresses with no setup required. - From 75,000 inbound emails/month — Based on a daily limit of 2,500 - Email accessibility testing — Ensure emails meet legal requirements such as the ADA/European Accessibility Act (EAA). - Mail rules/auto-forwarding - Reply to/send emails to external email addresses - POP3 & IMAP connectivity #### Add-ons - SMS and authentication — from $37.50 per month — Test functionality that relies on SMS messages or time-based authentication (TOTP). - Email Previews — from $25 per month — Preview your emails across different clients and devices. ### Enterprise Best for companies driving quality at scale, with enterprise security and account management. Custom [Talk to sales](/contact) #### Customizable features - Custom users - Custom inboxes — Separate permissions for each team or project - Single Sign-On (SSO) — Support for both SAML2 and OIDC - Enterprise security features (inc. SCIM and custom session timeouts) - Advanced support & SLAs - Account manager - Support for custom terms - Ability to acquire phone numbers from all available countries ## SMS Testing ### Core (Popular) Best for teams needing to test functionality that relies on SMS messages or time-based authentication (TOTP). - Annual billing: From $87.50 per month, billed annually - Monthly billing: From $109.38 per month [Sign up](/app/signup) #### Included features - Multi-user access — 5 seats included - Multiple SMS inboxes — Create separate inboxes for each phone number, team, or project. - Customizable SMS volume — From 250 messages per month - Up to 15 standard-tier phone numbers — Speak to our team about acquiring numbers from specific countries. - Time-based Authenticator functionality — Test Google Authenticator, Auth0, and similar app functions. - Plus, Email Testing features as standard #### Add-ons - Email Previews — from $25 per month — Preview your emails across different clients and devices. ### Enterprise Best for companies that need phone numbers in premium locations and enterprise scalability. Custom [Talk to sales](/contact) #### Customizable features - Custom users - Higher volume testing — Custom SMS and phone number volumes to suit your needs. - Phone numbers from other countries — Standard-tier numbers are limited to US/Canada and UK. - Single Sign-On (SSO) — Support for both SAML2 and OIDC - Enterprise security features (inc. SCIM and custom session timeouts) - Advanced support & SLAs - Account manager - Support for custom terms ## Email Previews ### Core (Popular) Best for teams requiring visibility of how their emails render across various email clients and devices. - Annual billing: From $75 per month, billed annually - Monthly billing: From $93.75 per month [Sign up](/app/signup) #### Included features - Multi-user access — 5 seats included - Set a screenshot limit that meets your needs — Choose between 250-2,000 previews per month. - Import emails using HTML, or simply forward your email — Start working with any email you have, in seconds. - API for automated email previews — Generate previews from your test suite. - Email accessibility testing (supports ADA/EAA compliance) - Email compatibility testing — See if the HTML in your email is compatible with a long list of email clients. #### Add-ons - SMS and authentication — from $37.50 per month — Test functionality that relies on SMS messages or time-based authentication (TOTP). ### Enterprise Best for companies that require higher email preview volumes. Custom [Talk to sales](/contact) #### Customizable features - Custom users - Custom email preview volumes - Enterprise security features (inc. SSO & SCIM) - Advanced support & SLAs - Account manager - Support for custom terms - Ability to acquire phone numbers from all available countries ## Compare plans and features ### General | Feature | Personal | Core | Enterprise | | --- | --- | --- | --- | | Unlimited email addresses | ✓ | ✓ | ✓ | | Inboxes, including unique domain name per inbox | 1 | Starting from 5 | Starting from 15 | | Retention period | 3 days | 14 days | Custom | - **Unlimited email addresses:** Unlike others, Mailosaur inboxes have a unique domain name, giving you unlimited email addresses with no setup required. - **Retention period:** Email/SMS messages are automatically deleted after the retention period expires. ### Email Testing | Feature | Personal | Core | Enterprise | | --- | --- | --- | --- | | Capture email via SMTP or API | - | ✓ | ✓ | | Fetch email via IMAP or POP3 | - | ✓ | ✓ | | Email compatibility testing | ✓ | ✓ | ✓ | | Email accessibility testing (supports ADA/EAA compliance) | - | ✓ | ✓ | | Email size limit (MB) | 10MB | 25MB | Custom | | Forward individual emails | ✓ | ✓ | ✓ | | Auto-forwarding | - | ✓ | ✓ | | Reply back to emails | - | ✓ | ✓ | | Send outbound emails | - | ✓ | ✓ | | Advanced mail rules | - | - | ✓ | | Set per-inbox limits | - | - | ✓ | - **Capture email via SMTP or API:** Send emails to Mailosaur in the same way you would send to your email service provider (ESP). - **Email compatibility testing:** See if the HTML in your email is compatible with a long list of email clients. - **Email accessibility testing (supports ADA/EAA compliance):** Ensure emails meet legal requirements such as the ADA/European Accessibility Act (EAA). - **Auto-forwarding:** Automatically forward emails or SMS messages to an external email address. - **Send outbound emails:** Useful for testing scenarios that begin with someone sending you an email. - **Advanced mail rules:** Test negative scenarios like errors and out-of-office responses. - **Set per-inbox limits:** Set email and SMS limits on individual inboxes, so a single team or project cannot consume your whole account allowance. ### SMS and authentication testing | Feature | Personal | Core | Enterprise | | --- | --- | --- | --- | | Phone numbers (US/Canada or UK) | - | Up to 15 | Custom | | Phone numbers (other countries) | - | - | ✓ | | Reply back to SMS | - | ✓ | ✓ | | Forward SMS to email | - | ✓ | ✓ | | Send outbound SMS | - | ✓ | ✓ | - **Phone numbers (other countries):** Speak to our team about acquiring numbers from specific countries. - **Send outbound SMS:** Useful for testing scenarios that begin with someone sending you an SMS message. ### Email Previews | Feature | Personal | Core | Enterprise | | --- | --- | --- | --- | | Email Previews | - | ✓ | ✓ | | Previews per month | - | Up to 2,000 | Custom | | Email designer | - | ✓ | ✓ | - **Email Previews:** Preview your emails across different clients and devices. ### Security and identity | Feature | Personal | Core | Enterprise | | --- | --- | --- | --- | | Single Sign-On (SSO) | - | Talk to sales | ✓ | | SCIM | - | - | ✓ | | Custom session timeout limits | - | - | ✓ | | IP address whitelisting | - | - | ✓ | ### Procurement | Feature | Personal | Core | Enterprise | | --- | --- | --- | --- | | Managed billing | - | Talk to sales | ✓ | | Custom terms | - | Talk to sales | ✓ | | Account management and customer success support | - | Talk to sales | ✓ | | Access to prioritized support | - | - | ✓ | | Enterprise SLA | - | - | ✓ | | Access to roadmap (product team) | - | - | ✓ | - **Managed billing:** Pay by invoice rather than via credit card. ## Test millions of emails every day Learn how [our customers](/customers) are using Mailosaur to solve their testing challenges > Mailosaur facilitated easy email testing, streamlined QA automation through API calls, and provided crucial support for evergreen projects related to email validation. This comprehensive approach allowed us to validate every release with ease. — Software Quality Engineering [Learn more](/customers/dominos) > Mailosaur's developer-friendly API seamlessly integrated with OakNorth's existing testing frameworks, facilitating efficient automation for our testing processes. — Luke, Director of Engineering [Learn more](customers/oaknorth) > Getting started with Mailosaur was extremely easy. The interface was intuitive, easy to learn and navigate, making the transition seamless for our team. — Rohit Sonak Sr. Director, Quality Engineering [Learn more](customers/malwarebytes) ## Need an enterprise solution? Contact the Mailosaur team to discuss a solution tailored to you and your team's needs. [Contact sales](/contact) ## Frequently asked questions ### How does the free trial work? When you sign up for a free trial, you will have access to all our features. If you want to extend your trial, just contact us. At any point during the trial you can choose a plan and pay by credit card from within your account, or contact us about managed billing. ### What payment methods are accepted? You can pay for Mailosaur Personal or Core plans with a credit card, debit card or with a Google/Apple Pay account. We also support invoice payments for our Core and Enterprise plans. ### How can I change my subscription? You can upgrade or downgrade your subscription, add and remove seats, increase and decrease usage limits or change the billing cadence via the billing screen in the Mailosaur Dashboard. ### What happens if I change my subscription? When upgrading your current plan, you'll be charged the pro-rated difference between what you have already paid and the cost of the new plan for the remaining period. At the next billing cycle you will be charged as normal. When downgrading, or moving from from annual to monthly billing, your change will take place at the start of your next billing cycle. ### What happens if payment fails? After an initial failed payment, we apply a grace period on your account and attempt to process the payment several times over the course of a few weeks. After four failed payments, your account will be disabled. ### How can I re-enable my account after several failed payment attempts? You can re-enable your account and trigger a new payment attempt simply by updating the payment method on your account, via the billing screen in the Mailosaur Dashboard. ### Will I pay VAT or sales tax? Mailosaur Ltd is a UK registered company, so we are required to charge VAT at 20% for all UK-based individuals & businesses. Customers in the EU countries will only be charged VAT, at their local rate, if they are unable to supply a valid EU VAT number. We do not charge tax for other customers. All prices within mailosaur.com are shown excluding VAT. ### Do you offer non-profit discounts? We're happy to offer a discount to eligible non-profit organizations. Please contact us if you'd like to learn more. ### How can I view and download my invoices? You can access your invoice history via the billing screen in the Mailosaur Dashboard. You can also configure invoices to be sent to one or more external email addresses. --- Source: https://mailosaur.com/product-management # Communication testing for Product Managers Deliver high-quality user experiences, every time All-in-one testing and demo tool for product management teams. - [Try it for free](/app/link) ## Proven capabilities, trusted by thousands ## Seamlessly collaborate across teams ### Preview emails [See what your emails really look like](/email-previews), on everything from Microsoft Outlook and IBM Notes on PC, to Apple Mail on iPhone and Gmail on Android. ### Bring teams together Work in harmony with other teams and departments globally with Mailosaur’s centralized system, allowing shared access for 500+ users on a single account. ### Replicate real users Simulate the user journey easily and accurately with access to unlimited [email addresses](/email-testing) and dedicated mobile phone numbers. ## Reduce risk and last minute delays Message‑driven issues are a common cause of post-release issues. From one-time passcode messages that don't behave properly, to customers hitting [reply](/features/send-reply-forward) (when your previous testing hadn't covered that,) Mailosaur can ensure issues are caught before deployment, so your brand trust isn't impacted. - [More on previews](/email-previews) ## Validate the experience, not just the message Mailosaur empowers Product Managers to see exactly how emails and SMS behave in real journeys; trigger to delivery to interaction. Instead of reviewing screenshots or relying on assumptions, you can validate that the right message is sent at the right moment, the content and rendering are correct across inboxes and, crucially, that the journey still makes sense when users reply or interact. ## Used by those in the know > This is the easiest solution to test your emails and I can show you how it works in 5 minutes. — Filip Hric, Developer & Cypress Ambassador [Learn more](/customers) ## Bring stakeholders into the review process Mailosaur makes it easy to share messages and previews with stakeholders for review, without forwarding real emails or using personal inboxes. Product Managers can gather async feedback from design, marketing, engineering, or compliance, and keep discussions focused on a single source of truth, while moving decisions forward faster. ## Fewer customer‑reported issues after launch By validating communications before release, teams reduce the risk of releasing confusing or broken onboarding journeys, preventing surges in support tickets and eroded trust. Broken authentication flows can be enough for some customers to reconsider your competitors, especially when being unable to access their account prevents them accessing money, using a product they've paid for, or checking on a purchase they've made. ## Our products Everything you need to test customer communication ### Email Testing Create end-to-end tests that rely on email. Test account verification emails, password resets, email tracking and more. [Learn more](/email-testing) ### Email Previews Instantly see how your email will look to any recipient, no matter what email client they use, so there are no nasty surprises. [Learn more](/email-previews) ### SMS Testing Build text messages that work. Create end-to-end tests that cover identity verification, alerting, promotional messages, and more. [Learn more](/sms-testing) ## Test all user interactions Test end-to-end scenarios, validate emails, and integrate with our API for seamless workflows. Start your 14 day free trial today. - [Contact us](/contact) - [Get started](/app/signup) --- Source: https://mailosaur.com/quality-assurance # Reliable end‑to‑end testing for QA teams Mailosaur gives QA teams a deterministic, isolated way to test message‑driven workflows with confidence. - [Try it for free](/app/login) ## Trusted by QA teams across every industry ## Test email and SMS in one consistent workflow Mailosaur allows QA teams to test both [email](/email-testing) and [SMS](/sms-testing) using the same approach and tooling, making it easy to validate: - Signup and onboarding journeys - Password reset flows - One-time passcodes, [MFA](/mfa) and authentication paths - Transactional notifications and alerts ## Deterministic tests without inbox collisions Mailosaur provides unlimited email addresses, and test [inboxes](/features/smtp) that can be used freely across environments, test runs, and team members. Each test operates in isolation, eliminating shared state, race conditions, and flaky tests that undermine confidence in automation results. ## Used by those in the know > This is the easiest solution to test your emails and I can show you how it works in 5 minutes. — Filip Hric, Developer & Cypress Ambassador [Learn more](/customers) ## Validate rendering without leaving your test workflow Email Previews in Mailosaur allow QA teams to inspect how emails render across real devices, email clients, and light or dark mode. This makes it possible to validate layout and visual regressions alongside functional tests, instead of relying on screenshots or email service provider editors that don’t reflect real inbox behaviour. - [More on previews](/email-previews) ## Why Mailosaur? ### Use your favorite framework Mailosaur supports Cypress, Playwright, Selenium, Robot Framework, and more. ### Manage team access per project Our centralized system allows shared access for your entire team on a single account. ### Compliant and secure With comprehensive information security and GDPR-compliant controls, we are committed to protecting your data. ## Trusted by QAs across the board > We have experimented with various tools for handling emails in test automation, particularly for OTPs and 2FA, and Mailosaur has consistently been the easiest to use—it just works.” — Pavel P., QA Engineer [More from Pavel](https://www.g2.com/products/mailosaur/reviews/mailosaur-review-11971530) > It's easy setup and you can customize the functionality for 20 scrum teams. — QA and Observability Engineer in Retail [Read more](https://www.capterra.com/p/201911/Mailosaur/#Capterra___6139931) > The one email platform for testing. I love Mailosaur as it allows me to create multiple inboxes with different domains but manage them all under one access and one view. [I also like] its capability to integrate with familiar test automation tools like Cypress and Playwright. — Azri M., Senior QA Engineer [More from Azri](https://www.g2.com/products/mailosaur/reviews/mailosaur-review-11414143) ## Built to integrate with real QA stacks Mailosaur fits naturally into existing QA automation workflows. Whether tests run locally or in CI, QA teams can send real emails or SMS from the application under test, fetch messages via API, and assert on content, links, verification codes, and timing. ## How it works Boost end-to-end test coverage in minutes, by integrating with Mailosaur. ### Send an SMS message Trigger a process in your product that sends out email or SMS (e.g. requesting a password reset). ### Fetch the email from Mailosaur Use one of our client libraries to pinpoint and pull the email down into your test code. ### Complete the process Check the content of the message, following a link or using a verification code. ## Our products Everything you need to test customer communication ### Email Testing Create end-to-end tests that rely on email. Test account verification emails, password resets, email tracking and more. [Learn more](/email-testing) ### Email Previews Instantly see how your email will look to any recipient, no matter what email client they use, so there are no nasty surprises. [Learn more](/email-previews) ### SMS Testing Build text messages that work. Create end-to-end tests that cover identity verification, alerting, promotional messages, and more. [Learn more](/email-previews) ## Test all user interactions Test end-to-end scenarios, validate emails, and integrate with our API for seamless workflows. Start your 14 day free trial today. - [Contact us](/contact) - [Get started](/app/signup) --- Source: https://mailosaur.com/robot-framework # Use Robot Framework to test user interactions From email notifications to SMS alerts, promotional offers to authentication Mailosaur lets you build end-to-end tests for common customer actions that would usually require manual testing, like resetting a password. - [Get started](/app/signup) - [How it works](#mailosaur-works-by-capturing-every-message-you-send) ## Trusted by leading brands worldwide ## Increase test coverage by testing these common scenarios Reduce manual testing, speed up releases and avoid test regression ### Links sent to end users Complete the end-to-end testing of password reset workflows, account verification, rescheduling a delivery, or unsubscribing. 
Use Robot Framework to validate that [emails](/email-testing) and SMS messages contain the right content, target the right audience, and include valid links that work every time. Plus ensure links expire after a certain period of time. ### Multi-factor authentication Test [multi-factor authentication](/mfa) (MFA) and two-factor authentication (2FA) workflows end-to-end, from login attempt through to successful account access. 

Use Robot Framework to verify that authentication emails or SMS messages are sent correctly, contain valid OTP codes, and are delivered to the right users.

 Validate the functionality and security of MFA and 2FA links and codes by ensuring they work as expected and expire within the defined time limit. ### Email notifications Automate and test email notification workflows, from trigger events to successful delivery. Use Robot Framework to validate that notifications are sent with the correct content, reach the intended recipients, and include functional links or actions.

 Test for consistency, ensuring emails are formatted correctly across devices, contain accurate timestamps, and comply with expiration or time-sensitive requirements. ### SMS messages Thoroughly test [SMS message](/sms-testing) workflows to ensure they function. Use Robot Framework to validate that SMS messages are correctly targeted, deliver accurate content, and include operational links or codes.

 Focus on reliability by testing prompt delivery, proper formatting, and compliance with expiration timelines to ensure secure and user-friendly communication. ## Mailosaur ### Mailosaur works by capturing every message you send #### Unlimited test email addresses Every inbox in your account gives you instant access to an infinite number of email addresses to test with. With no setup required, you can use a unique address for every test case, scenario or team.  #### International phone numbers Instead of using personal devices, which rely on staff availability and geography. Access phone numbers from around the world and grant team member access so that you can test together. #### An API loved by testers Built for QA automation, Mailosaur’s API allows testers to integrate email, SMS and 2FA testing directly into their existing tech stack. Our customers love our easy-to-use documentation and the speed in which they got started. #### Assertions in your library It does not matter what programming language or test framework you use. With official API clients for all major programming languages, you can build test cases and write assertions in the way you’re used to. ## Automate tests in minutes With just a few lines of code added to your project Whether you use [Python, Java or .NET](/docs/automation), Mailosaur is quick to integrate within Robot Framework, requiring just a few lines of code and a few minutes of your time. 

Enjoy seamless, reliable test automation with Mailosaur, enabling rapid validation of user interactions and ensuring consistent, high-quality results across all your test environments. - [Integrate here ](/docs/automation/robot-framework) ## Customer stories > Mailosaur's user-friendly API seamlessly integrates into existing workflows, delivering reliable automation that accelerates development cycles and enhances product quality. — Luke Elliot, Director of Engineering, OakNorth [Learn more](/customers/oaknorth) ## Need help getting started? Explore our comprehensive documentation, step-by-step guides, and code examples tailored for Robot Framework users. ### [How to test emails in Robot Framework](/docs/automation/robot-framework) Follow our detailed guide to integrate email testing directly into your Robot Framework test scripts. ### [How to test SMS messages in Robot Framework](/docs/automation/robot-framework) Step-by-step guide to see how easily you can test SMS workflows directly within your Robot Framework test scripts. ### [Getting started with Robot Framework ](/blog/getting-started-with-robot-framework) Learn how to set up your testing environment, integrate Mailosaur with Robot Framework scripts to start testing. ### [Testing HTML content with Robot Framework](/docs/automation/robot-framework) Start testing HTML body content for an email with Robot Framework. ## QA automation tailored to your industry Mailosaur is loved across all industries, helping test the world’s most popular products and services. ### Financial Automate the end-to-end testing of [fintech](/industries/financial) helpdesk responses and payment reminders for overdue payments to timely replies to enquiries. ### Healthcare Validate [patient alerts](/industries/healthcare), like appointment bookings to reminders. Test real scenarios, such as invalid contact details, to test alerts work. ### Media Test and automate to identify issues early. Test event invites & promos include correct details, RSVP links, codes, and subscription info. ### Retail Automate testing for [retail orders](/industries/retail), promo codes, and shipping updates to detect issues early and ensure a seamless customer experience. ### Travel Test [real-world scenarios](/industries/travel) like flight updates, delays, gate changes, booking confirmations, check-in reminders, and itinerary updates. ### Automotive Test updates for vehicles or parts. Like tracking numbers, delivery times, and shipping notifications. ## Automate anything your users might do Automate end-to-end scenarios, validate emails, and integrate with our API for seamless workflows. Start your 14 day free trial today. - [Start free trial ](/app/signup) --- Source: https://mailosaur.com/security # Security and trust The highest standard of physical security and environmental controls ## Trusted by the world’s largest organizations ## Secure data protection ### Our data centers Our servers are hosted with Google Cloud Platform in data centers in the EU and the United Kingdom, chosen with security in mind. ### Data encryption All our systems are protected by up-to-date encryption protocols, cipher suites, and encrypted at rest using AES-256. ## Security you can rely on We are regularly audited by independent third-party experts, showcasing our commitment to the highest levels of information security controls and safeguards. - GDPR, Data Protection Act, CCPA - ISO27001:2022 certified - SOC 2 Type II audited - PCI DSS compliant ## Access control Protect your account and test data by controlling exactly who can access them. ### Single sign-on (SSO) Sign in with Okta, Microsoft Entra ID or any SAML or OIDC provider, and make SSO mandatory for your team. ### SCIM provisioning Add and remove users automatically, with groups synced to Mailosaur Teams so access follows your existing structure. ### Role-based access control (RBAC) Set permissions for teams across your account, projects and inboxes, giving new people the right access the moment they join a team. ### IP allowlisting Only allow access to your account from IP addresses you trust, such as your office network or VPN. ## Adhering to cloud security assessments We are completely transparent when it comes to security, that’s why we’re ready to answer any questions you might have, including those provided by assessment questionnaires like the Vendor Security Alliance (VSA). We offer a Security Assessment Pack to all those who need it. Just contact us, and our team will happily send this information over. ## Ready to get started? Get in touch or create an account Start your 14 day free trial today. - [Contact us](/contact) - [Get started](/app/signup) --- Source: https://mailosaur.com/selenium # Use Selenium to test user interaction, in minutes From email notifications to SMS alerts, promotional offers to authentication Mailosaur lets you build end-to-end tests for common customer actions that would usually require manual testing, like resetting a password. - [Get started](/app/signup) - [How it works](#mailosaur-works-by-capturing-every-message-you-send) ## Trusted by leading brands worldwide ## Increase test coverage by testing these common scenarios Reduce manual testing, speed up releases and avoid test regression ### Links sent to end users Complete the end-to-end testing of password reset workflows, account verification, rescheduling a delivery, or unsubscribing. 
Use Selenium to validate that [emails](/email-testing) and SMS messages contain the right content, target the right audience, and include valid links that work every time. Plus ensure links expire after a certain period of time. ### Multi-factor authentication Test [multi-factor authentication](/mfa) (MFA) and two-factor authentication (2FA) workflows end-to-end, from login attempt through to successful account access.

Use Selenium to verify that authentication emails or SMS messages are sent correctly, contain valid OTP codes, and are delivered to the right users.

Validate the functionality and security of MFA and 2FA links and codes by ensuring they work as expected and expire within the defined time limit. ### Email notifications Automate and test email notification workflows, from trigger events to successful delivery. Use Selenium to validate that notifications are sent with the correct content, reach the intended recipients, and include functional links or actions.

Test for consistency, ensuring emails are formatted correctly across devices, contain accurate timestamps, and comply with expiration or time-sensitive requirements. ### SMS messages Thoroughly test [SMS message](/sms-testing) workflows to ensure they function. Use Selenium to validate that SMS messages are correctly targeted, deliver accurate content, and include operational links or codes.

Focus on reliability by testing prompt delivery, proper formatting, and compliance with expiration timelines to ensure secure and user-friendly communication. ## Mailosaur ### Mailosaur works by capturing every message you send #### Unlimited test email addresses Every inbox in your account gives you instant access to an infinite number of email addresses to test with. With no setup required, you can use a unique address for every test case, scenario or team.  #### International phone numbers Instead of using personal devices, which rely on staff availability and geography. Access phone numbers from around the world and grant team member access so that you can test together. #### An API loved by testers Built for QA automation, Mailosaur’s API allows testers to integrate email, SMS and 2FA testing directly into their existing tech stack. Our customers love our easy-to-use documentation and the speed in which they got started. #### Assertions in your library It does not matter what programming language or test framework you use. With official API clients for all major programming languages, you can build test cases and write assertions in the way you’re used to. ## Automate tests in minutes With just a few lines of code added to your project Whether you use [Python C#, Java, Ruby, or Node.js](/docs/automation), Mailosaur is quick to integrate within Selenium, requiring just a few lines of code and a few minutes of your time. 

Enjoy seamless, reliable test automation with Mailosaur, enabling rapid validation of user interactions and ensuring consistent, high-quality results across all your test environments. - [Try our quick start guide](/docs/automation/selenium/quickstart) ## Customer stories > Mailosaur's user-friendly API seamlessly integrates into existing workflows, delivering reliable automation that accelerates development cycles and enhances product quality. — Luke Elliot, Director of Engineering, OakNorth [Learn more](/customers/oaknorth) ## Need help getting started? Explore our comprehensive documentation, step-by-step guides, and code examples tailored for Selenium users. ### [How to test emails in Selenium](/docs/automation/selenium/email-testing) Follow our detailed guide to integrate email testing directly into your Selenium test scripts. ### [How to test SMS messages in Selenium](/docs/automation/selenium/sms-testing) Step-by-step guide to see how easily you can test SMS workflows directly within your Selenium test scripts. ### [How to automate 2FA in Selenium](/blog/automating-2fa-testing-selenium) Learn how to test the retrieval and verification of one-time passwords (OTPs) for smooth authentication workflows. ### [Selenium quickstart guide](/docs/automation/selenium/quickstart) Step by step guide to set up your testing environment, integrate Mailosaur with Selenium scripts to start testing. ## QA automation tailored to your industry Mailosaur is loved across all industries, helping test the world’s most popular products and services. ### Financial Automate the end-to-end testing of [fintech](/industries/financial) helpdesk responses and payment reminders for overdue payments to timely replies to enquiries. ### Healthcare Validate [patient alerts](/industries/healthcare), like appointment bookings to reminders. Test real scenarios, such as invalid contact details, to test alerts work. ### Media Test and automate to identify issues early. Test event invites & promos include correct details, RSVP links, codes, and subscription info. ### Retail Automate testing for [retail orders](/industries/retail), promo codes, and shipping updates to detect issues early and ensure a seamless customer experience. ### Travel Test [real-world scenarios](/industries/travel) like flight updates, delays, gate changes, booking confirmations, check-in reminders, and itinerary updates. ### Automotive Test updates for vehicles or parts. Like tracking numbers, delivery times, and shipping notifications. ## Works with any flavor of Selenium It doesn’t matter which Selenium library you’re using, we support them all. From Java to Python, Ruby to .NET - [Java](/docs/automation/java) - [Javascript](/docs/automation/nodejs) - [Python](/docs/automation/python) - [Ruby](/docs/automation/ruby) - [PHP](/docs/automation/php) - [.NET](/docs/automation/dotnet) ## Automate anything your users might do Automate end-to-end scenarios, validate emails, and integrate with our API for seamless workflows. Start your 14 day free trial today. - [Start free trial](/app/signup) --- Source: https://mailosaur.com/sms-testing # End-to-end SMS testing made simple From OTPs to MFA, Mailosaur's SMS Testing ensures every message is dispatched, delivered, and displayed exactly as you intend. ## Join thousands of companies using Mailosaur ## Go beyond basic testing Confirm every SMS reaches the right user, at the right time and contains the right information. ### Test every SMS workflow reliably Validate delivery timing, content accuracy, and message behaviour, including for one-time passcodes, verification codes, and security‑critical flows. ### Automate your testing Run SMS OTP testing, verification code flows, and SMS notification tests using Mailosaur’s API with Cypress, Playwright, Selenium, and more. ### No real phones required Test SMS using dedicated numbers across supported regions, without relying on phones or live SIMs. Perfect for reproducing regional delivery differences, and real‑world constraints. ## Built for your team From verification codes to notifications, Mailosaur is the most reliable SMS testing tool for development, QA automation, and product teams. With options to set hierarchal permissions for your projects, it's never been easier to keep everyone on the same page. ## Mailosaur allows you to - Protect access and security by testing OTPs, MFA, and time‑sensitive codes before users depend on them. - Maintain customer trust by preventing failed messages and broken verification flows. - Scale safely with high‑volume SMS testing that reflects real delivery constraints. - Designed for both manual validation and automation, with simple setup today and deeper integration when you need it. ## The only email and SMS testing platform you need - [Start your free trial](/app/signup) ## What do our customers say > Mailosaur makes it incredibly easy to capture and inspect emails/SMS messages sent from staging or automated tests. No manual inbox juggling—everything is centralized and API-driven. — Current user in IT Services [Read more](https://www.g2.com/products/mailosaur/reviews/mailosaur-review-12010118) > Great solution for our automated test suite to both handle real SMS and email testing programmatically. — Nathan G, CTO in Computer Software [Read more](https://www.capterra.com/p/201911/Mailosaur/#Capterra___4797093) > The UI is really smooth and learning curve is minimal for this software. Even a beginner can get hold of the easy to use process and adapt very quickly. — Naman G, Senior Quality Assurance Engineer in Marketing and Advertising [Read more](https://www.g2.com/products/mailosaur/reviews/mailosaur-review-9758302) ## Yes, you can automate that By integrating Mailosaur's API with your stack, you can start high-volume, comprehensive testing in minutes, without the tedious manual checks. With quickstart guides and documentation for most frameworks and languages, it's easy to see how Mailosaur can slot into your workflows and start saving you time. - [More on automation](/automation) ## Cover every message-driven journey SMS testing is only part of the picture. To be confident in message‑driven experiences, teams also need to validate how emails behave, visually and functionally, across real conditions. Mailosaur lets you test email and SMS together, so no part of the journey is left to chance. - [More on Email Testing](/email-testing) - [More on previews](/email-previews) ## Frequently asked questions ### What do you mean by SMS testing? SMS testing means validating that text messages work correctly as part of real customer journeys, not just that they’re sent. With Mailosaur, teams test delivery, timing, content, and behaviour of SMS messages in scenarios like OTP entry, MFA flows, alerts, and notifications, so users aren’t blocked or confused when it matters most. ### Why is SMS so critical, and so hard to test properly? SMS messages are often time‑sensitive and security‑critical, with only one shot to get it right. If a code arrives late, expires too quickly, or doesn’t match expectations, users are locked out instantly. Mailosaur lets teams test these crucial moments under realistic conditions, helping prevent failures that directly impact access, trust, and conversion. ### Can Mailosaur test authentication flows like OTP, MFA, and password resets? Yes. Mailosaur is commonly used to automate testing of [authentication](/mfa) and verification flows, including OTP emails, SMS [codes](/features/links-and-codes), and multi‑factor authentication. Teams use it to confirm codes are delivered correctly, can be extracted automatically, expire as expected, and don’t fail under edge cases- reducing login issues and account lockouts in production. ### Do I need a physical phone or SIM card to test SMS with Mailosaur? No. Mailosaur provides dedicated virtual test numbers that behave like real mobile numbers, without requiring personal phones or SIMs. Messages sent to these numbers are captured safely in Mailosaur, allowing teams to inspect, validate, and test SMS behaviour without touching real devices or customers. You can find out more about setup on our [docs pages](/docs/sms-testing). ### Can Mailosaur be used for automated email and SMS testing? Yes. Mailosaur provides APIs designed specifically for automated testing of email and SMS within modern test frameworks and CI/CD pipelines. Engineering and QA teams commonly use Mailosaur to automate workflows such as account verification, [OTP delivery](/mfa), password reset flows, and negative testing scenarios using tools like [Cypress](/docs/automation/cypress), [Selenium](/docs/automation/selenium), [Playwright](/docs/automation/playwright), [Cucumber](/docs/automation/cucumber), and [Postman](/docs/automation/postman). ### Can I test SMS securely across regions and at scale? Yes. Mailosaur supports SMS testing across multiple regions and is built to handle high‑volume testing safely. Regional requirements and availability can vary, so the team [works with you](/contact) to ensure access to appropriate test numbers and configurations, without exposing real customer data or live systems ### Is Mailosaur secure for testing sensitive and regulated workflows? Yes. Mailosaur is designed for testing sensitive workflows like account verification, password resets, payment alerts, and two-factor authentication notifications. You can test safely in development or staging, control data retention, and avoid using real customer data, making it suitable for teams with strict security or [compliance requirements](/blog/compliance-governance-security). ### Does Mailosaur support parallel testing? Yes. Each inbox in Mailosaur can handle concurrent email and SMS tests. You can create multiple test accounts or servers to isolate parallel test runs. ## Ready to get started? Get in touch or start your free trial Start your 14-day trial and be confident your message just works, every time. - [Contact us](/contact) - [Get started](/app/signup) --- Source: https://mailosaur.com/startups # Email & SMS testing for startups Mailosaur helps startups safely test emails and SMS, like sign‑ups, password resets, and OTPs, so small errors don’t turn into customer‑visible problems. - [Get a free demo for your startup](/demo) ## Trusted by fast-growing teams ## Stop worrying about what customers might see Broken links, missing content, expired codes, or emails that look fine in an editor but break in real inboxes- these are easy to miss and very public when they happen.
 Mailosaur gives you a safe place to catch those issues quietly, before customers ever notice. No workarounds. No checking personal inboxes. No crossed fingers after deploy. ## Simple setup, even if it’s just you Create test email addresses instantly, send messages from your app, and see exactly what arrives. No complex configuration, no infrastructure to maintain, and no need for a dedicated QA team. Many startups use Mailosaur day one, even with a single developer or founder running the tests themselves. ## Loved by startups > A great, affordable, digital marketing solution. Does email and SMS really well and doesn't break the bank. — Sean W., Web designer for a small-business [More from Sean](https://www.g2.com/products/mailosaur/reviews/mailosaur-review-9176603) ## Start manually. Automate later. Create test [email addresses](/email-testing) instantly, send messages from your app, and see exactly what arrives. No complex configuration, no infrastructure to maintain, and no need for a dedicated QA team. ## Centralise message testing early As products grow, message testing often becomes messy, with personal inboxes, shared phones, copy‑paste checks and forgotten edge cases taking centre stage. Mailosaur gives you one clean place to test your email, SMS, OTPs, verification links, and confirmations, while also allowing you to generate device-accurate [email previews](/email-previews)- so all of your functional and visual checks can be done in one place. ## Our products Everything you need to test customer communication ### Email Testing Create end-to-end tests that rely on email. Test account verification emails, password resets, email tracking, and more. [Find out more](/email-testing) ### Email Previews Instantly see how your email will look to any recipient, no matter what email client they use, so there are no nasty surprises. [Find out more](/email-previews) ### SMS Testing Build text messages that work. Create end-to-end tests that cover identity verification, alerting, promotional messages, and more [Find out more](/sms-testing) ## Ready to get started? Get in touch or create an account Start your 14 day free trial today. - [Contact us](/contact) - [Get started](/app/signup) --- Source: https://mailosaur.com/webdriverio # Use WebdriverIO to test user interaction From email notifications to SMS alerts, promotional offers to authentication Mailosaur lets you build end-to-end tests for common customer actions that would usually require manual testing, like resetting a password. - [Getting started](/app/signup) - [How it works](#mailosaur-works-by-capturing-every-message-you-send) ## Trusted by leading brands worldwide ## Increase test coverage by testing these common scenarios Reduce manual testing, speed up releases and avoid test regression ### Links sent to end users Complete the end-to-end testing of password reset workflows, account verification, rescheduling a delivery, or unsubscribing. 
Use WebdriverIO to validate that [emails](/email-testing) and [SMS messages](/sms-testing) contain the right content, target the right audience, and include valid links that work every time. Plus ensure links expire after a certain period of time. ### Multi-factor authentication Test [multi-factor authentication](/mfa) (MFA) and two-factor authentication (2FA) workflows end-to-end, from login attempt through to successful account access. 

Use WebdriverIO to verify that authentication emails or SMS messages are sent correctly, contain valid OTP codes, and are delivered to the right users.

 Validate the functionality and security of MFA and 2FA links and codes by ensuring they work as expected and expire within the defined time limit. ### Email notifications Automate and test email notification workflows, from trigger events to successful delivery. Use WebdriverIO to validate that notifications are sent with the correct content, reach the intended recipients, and include functional links or actions.

 Test for consistency, ensuring emails are formatted correctly across devices, contain accurate timestamps, and comply with expiration or time-sensitive requirements. ### SMS messages Thoroughly test [SMS message](/sms-testing) workflows to ensure they function. Use WebdriverIO to validate that SMS messages are correctly targeted, deliver accurate content, and include operational links or codes.

 Focus on reliability by testing prompt delivery, proper formatting, and compliance with expiration timelines to ensure secure and user-friendly communication. ## Mailosaur ### Mailosaur works by capturing every message you send #### Unlimited test email addresses Every inbox in your account gives you instant access to an infinite number of email addresses to test with. With no setup required, you can use a unique address for every test case, scenario or team.  #### International phone numbers Instead of using personal devices, which rely on staff availability and geography. Access phone numbers from around the world and grant team member access so that you can test together. #### An API loved by testers Built for QA automation, Mailosaur’s API allows testers to integrate email, SMS and 2FA testing directly into their existing tech stack. Our customers love our easy-to-use documentation and the speed in which they got started. #### Assertions in your library It does not matter what programming language or test framework you use. With official API clients for all major programming languages, you can build test cases and write assertions in the way you’re used to. ## Automate tests in minutes With just a few lines of code added to your project Whether you use with [Javascript or any other language](/docs/automation), Mailosaur is quick to integrate within WebdriverIO, requiring just a few lines of code and a few minutes of your time. 

Enjoy seamless, reliable test automation with Mailosaur, enabling rapid validation of user interactions and ensuring consistent, high-quality results across all your test environments. - [Integrate Javascript ](/docs/languages/javascript) ## Customer stories > Mailosaur's user-friendly API seamlessly integrates into existing workflows, delivering reliable automation that accelerates development cycles and enhances product quality. — Luke Elliot, Director of Engineering, OakNorth [Learn more](/customers/oaknorth) ## Need help getting started? Explore our comprehensive documentation, step-by-step guides, and code examples tailored for WebdriverIO users. ### [How to test emails in WebdriverIO](docs/frameworks-and-tools/webdriverio#test-email-addresses-with-mailosaur) ### [How to test SMS messages in WebdriverIO](/docs/frameworks-and-tools/webdriverio#find-an-sms-message) ### [Testing account verification with WebdriverIO](/docs/frameworks-and-tools/webdriverio#find-an-email) ### [WebdriverIO quickstart guide](/docs/frameworks-and-tools/webdriverio#find-an-email) ## QA automation tailored to your industry Mailosaur is loved across all industries, helping test the world’s most popular products and services. ### Financial Automate the end-to-end testing of [fintech](/industries/financial) helpdesk responses and payment reminders for overdue payments to timely replies to enquiries. ### Healthcare Validate [patient alerts](/industries/healthcare), like appointment bookings to reminders. Test real scenarios, such as invalid contact details, to test alerts work. ### Media Test and automate to identify issues early. Test event invites & promos include correct details, RSVP links, codes, and subscription info. ### Retail Automate testing for [retail orders](/industries/retail), promo codes, and shipping updates to detect issues early and ensure a seamless customer experience. ### Travel Test [real-world scenarios](/industries/travel) like flight updates, delays, gate changes, booking confirmations, check-in reminders, and itinerary updates. ### Automotive Test updates for vehicles or parts. Like tracking numbers, delivery times, and shipping notifications. ## Automate anything your users might do Automate end-to-end scenarios, validate emails, and integrate with our API for seamless workflows. Start your 14 day free trial today. - [Start free trial ](/app/signup) --- Source: https://mailosaur.com/features/custom-domains # Use your own domain Unlimited recognizable email addresses for your brand Completely customize your email addresses by using your own domain name, so they are unique to you and accurately represent your brand - [Talk to our team](/contact) - [Start your free trial](/app/signup) ## Capture every email your product sends during development and QA One of the main advantages of having email addresses that use your organization's own domain is that they are easy for your team to remember and use - Mailosaur works with any domain that you own. ## Totally unique to you Having a custom domain allows you to receive emails at any address you like (such as @mycompany.com), not just from Mailosaur’s own domain, so everything remains consistent throughout your product. ## Easily distinguishable As well as custom domains, you are also able to create unlimited subdomains. Avoid emails getting cluttered together by using a different subdomain for each project or internal environment. ## Empower teams With the ability to have separate mailboxes for testing and demonstrating, each team is able to work collaboratively on one platform without all emails being combined and difficult to find. ## Why not try it for yourself? It's quick, easy, and free to try Mailosaur Get in touch with us and set up a demo, or dive in and start your 14 day free trial - [Book a demo](/demo) - [Start your free trial](/app/signup) --- Source: https://mailosaur.com/features/forwarding-rules # Forwarding Rules Automating your emails with Mailosaur Automate email workflows with Mailosaur's Forwarding Rules. Easily forward emails based on your own custom rules. - [Talk to our friendly team](/contact) - [Start your free trial](/app/signup) ## Filter out unwanted emails Only see the emails in your inbox that matter to you or your team by setting up your own unique forwarding rules. Automatically filter out emails sent to/from certain email addresses, or emails that have subjects containing certain words. ## Alert your team of emails that matter Important emails never go under the radar when you use Forwarding Rules with Mailosaur. Be sure that your team only receives emails that are relevant to them, for a more efficient working environment. ## Never accidentally send test emails to customers With automatic forwarding rules, you can ensure that test emails never leave your testing environment or end up in the wrong hands. Not only does this ensure your brand integrity is never compromised, but it also saves you from having to send out follow up “oops” emails. ## Automatically send emails to other systems View and interact with emails in your own, personal email client, instead of solely in the Mailosaur Dashboard, by setting up a forwarding rule to automatically send emails elsewhere. ## Ready to give it a go? It's quick, easy, and free to try Mailosaur Get in touch with us and set up a demo, or dive in and start your 14 day free trial - [Book a demo](/demo) - [Start your free trial](/app/signup) --- Source: https://mailosaur.com/features/links-and-codes # Test links & verification codes Peace of mind that you are sending exactly what you mean to Quickly check and test your emails and SMS for broken links and codes quickly and easily. - [Book a demo](/demo) - [Sign up for your free trial](/app/signup) ## Catch broken links before your customers do Whether it’s a link to a landing page, a password reset, or anything in between, broken links are a headache that can affect not only your customer interactions, but also your brand reputation. ## Check your journey is seamless While your initial link might work perfectly, it is hard to know if the entire customer journey works from start to finish. Mailosaur enables end-to-end testing that gives full transparency into what your users will experience. ## Ensure tracking is working Check that your tracking parameters are being carried throughout the whole customer journey so you have a complete understanding of how well your campaign is doing and can optimize effectively. ## Links and codes are working- but can your users see them? Even if you triple check your links and codes are all working as you hope, how can you be sure every user can see them no matter the device? Preview your emails across devices, email clients and even landscape and portrait modes, and ensure that everything renders as you intend. No invisible links, no broken trust. - [More about previews](/email-previews) ## Test verification codes [Verification codes](/mfa) are a vital part of ensuring the safety and security of your customers. Make sure they work as planned every single time, giving complete trust in your automations. ## Ready to give it a go? It's quick, easy and free to try Mailosaur! Get in touch with us and set up a demo, or dive in and start your 14 day free trial - [Book a demo](/demo) - [Start your free trial](/app/signup) --- Source: https://mailosaur.com/features/message-analysis # Message Analysis with Mailosaur Ensuring the quality of your content is never compromised Analyze and debug emails. Gain insights, ensure accuracy, and enhance test email performance. - [Talk to our team](/contact) - [Start your free trial](/app/signup) ## Reliable email proofing We know how important it is to ensure your email is absolutely perfect when it reaches your customers. Unfortunately, issues often only become apparent after they have been sent out. This is where Mailosaur’s message analyzing features come in, to ensure peace of mind that your emails are received **exactly** as you intended. ## Email Previews With Mailosaur, you are able to [view how every email will look](/email-previews) on every email client. Get complete peace of mind that your content is displayed exactly how you want, every time - even when viewed in dark mode or on other devices. ## Content viewer Build emails and collaborate with your team with a central email viewing platform. Make it easy for teams to inspect content, headers, and attachments all in one place (and identify any issues that may appear) for **quicker fixes**. ## Key benefits ### Get actionable insights Increase deliverability with Mailosaur's expert advice that ensures your emails are never sent to junk or spam folders by testing your deliverability score. ### Identify and fix issues quickly Easily pinpoint any broken images, personalization, links, poor rendering, etc. to make sure your emails are of the highest quality and all issues are fixed before being sent. ### Ensure brand integrity While everybody understands that mistakes happen, it’s not a great look for broken emails to be sent to customers (or potential customers). Ensure your emails are received exactly the way you intend and never reach the wrong people. ## Ready to get started? Get in touch or create an account With a free 14 day trial and easy integration, it couldn't be easier to get started with Mailosaur. - [Book a demo](/demo) - [Start your free trial](/app/signup) --- Source: https://mailosaur.com/features/rules # Make your own rules Test more than just the happy path Create automated rules that simulate real-world challenges like email bounces, out-of-office replies, and server errors. - [Book a demo](/demo) - [Start your free trial](/app/signup) ## Take the edge off your edge cases Most systems are only tested for the happy path: email sent, link clicked, flow completed. Traditional tools stop there, without simulating what inboxes actually do: rejecting messages, sending automatic replies, or returning unexpected errors. As a result, systems look “tested” until something unexpected happens in production, where the impact is immediate and customer‑visible. Rules exist to close that gap. ## Make the unpredictable testable Rules let you automatically simulate real‑world email behaviour, like bounces, auto‑responses, and server errors. Instead of hoping these cases don’t happen, you can trigger them intentionally and confirm your product responds correctly every time. ## Key capabilities of 'Rules' - Test what happens when emails fail, like bounces, errors, or invalid addresses - Trigger real email server responses to check your error handling - Set simple rules based on things like sender, recipient, or subject line - Simulate automatic replies such as out‑of‑office messages or auto‑responders - Repeat hard‑to‑test edge cases easily, without manual setup or workarounds - Make sure your product handles failures properly, before customers see them ## Route important messages where they matter Rules don’t just control how emails behave, they can also control where those emails go. By setting forwarding rules, you can automatically send specific emails on to other inboxes or systems based on conditions you define. For example, you might forward only bounced messages, error notifications, or unexpected replies directly to your team, while everything else stays safely captured in Mailosaur. ## Invaluable for every member of the team Teams use 'Rules' to test realistic scenarios, e.g: ### Handling bounced emails correctly Your team could use rules to simulate email bounces (using simple address patterns) and verify the system responds as expected. You can: - Trigger a bounced email during user sign‑up - Confirm the account is marked undeliverable - Check users are prompted to update their email - Ensure admins are notified where needed This makes a hard‑to‑reproduce failure easy to test consistently. ### Testing system resilience Your team can use rules to simulate email server failures to ensure your systems fail safely under pressure. You can: - Trigger server errors using subject‑based rules - Confirm errors are caught and logged correctly - Verify emails are retried instead of lost This helps ensure email delivery issues don’t break core services. ### Pausing campaigns intelligently You may use rules to simulate real recipient behaviour to ensure campaigns respond appropriately. You can: - Trigger out‑of‑office auto‑replies - Test onboarding contacts marked as unavailable - Confirm campaigns pause or adjust automatically This prevents users being spammed while improving experience. ### Validating reply‑based features Your team can test how your system behaves when it receives automatic replies, such as out‑of‑office messages or bounce notifications. You can trigger an email, simulate an auto‑reply, and confirm your product handles the response correctly, without unexpected side effects or false signals before launch. ## Take control of email behavior, before users do Most systems fail in edge cases- not because teams missed something, but because those scenarios were never tested. Opting to test edge cases and real customer behavior flows gives you the confidence you deserve at launch, from "it worked in testing" to "it'll work no matter what". ## Ready to get started? Book a live demo with our sales team, or dive in independently Start automating your email and SMS in minutes with your free trial. --- Source: https://mailosaur.com/features/send-reply-forward # Sending, replying & forwarding emails Seamless email and SMS interactions, every time Emails don’t exist in isolation - they’re read, replied to and forwarded, and those interactions are often where journeys break. - [Book a demo](/demo) - [Start a free trial](/app/signup) ## Test how users actually interact with your messages Instead of stopping at “did the message send?”, you can test how your product behaves when users reply directly, forward messages, or trigger follow‑on behaviour. This feature validates interaction‑driven workflows- the parts of messaging that are hardest to test and easiest to overlook. ## Expect the unexpected Most customer‑visible failures don’t happen because an email wasn’t sent, they happen because testing didn't cover what a real user might do next. Users reply instead of clicking links. Emails are forwarded into shared inboxes. Replies trigger logic that was never tested. When these paths aren’t validated, problems only surface in production, where the impact is immediate and public. ## Simulate customer replies with confidence Mailosaur allows you to reply to emails and messages exactly as a real user would, then observe how your system responds. This makes it possible to validate reply‑based workflows end to end; whether that’s support routing, comment‑by‑email features, or automated responses triggered by inbound replies. You can confirm replies are received, processed, and handled correctly, rather than just assuming they’ll work. ## Manual forwarding for review and collaboration Mailosaur makes it easy to manually forward emails outside the platform, which is particularly useful when messages need human review or approval. Teams can share emails with colleagues, stakeholders, or clients without exposing real inboxes or production systems. This is often how Marketing and Product teams validate content, flows, and tone before launch, without needing access to test environments or technical tooling. ## Forward automatically, when it matters When forwarding behaviour needs to be consistent, this feature can be combined with 'Rules'. Specific interactions such as replies, bounces, or unexpected messages can be automatically forwarded to the right people or systems, while everything else remains safely captured in Mailosaur. This prevents teams from having to manually search through test traffic, while ensuring important signals don’t get missed. - [More on 'Rules'](/features/rules) ## The outcome: an undeniably better user experience By testing replies and forwards, not just delivery, teams can catch mistakes early, reduce edge‑case risk, and be confident that real user behaviour won’t undermine the experience. ## Give it a go! It's free, quick and easy to try out Mailosaur Start automating your email and SMS in minutes with your free trial. - [Request a live demo](/demo) - [Start your 14 day free trial](/app/signup) --- Source: https://mailosaur.com/features/smtp # Virtual SMTP servers from Mailosaur Our SMTP servers capture every email your product sends, so you can test sign‑ups, delivery updates, and more. - [Book your free demo](/demo) - [Start your free trial](/app/signup) ## What is a virtual SMTP server? A virtual SMTP server acts like a real email server, but instead of delivering emails to the outside world, it captures them safely for testing. With Mailosaur, every email sent via SMTP is intercepted, stored, and available for inspection, regardless of the recipient address, so nothing ever escapes into a real inbox by mistake. ## How to test using Mailosaur’s SMTP server ### Copy & paste your SMTP credentials Find these in the server settings screen, and paste them into your product's settings. ### Send your first email Any email you send via SMTP will be captured by Mailosaur, regardless of email addresses used. ### Inspect and test Emails instantly appear in Mailosaur, ready to preview, validate, or automate against. ## Never email a real customer by accident Mailosaur's catch-all SMTP servers safely capture all outgoing emails, even when addresses look real. This means you can test production-like flows safely, confidently validate edge cases, and ultimately avoid embarrassing mistakes. ## Works with any email‑sending setup Mailosaur works with any SMTP‑based system: custom code, frameworks, or third‑party email-sending providers, and fits right into your existing stack. If your product can send email, Mailosaur can capture it. - [See our documentation](/docs) ## Why teams choose Mailosaur's dummy SMTP servers - Mailosaur doesn’t just capture emails, it connects them to testing, previews, and validation in one place. - QA, product, and marketing teams can view, review, and validate messages from the dashboard without any code. - With environment‑specific servers, unlimited test addresses, and safe isolation from real inboxes, teams can test confidently. - Mailosaur is a managed platform; There’s no SMTP server to maintain, no inbox behaviour to keep up to date, and no custom tooling to secure. ## Separate inboxes, specific permissions Steer your own ship and organise your tests as you see fit. Create separate inboxes per team, role or project, and set hierarchal permissions for each, keeping your testing safe and compliant. ## See, test, and validate every message Mailosaur does far more than just capturing your emails. You can preview your emails (across devices and inboxes), inspect them for content issues, and even start running automated tests for full end-to-end flows. - [More on Email Testing ](/email-testing) - [More on previews](/email-previews) ## Ready to give it a go? It couldn't be easier to try Mailosaur Book a demo with our friendly team, or start your 14-day free trial to see if Mailosaur is the right fit for you - [Book a demo](/demo) - [Start your free trial](/app/signup) --- Source: https://mailosaur.com/features/sso # Enterprise-level security with Mailosaur Centralized security for your organization Make the most of security you can rely on. It's centralized and built to enterprise-grade standards and expectations. - [Chat to our team](/contact) - [Start your free trial](/app/signup) ## Data security & compliance We know that when it comes to data security, you can't cut corners. Mailosaur Enterprise Security enables organizations to add enterprise-grade identity and access management. - [See our trust centre](https://trust.mailosaur.com) ## How does it work? Mailosaur Enterprise Security allows you to connect your account to your identity provider, so you have full centralized security control. Simply log in and connect to your provider, whether that’s Okta, Microsoft Azure Active Directory, OneLogin, Google SAML, PingIdentity, or any SAML or OIDC enabled identity provider. ## Key benefits ### Enhanced team management Manage team members quickly and easily. From your dashboard, you can remove members if they leave the company, add users when they join, and change permissions with the click of a button. ### Increased visibility Admins are able to track all changes made by users, so you can oversee and gain company-wide insight, while also enabling the detection of suspicious behaviour. ### Easy integration Quickly and easily connect to your external identity provider in minutes, so you can spend less time on tedious tasks and more time on improving and innovating your product. ## Security and trust Mailosaur Enterprise Security is a key part of our commitment to security and compliance. For more information on our safeguarding, [visit our security page](/security). - [More about security](/security) ## Why not try it for yourself? It's quick, easy, and free to try Mailosaur Get in touch with us and set up a demo, or dive in and start your 14 day free trial - [Book a demo](/demo) - [Start your free trial](/app/signup) --- Source: https://mailosaur.com/industries/education # Confidence in every campus message Test invoices, timetables, and more, so students, staff, and families never miss a message that matters. - [Book a demo](/demo) - [Start your free trial](/app/signup) ## Trusted by organisations of all sizes ## Check every message that supports daily learning ### Accurate messages, every step of the way In education, timing and clarity are everything. Whether you're welcoming new students, confirming exam timetables, or updating parents on urgent closures, your emails and texts need to be accurate and reliable. Mailosaur ensures every message across every stage of the academic cycle is tested before it matters most. From admissions and attendance to results day and graduation, confidently deliver the right content, to the right people, at the right time. ### Secure access for your whole community From students logging into learning platforms to staff accessing payroll systems, secure sign-ins are critical. With Mailosaur, you can test your two-factor or [multi-factor authentication](/docs/authenticator) (2FA/MFA) flows end-to-end - including [one-time passcodes](/features/links-and-codes), password resets, and login confirmation emails or texts. ### Consistent communication on any screen Your recipients don’t all use the same device, and that matters. A busy parent on a mobile, a student on their tablet, a teacher reading emails on Outlook: each device and client renders messages differently. Mailosaur helps you [preview](/email-previews) and [test your emails](/email-testing) across platforms, ensuring consistent appearance and usability across devices, operating systems, and even light/dark modes. So no matter who’s reading it, or where, it looks exactly as intended. ## In education, every message matters Clear communication keeps students, staff, and families in sync. Whether it’s a timetable change, urgent closure, or virtual certificate, Mailosaur helps education providers test and verify every transactional email and SMS before they go live. With automation support, secure infrastructure, and device previews, teams trust Mailosaur to ensure messages are clear, timely, and reliable. ## How have other customers used Mailosaur? ### Department for Education Dept for Education ensured secure, reliable 2FA testing and met UK data residency needs with Mailosaur’s robust infrastructure and EU/UK-based storage options. [Find out more](/customers/the-department-for-education) ### UpBup UpBup saved time testing parent accounts and delivered a high-quality, custom-built platform with faster, smoother testing using Mailosaur. [Find out more](/customers/up-bup) ### Domino's Domino's Pizza streamlined QA workflows and increased test efficiency by integrating Mailosaur into their automation stack. [Find out more](/customers/dominos) ## Ready to learn more? Get started with a free demo or 14-day trial With a free trial and easy integration, you're minutes away from seeing how Mailosaur could be the answer to your testing needs. - [Book a demo](/contact) - [Start your free trial](/app/signup) ## Create structure, scale, and control From admissions to IT, different teams need visibility over different messages, and Mailosaur makes it easy to manage. Create unlimited test email addresses and [international phone numbers](/docs/sms-testing/phone-numbers) to mirror real student and parent journeys, from sign-ups to schedule changes. Use dedicated inboxes to separate systems like lunch payments or safeguarding alerts. With flexible permissions, give each team access to what they need, keeping workflows organised, data secure, and testing streamlined. ## Simulate real-life scenarios School communication isn’t just one-way. Parents reply, staff forward emails, and your systems need to handle it all. With Mailosaur, you can test how your platform handles real-world scenarios, like [replying](/features/send-reply-forward) to a safeguarding alert, forwarding a trip itinerary, or resending a password request. Simulate common behaviours and edge cases across email and SMS to catch issues before they reach students, families, or staff, ensuring your communications stay clear, reliable, and resilient. ## See how crucial emails render before you hit send From key date updates to tuition invoices and account setup flows, your emails may 'work' as they should, but will they render properly for every user? Preview your emails across devices, email clients, and even light and dark modes and ensure a smooth journey for every customer. - [Learn more about previews](/email-previews) ## Don't just take our word for it... > If we couldn’t use Mailosaur anymore, it’d be a serious disruption. I’d only hope the replacement looks and works half as well. — Gabriel Peter-Tomas, Department for Education [Learn more](/customers/the-department-for-education) ## Security you can rely on With the highest standard of physical security and environmental controls, all of our systems are protected by up-to-date encryption protocols, cipher suites, and encrypted at rest using AES-256. Mailosaur is also ISO27001 certified, and PCI DSS compliant. - [Find out more](/security) ## Works with any stack Mailosaur provides official libraries and plugins for all major programming languages and test frameworks. - [Cypress](/cypress) - [Ghost Inspector](/ghost-inspector) - [Insomnia ](/docs/automation/insomnia) - [Playwright](/playwright) - [PowerShell](/docs/automation/powershell) - [TestCafe](/docs/automation/testcafe) - [Selenium](/docs/automation/selenium) - [WebdriverIO](/docs/automation/webdriverio) - [Robot Framework](/robot-framework) - [Postman](/postman) - [See our documentation](/docs) ## Our products ### Email Testing Create end-to-end tests that rely on email. Test account verification emails, password resets, email tracking, and more [Learn more](/email-testing) ### SMS Testing Build text messages that work. Create end-to-end tests that cover identity verification, alerting, promotional messages and more [Learn more](/sms-testing) ### Email Previews Instantly see how your email will look to any recipient, no matter what email client they use, so there are no nasty surprises [Learn more](/email-previews) ## Frequently asked questions ### Can I test both email and SMS with Mailosaur? Yes, Mailosaur is unique in its ability to test both [email](/email-testing) and [SMS.](/sms-testing) This means that you can test product messaging functionality end to end, for example if a flow requires you to go from an email, to then get an [OTP code](/mfa) through SMS, and then an email confirmation. This allows you the greatest visibility of your customer journey and to optimise both email and SMS communications. ### Is Mailosaur secure for testing sensitive and regulated workflows? Yes. Mailosaur is designed for testing sensitive workflows like account verification, password resets, payment alerts, and two-factor authentication notifications. You can test safely in development or staging, control data retention, and avoid using real customer data, making it suitable for teams with strict security or [compliance requirements](/blog/compliance-governance-security). ### Does Mailosaur offer custom plans for enterprises or high-volume teams? Yes, we will work with you to build a solution tailored to you and your team's needs, which may include things like access to phone numbers in any of our supported countries, extra seats, high volume SMS capabilities and hands-on onboarding along with support throughout. [Reach out to our team](/contact) in order to discuss the possibilities. ### Can I try Mailosaur or speak to someone before committing to purchase? Yes. You can start with a [14‑day free trial](/app/signup) to explore Mailosaur on your own. If you’d prefer guidance, you can also [book a demo](/demo) to discuss your specific use case, whether that’s [marketing](/marketing) email [QA](//quality-assurance), automated transactional testing, or authentication workflows, before making a decision. ### Can I find out more about how other companies have used Mailosaur? Absolutely! We have a number of [customer stories](/customers) available on our website, ranging from startups to huge industry-leaders, with more added all the time. To start with, why not take a look at [Department for Education](/customers/the-department-for-education), [Domino's Pizza](/customers/dominos), or [OakNorth Bank](/customers/oaknorth). ## Ready to get started? Get in touch or create an account With a free 14 day trial and easy integration, it couldn't be easier to get started with Mailosaur. - [Book a demo](/demo) - [Start your free trial](/app/signup) --- Source: https://mailosaur.com/industries/financial # Maintain high quality, compliant products Test banking alerts, two-factor authentication, account updates and more. Ensure bulletproof quality with zero surprises. - [Book a demo](/demo) - [Start your free trial](/app/signup) ## Trusted by businesses of all sizes ## Keep financial communication fast and flawless ### Test any transactional email or SMS Validate fraud notifications, payment confirmations and more, across both [email](/email-testing) and [SMS](/sms-testing), replicating the customer journey end to end. ### Create unlimited test accounts Create unlimited email addresses, and allow your team access to different inboxes for every test, person or project. ### Test 2FA and MFA flows Easily test [2FA and multi-factor authentication](/docs/authenticator) flows via SMS, email or TOTP app. ## Built for fast-moving teams Financial communication is high-stakes. From onboarding to account security, customers expect instant, accurate, and secure information - while regulators demand proof you’re getting it right. Mailosaur helps [QA](/quality-assurance), DevOps, and security teams test end-to-end flows across email and SMS, so you stay compliant, reduce risk, and move faster without cutting corners. ## What our customers in Finance say > Mailosaur has helped us scale our testing for our Dashboard product from its formative stages to the critical application that it's become for our customers. — Matt N., SDET in Financial Services [Read more](https://www.capterra.com/p/201911/Mailosaur/#Capterra___4798435) > Very positive if I were to change company and they didn't have a Mailosaur license I would push to get one. — Lee W., Senior Test Automation Engineer in Insurance [Read more](https://www.capterra.com/p/201911/Mailosaur/#Capterra___6143208 ) > Mailosaur is easy to use and works as a one-stop shop for our auth testing. > This is great that Mailosaur support both email and SMS testing. — User in Insurance [Read more](https://www.g2.com/products/mailosaur/reviews/mailosaur-review-8157396) ## Ready to learn more? Get started with a free demo or 14-day trial With a free trial and easy integration, you're minutes away from seeing how Mailosaur could be the answer to your testing needs. - [Book a demo](/contact) - [Start your free trial](/app/signup) ## Prevent a mistake that could cost millions Minor messaging errors can have major consequences. Mailosaur lets you test every email and SMS - verifying [links](/features/links-and-codes), deliverability, attachments and more - so your communications are airtight, accurate, and always professional. ## Automate testing for faster releases Manual testing slows teams down - and finance moves fast. Mailosaur lets you automate end-to-end testing for [email](/email-testing) and [SMS](/sms-testing), so you can release updates, features, and fixes faster - without compromising on quality, security, or compliance. ## See how your crucial emails look before hitting send From credit score updates to payment receipt invoices and account setup flows, your emails may 'work' as they should, but will they render properly for every user? Preview your emails across devices, email clients, and even light and dark modes and ensure a smooth journey for every customer. - [Learn more about previews](/email-previews) ## Don't just take our word for it... > We highly recommend Mailosaur to any QA and development team seeking to optimize their testing processes for email and SMS functionalities. — Luke Elliot, Director of Engineering OakNorth [More about OakNorth](/customers/oaknorth) ## Security you can rely on Along with the highest standard of physical security and environmental controls, all of our systems are protected by up-to-date encryption protocols, cipher suites, and encrypted at rest using AES-256. Mailosaur is also ISO27001 certified, and PCI DSS compliant. - [Find out more about security](/security) ## Works with any stack Mailosaur provides official libraries and plugins for all major programming languages and test frameworks. - [TestCafe](/docs/automation/testcafe) - [Robot Framework](/robot-framework) - [PowerShell](/docs/automation/powershell) - [Ghost Inspector](/ghost-inspector) - [Insomnia ](/docs/automation/insomnia) - [Postman](/postman) - [Playwright](/playwright) - [Selenium](/docs/automation/selenium) - [WebdriverIO](/docs/automation/webdriverio) - [Cypress](/cypress) - [Get started](/app/signup) ## Our products ### Email Testing Create end-to-end tests that rely on email. Test account verification emails, password resets, email tracking, and more [Learn more](/email-testing) ### SMS Testing Build text messages that work. Create end-to-end tests that cover identity verification, alerting, promotional messages and more [Learn more](/sms-testing) ### Email Previews Instantly see how your email will look to any recipient, no matter what email client they use, so there are no nasty surprises [Learn more](/email-previews) ## Frequently asked questions ### Is Mailosaur secure for testing sensitive and regulated workflows? Yes. Mailosaur is designed for testing sensitive workflows like account verification, password resets, payment alerts, and two-factor authentication notifications. You can test safely in development or staging, control data retention, and avoid using real customer data, making it suitable for teams with strict security or [compliance requirements](/blog/compliance-governance-security). ### Can I test both email and SMS with Mailosaur? Yes, Mailosaur is unique in its ability to test both [email](/email-testing) and [SMS.](/sms-testing) This means that you can test product messaging functionality end to end, for example if a flow requires you to go from an email, to then get an [OTP code](/mfa) through SMS, and then an email confirmation. This allows you the greatest visibility of your customer journey and to optimise both email and SMS communications. ### Can I try Mailosaur or speak to someone before committing to purchase? Yes. You can start with a [14‑day free trial](/app/signup) to explore Mailosaur on your own. If you’d prefer guidance, you can also [book a demo](/demo) to discuss your specific use case, whether that’s [marketing](/marketing) email [QA](//quality-assurance), automated transactional testing, or authentication workflows, before making a decision. ### Does Mailosaur offer custom plans for enterprises or high-volume teams? Yes, we will work with you to build a solution tailored to you and your team's needs, which may include things like access to phone numbers in any of our supported countries, extra seats, high volume SMS capabilities and hands-on onboarding along with support throughout. [Reach out to our team](/contact) in order to discuss the possibilities. ### What security certifications does Mailosaur have? Mailosaur is SOC 2 Type II attested, ISO 27001:2022 certified, PCI DSS compliant and GDPR compliant. To see how your data is used and protected, visit our ['Security and Trust'](/security) page. If your team needs more detail for a security review, like our SOC 2 report or a Security Assessment Pack, [reach out](/contact) to our friendly team. ### Where can I find guides and documentation? Our [documentation pages](/docs) will show how quick and easy it is to integrate Mailosaur with your existing stack. There are specific guides for [popular test frameworks](/docs/automation) as well as for our [official API client libraries](/docs/automation). ## Ready to get started? Get in touch or create an account With a free 14 day trial and easy integration, it couldn't be easier to get started with Mailosaur. - [Book a demo](/demo) - [Start your free trial](/app/signup) --- Source: https://mailosaur.com/industries/government # Enable flawless digital public services Test government portals, notifications systems, and two-way communication - taking the risk out of technology updates  - [Book a demo](/demo) - [Start your free trial](/app/signup) ## Trusted by organisations of all sizes ## In public service, reliable communication isn’t optional When a bill notice or benefit update doesn’t land right, trust takes a hit. Citizens rely on digital communications to manage everything from housing to healthcare. Mailosaur helps QA and DevOps, teams test end-to-end flows for public service communications, across both [email](/email-testing) and [SMS](/sms-testing). Stay compliant, improve accessibility, and deliver essential updates with total peace of mind. ## How have others used Mailosaur? ### Department for Education Dept for Education ensured secure, reliable 2FA testing and met UK data residency needs with Mailosaur’s robust infrastructure. [Find out more](/customers/the-department-for-education) ### November First November First chose Mailosaur to automate E2E email testing for their software development team. [Find out more](/customers/november-first) ### Coupa With Mailosaur, Coupa has found their ideal solution to capture and analyze emails automatically, and improving their email security. [Find out more](/customers/coupa) ## Ready to learn more? Get started with a demo or free 14-day trial With a free trial and easy integration, you're minutes away from seeing how Mailosaur could be the answer to your testing needs. - [Book a demo](/contact) - [Start your free trial](/app/signup) ## Consistent communication at a national scale Transcending generations and digital literacy levels, government communications need to be clear, concise, and accessible to all. Mailosaur allows you to [preview](/email-previews) your email content; not merely checking it for accuracy and broken links, but allowing your team to see what communications will look like across all devices. That way, there are no nasty surprises and everyone receives the same message. ## Maintain service quality at scale As governments digitise more services, the demand for secure, scalable testing grows. With Mailosaur, you can [automate testing](/automation) across regions, departments, and platforms, all while staying compliant and protecting sensitive data at every step. ## See how crucial emails render before you hit send From infrastructure updates to payment invoices and logon flows, your emails may 'work' as they should, but will they render properly for every user? Preview your emails across devices, email clients, and even light and dark modes and ensure a smooth journey for every customer. - [Learn more about previews](/email-previews) ## Don't just take our word for it... > Navigation is easy, the look and feel is great… it’s kind of glossy, it’s modern… supports dark mode. That’s a big plus for me. — Gabriel Peter-Thomas, Department for Education [Learn more](/customers/the-department-for-education) ## Security you can rely on With the highest standard of physical security and environmental controls, all of our systems are protected by up-to-date encryption protocols, cipher suites, and encrypted at rest using AES-256. Mailosaur is also ISO27001 certified, and PCI DSS compliant. - [Find out more](/security) ## Works with any stack Mailosaur provides official libraries and plugins for all major programming languages and test frameworks. - [Cypress](/cypress) - [Ghost Inspector](/ghost-inspector) - [Insomnia ](/docs/automation/insomnia) - [Playwright](/playwright) - [Postman](/postman) - [PowerShell](/docs/automation/powershell) - [Robot Framework](/robot-framework) - [TestCafe](/docs/automation/testcafe) - [WebdriverIO](/docs/automation/webdriverio) - [Selenium](/docs/automation/selenium) - [See our documentation](/docs) ## Our products ### Email Testing Create end-to-end tests that rely on email. Test account verification emails, password resets, email tracking, and more [Learn more](/email-testing) ### SMS Testing Build text messages that work. Create end-to-end tests that cover identity verification, alerting, promotional messages and more [Learn more](/sms-testing) ### Email Previews Instantly see how your email will look to any recipient, no matter what email client they use, so there are no nasty surprises [Learn more](/email-previews) ## Frequently asked questions ### Can I preview how emails look across different email clients and devices with Mailosaur? Yes, Mailosaur offers the ability to preview how your emails will look across specific devices, email clients, and even light and dark mode. This is especially beneficial when trying to account for [common rendering issues](/blog/fix-rendering) that happen on particular email clients or devices. More information on this can be found on our [Email Previews page.](/email-previews) ### Can I test both email and SMS with Mailosaur? Yes, Mailosaur is unique in its ability to test both [email](/email-testing) and [SMS.](/sms-testing) This means that you can test product messaging functionality end to end, for example if a flow requires you to go from an email, to then get an [OTP code](/mfa) through SMS, and then an email confirmation. This allows you the greatest visibility of your customer journey and to optimise both email and SMS communications. ### Is Mailosaur secure for testing sensitive and regulated workflows? Yes. Mailosaur is designed for testing sensitive workflows like account verification, password resets, payment alerts, and two-factor authentication notifications. You can test safely in development or staging, control data retention, and avoid using real customer data, making it suitable for teams with strict security or [compliance requirements](/blog/compliance-governance-security). ### Does Mailosaur offer custom plans for enterprises or high-volume teams? Yes, we will work with you to build a solution tailored to you and your team's needs, which may include things like access to phone numbers in any of our supported countries, extra seats, high volume SMS capabilities and hands-on onboarding along with support throughout. [Reach out to our team](/contact) in order to discuss the possibilities. ### What security certifications does Mailosaur have? Mailosaur is SOC 2 Type II attested, ISO 27001:2022 certified, PCI DSS compliant and GDPR compliant. To see how your data is used and protected, visit our ['Security and Trust'](/security) page. If your team needs more detail for a security review, like our SOC 2 report or a Security Assessment Pack, [reach out](/contact) to our friendly team. ### Can I try Mailosaur or speak to someone before committing to purchase? Yes. You can start with a [14‑day free trial](/app/signup) to explore Mailosaur on your own. If you’d prefer guidance, you can also [book a demo](/demo) to discuss your specific use case, whether that’s [marketing](/marketing) email [QA](//quality-assurance), automated transactional testing, or authentication workflows, before making a decision. ### Where can I find guides and documentation? Our [documentation pages](/docs) will show how quick and easy it is to integrate Mailosaur with your existing stack. There are specific guides for [popular test frameworks](/docs/automation) as well as for our [official API client libraries](/docs/automation). ## Ready to get started? Get in touch or create an account With a free 14 day trial and easy integration, it couldn't be easier to get started with Mailosaur. - [Book a demo](/demo) - [Start your free trial](/app/signup) --- Source: https://mailosaur.com/industries/healthcare # Quality messaging to match quality care Test critical communications from prescription alerts to insurance notices, and ensure customers receive the right message every time. - [Schedule free demo](/demo) - [Give it a go for free](/app/signup) ## Trusted by companies of all sizes ## Test the varying demands of every care journey ### Test without risk Simulate patient emails and texts using dedicated test accounts - no exposure of real data or patient identifiers. ### Trust they receive the message you intend Ensure appointment instructions, attachments and important links arrive correctly and don't go to spam. ### Preview messages across devices See how transactional emails like prescription confirmations [render across devices](/email-previews), as well as light and dark modes. ## Great communication is critical at the times we need it most Communication is critical in every healthcare journey. From reminders to secure links, each message matters. Mailosaur helps you test every transactional email and SMS - so patients get the right content, every time. We support [QA](/quality-assurance) and DevOps teams to catch issues before they reach patients, so nothing slips through the cracks and trust stays intact. ## What our Healthcare customers say > Dependable and easy to set up, for the past period where we've been using we haven't encountered a down period. — Djordje T., Director of Engineering Hospital & Health Care [Read more](https://www.capterra.com/p/201911/Mailosaur/#Capterra___4798488) > Easy email testing. Easy to use, makes a lot of our end-to-end testing easier — Andy S., Head of Applications, UK&I Hospital & Health Care [Read more](https://www.capterra.com/p/201911/Mailosaur/#Capterra___5049676 ) > Mailosaur is really easy to use and inexpensive but provides a lot of value. — Kashif M., QA Automation Engineer in Health, Wellness and Fitness [Read more](https://www.capterra.com/p/201911/Mailosaur/#Capterra___4796792 ) ## Ready to learn more? Get started with a free demo or 14-day trial With a free trial and easy integration, you're minutes away from seeing how Mailosaur could be the answer to your testing needs. - [Book a demo](/contact) - [Start your free trial](/app/signup) ## Prevent errors that compromise care Broken links, missing details, or misrouted SMS can disrupt treatment and destroy trust. Mailosaur helps you test all transactional messages before they reach real patients. ## What if they reply to 'CANCEL' an appointment? Mailosaur allows you to test everything your patients might do, for example [if they reply](/features/send-reply-forward) to cancel or change an appointment, or email or text outside of working hours. With the huge importance of patient care, you will be able to test that they have access to support even when you're out of office. ## See how crucial emails look before you hit send From test result notifications to appointment reminders and account setup flows, your emails may 'work' as they should, but will they render properly for every user? Preview your emails across devices, email clients, and even light and dark modes and ensure a smooth journey for every customer. - [Learn more about previews](/email-previews) ## What do Mailosaur customers have to say? > Getting started with Mailosaur was extremely easy. The interface was intuitive, and easy to learn and navigate, making the transition seamless for our team. — Rohit Sonak, Sr. Director of Quality Engineering at Malwarebytes [Learn more](/customers/malwarebytes) ## Secure and reliable testing With the highest standard of physical security and environmental controls, all of our systems are protected by up-to-date encryption protocols, cipher suites, and encrypted at rest using AES-256. Mailosaur is also ISO27001 certified, and PCI DSS compliant. - [Find out more about security](/security) ## Works with any stack Mailosaur provides official libraries and plugins for all major programming languages and test frameworks. - [Cypress](/cypress) - [Ghost Inspector](/ghost-inspector) - [Playwright](/playwright) - [Postman](/postman) - [PowerShell](/docs/automation/powershell) - [Robot Framework](/robot-framework) - [Selenium](/docs/automation/selenium) - [TestCafe](/docs/automation/testcafe) - [Insomnia ](/docs/automation/insomnia) - [WebdriverIO](/docs/automation/webdriverio) - [See our documentation](/docs) ## Our products ### Email Testing Create end-to-end tests that rely on email. Test account verification emails, password resets, email tracking, and more [Learn more](/email-testing) ### SMS Testing Build text messages that work. Create end-to-end tests that cover identity verification, alerting, promotional messages and more [Learn more](/sms-testing) ### Email Previews Instantly see how your email will look to any recipient, no matter what email client they use, so there are no nasty surprises [Learn more](/email-previews) ## Frequently asked questions ### Can I test both email and SMS with Mailosaur? Yes, Mailosaur is unique in its ability to test both [email](/email-testing) and [SMS.](/sms-testing) This means that you can test product messaging functionality end to end, for example if a flow requires you to go from an email, to then get an [OTP code](/mfa) through SMS, and then an email confirmation. This allows you the greatest visibility of your customer journey and to optimise both email and SMS communications. ### Is Mailosaur secure for testing sensitive and regulated workflows? Yes. Mailosaur is designed for testing sensitive workflows like account verification, password resets, payment alerts, and two-factor authentication notifications. You can test safely in development or staging, control data retention, and avoid using real customer data, making it suitable for teams with strict security or [compliance requirements](/blog/compliance-governance-security). ### Does Mailosaur offer custom plans for enterprises or high-volume teams? Yes, we will work with you to build a solution tailored to you and your team's needs, which may include things like access to phone numbers in any of our supported countries, extra seats, high volume SMS capabilities and hands-on onboarding along with support throughout. [Reach out to our team](/contact) in order to discuss the possibilities. ### Can I find out more about how other companies have used Mailosaur? Absolutely! We have a number of [customer stories](/customers) available on our website, ranging from startups to huge industry-leaders, with more added all the time. To start with, why not take a look at [Department for Education](/customers/the-department-for-education), [Domino's Pizza](/customers/dominos), or [OakNorth Bank](/customers/oaknorth). ### Can I try Mailosaur or speak to someone before committing to purchase? Yes. You can start with a [14‑day free trial](/app/signup) to explore Mailosaur on your own. If you’d prefer guidance, you can also [book a demo](/demo) to discuss your specific use case, whether that’s [marketing](/marketing) email [QA](//quality-assurance), automated transactional testing, or authentication workflows, before making a decision. ### Where can I find guides and documentation? Our [documentation pages](/docs) will show how quick and easy it is to integrate Mailosaur with your existing stack. There are specific guides for [popular test frameworks](/docs/automation) as well as for our [official API client libraries](/docs/automation). ## Ready to get started? Get in touch or create an account With a free 14 day trial and easy integration, it couldn't be easier to get started with Mailosaur. - [Book a demo](/demo) - [Start your free trial](/app/signup) --- Source: https://mailosaur.com/industries/retail # Retail-ready messaging, tested from end to end From shipping notifications to promotions, test your email and SMS messages across every touchpoint, and ensure a seamless customer journey. - [Book a demo](/demo) - [Start your free trial](/app/signup) ## Trusted by businesses of all sizes ## Deliver confidence, from cart to confirmation ### Automate the repetitive, validate the critical With Mailosaur, you can [automate tests](/automation) for your most important customer flows, like sign-in verifications, promo campaigns, and shipping notifications, without adding complexity. Whether you're launching a seasonal push or rolling out a new feature, automated testing ensures you can validate every message with speed, consistency, and confidence. ### Test both email and SMS, end-to-end Retail journeys span across both emails and SMS. Mailosaur gives you complete visibility into both, from delivery ETAs to order confirmations, allowing you to test not only that a message will send, but what it contains, how it'll look across devices, and whether the [links will work](/features/links-and-codes) as intended. ### Stay organised with inbox-level access Manage testing across multiple projects, teams, or store locations with unlimited email addresses, specifically dedicated for testing. Create new inboxes as you see fit, in order to keep your testing environment tidy, secure, and easy to audit. You can also go even further, giving tiered access to different team members so they only see what they need to. ## Testing matters in retail Every shopper expects a seamless experience. From flash sale reminders to shipping updates, your messaging can make or break a sale. If something goes wrong, support queues grow, carts are abandoned, and trust is lost. Mailosaur gives retail and ecommerce brands, [QA teams](/quality-assurance) the tools to simulate and verify their email and SMS flows under real-world conditions, so every message lands, loads, and converts. ## How have others used Mailosaur? ### Domino's Pizza Domino's software QA team used Mailosaur to scale their testing, particularly appreciating the ability to manage permissions and separate inboxes by team. [Find out more](/customers/dominos) ### OakNorth Engineers at OakNorth use Mailosaur to speed up their app release cycles, automating testing of both emails and SMS. [Find out more](/customers/oaknorth) ### P97 Product managers at P97 use Mailosaur to automate their email testing and drive exceptional user engagement. [Find out more](/customers/p97) ## Ready to learn more? Get started with a demo or free 14-day trial With a free trial and easy integration, you're minutes away from seeing how Mailosaur could be the answer to your testing needs. - [Book a demo](/contact) - [Start your free trial](/app/signup) ## Put yourself in your customers' shoes Your customers are all different, just like the devices they might use to access your messages. Whether they're using Apple or Android, Gmail or Outlook, with Mailosaur you can [preview your messages](/email-previews) across email clients and devices, as well as light and dark modes, and ensure that you provide a consistently good service across the board. ## Consistent communication for all customers A single typo in a discount code or broken link in a delivery alert can impact conversions and customer satisfaction. Mailosaur helps retail teams validate every message element before going live. From “your order is on the way” emails to product restock SMS notifications, taking the time to check all your flows ## See how crucial emails render before you hit send From delivery updates to purchase receipts and account setup flows, your emails may 'work' as they should, but will they render properly for every user? Preview your emails across devices, email clients, and even light and dark modes and ensure a smooth journey for every customer. - [Learn more about previews](/email-previews) ## Don't just take our word for it... > “Getting started with Mailosaur proved to be remarkably easy and convenient, paving the way for a seamless transition into a more automated and efficient testing framework.” — QA team at Domino's [Learn more](/customers/dominos) ## Security you can rely on With the highest standard of physical security and environmental controls, all of our systems are protected by up-to-date encryption protocols, cipher suites, and encrypted at rest using AES-256. Mailosaur is also ISO27001 certified, and PCI DSS compliant. - [Learn more about security](/security) ## Works with any stack Mailosaur provides official libraries and plugins for all major programming languages and test frameworks. - [WebdriverIO](/docs/automation/webdriverio) - [TestCafe](/docs/automation/testcafe) - [Selenium](/docs/automation/selenium) - [Ghost Inspector](/ghost-inspector) - [Cypress](/cypress) - [Insomnia ](/docs/automation/insomnia) - [Playwright](/playwright) - [Postman](/postman) - [Robot Framework](/robot-framework) - [PowerShell](/docs/automation/powershell) - [See our documentation](/docs) ## Learn more ### Email Testing Create end-to-end tests that rely on email. Test account verification emails, password resets, email tracking, and more [Learn more](/email-testing) ### SMS Testing Build text messages that work. Create end-to-end tests that cover identity verification, alerting, promotional messages and more [Learn more](/sms-testing) ### Email Previews Instantly see how your email will look to any recipient, no matter what email client they use, so there are no nasty surprises [Learn more](/email-previews) ## Frequently asked questions ### Does Mailosaur offer custom plans for enterprises or high-volume teams? Yes, we will work with you to build a solution tailored to you and your team's needs, which may include things like access to phone numbers in any of our supported countries, extra seats, high volume SMS capabilities and hands-on onboarding along with support throughout. [Reach out to our team](/contact) in order to discuss the possibilities. ### Can I test both email and SMS with Mailosaur? Yes, Mailosaur is unique in its ability to test both [email](/email-testing) and [SMS.](/sms-testing) This means that you can test product messaging functionality end to end, for example if a flow requires you to go from an email, to then get an [OTP code](/mfa) through SMS, and then an email confirmation. This allows you the greatest visibility of your customer journey and to optimise both email and SMS communications. ### Can I try Mailosaur or speak to someone before committing to purchase? Yes. You can start with a [14‑day free trial](/app/signup) to explore Mailosaur on your own. If you’d prefer guidance, you can also [book a demo](/demo) to discuss your specific use case, whether that’s [marketing](/marketing) email [QA](//quality-assurance), automated transactional testing, or authentication workflows, before making a decision. ### Can I find out more about how other companies have used Mailosaur? Absolutely! We have a number of [customer stories](/customers) available on our website, ranging from startups to huge industry-leaders, with more added all the time. To start with, why not take a look at [Department for Education](/customers/the-department-for-education), [Domino's Pizza](/customers/dominos), or [OakNorth Bank](/customers/oaknorth). ### What security certifications does Mailosaur have? Mailosaur is SOC 2 Type II attested, ISO 27001:2022 certified, PCI DSS compliant and GDPR compliant. To see how your data is used and protected, visit our ['Security and Trust'](/security) page. If your team needs more detail for a security review, like our SOC 2 report or a Security Assessment Pack, [reach out](/contact) to our friendly team. ## Ready to get started? Get in touch or create an account With a free 14 day trial and easy integration, it couldn't be easier to get started with Mailosaur. - [Book a demo](/demo) - [Start your free trial](/app/signup) --- Source: https://mailosaur.com/industries/travel # Catch booking issues before your users do Ensure flawless communication across the full journey, from booking confirmations and travel alerts to check-in reminders. - [Book a demo](/demo) - [Start your free trial](/app/signup) ## Trusted by businesses of all sizes ## Be prepared for all journeys ### Ensure messages work for customers on the move Whether you’re sending an [SMS update](/sms-testing) to a US phone, or a booking confirmation to a customer in Germany, consistency matters. Mailosaur gives you numbers from around the world and unlimited test email addresses, so you can test things just as your customers experience them. No hacks, no forwarding, no personal accounts. ### Trust the accuracy of your emails and SMS Missed updates, [broken links](/features/links-and-codes), or undelivered OTPs can ruin a whole trip. Whether it’s a change in itinerary or an emergency alert, during a trip the stakes are high. Mailosaur helps you test every SMS and email before they reach customers. From login flows and account verifications to last-minute flight updates or booking reminders, you’ll know everything works exactly as it should. ### Replicate real-world conversations A real customer's trip can take all sorts of tangents. They might book the wrong date by accident, or make a typo with luggage weight: what would happen if they replied to a transactional message to resolve this? Mailosaur allows you to test for every user journey, [two-way testing included](/features/send-reply-forward), so you can trust that you're prepared for every eventuality and customers aren't left guessing. ## Communication is the backbone of every booking Your customers travel for all sorts of reasons. Be it for a sunny holiday or family emergency, the last thing they need is to be guessing when it comes to where they should be, what to do when they arrive, and how to check in. 
Mailosaur helps travel platforms test the entire journey, from booking to check-in, across email and SMS. So your team can send confidently, fix fast, and ensure guests stay informed. ## How have other customers used Mailosaur? ### Department for Education Dept for Education ensured secure, reliable 2FA testing and met UK data residency needs with Mailosaur’s robust infrastructure and EU/UK-based storage options. [Find out more](/customers/the-department-for-education) ### UpBup UpBup saved time testing parent accounts and delivered a high-quality, custom-built platform with faster, smoother testing using Mailosaur. [Find out more](/customers/up-bup) ### Domino's Domino's Pizza streamlined QA workflows and increased test efficiency by integrating Mailosaur into their automation stack. [Find out more](/customers/dominos) ## Ready to learn more? Get started with a free demo or 14-day trial With a free trial and easy integration, you're minutes away from seeing how Mailosaur could be the answer to your testing needs. - [Book a demo](/contact) - [Start your free trial](/app/sign-up) ## Empower your team to test every unique booking journey Your guests don’t all use the same phone, or the same language, so why should your QA team? Mailosaur lets you [preview transactional emails](/email-previews) and SMS across devices, email clients, and light and dark modes. From boarding passes to regional promotions, ensure every message renders as intended. ## Automate more than you ever thought possible Not all workflows benefit from the repetitive nature of manual testing. 
 Mailosaur allows you to [automate](/automation) more than you ever thought you could, including both email and SMS, covering booking confirmations, itinerary changes, and even time-sensitive alerts like gate changes. ## See how crucial emails render before you hit send From journey updates to travel insurance invoices and account setup flows, your emails may 'work' as they should, but will they render properly for every user? Preview your emails across devices, email clients, and even light and dark modes and ensure a smooth journey for every customer. - [More about previews](/email-previews) ## Don't just take our word for it... > We would definitely recommend Mailosaur to other businesses looking to improve their email automations, mainly for its ease of use, and the speed at which you can adopt the platform into your automations through its API access. — QA team at Coupa [Learn more](/customers/coupa) ## Security you can rely on With the highest standard of physical security and environmental controls, all of our systems are protected by up-to-date encryption protocols, cipher suites, and encrypted at rest using AES-256. Mailosaur is also ISO27001 certified, and PCI DSS compliant. - [Find out more about security](/security) ## Works with any stack Mailosaur provides official libraries and plugins for all major programming languages and test frameworks. - [Cypress](/cypress) - [Ghost Inspector](/ghost-inspector) - [Insomnia ](/docs/automation/insomnia) - [Playwright](/playwright) - [PowerShell](/docs/automation/powershell) - [WebdriverIO](/docs/automation/webdriverio) - [Selenium](/docs/automation/selenium) - [TestCafe](/docs/automation/testcafe) - [Robot Framework](/robot-framework) - [Postman](/postman) - [See our documentation](/docs) ## Our products ### Email Testing Create end-to-end tests that rely on email. Test account verification emails, password resets, email tracking, and more [Learn more](/email-testing) ### SMS Testing Build text messages that work. Create end-to-end tests that cover identity verification, alerting, promotional messages and more [Learn more](/sms-testing) ### Email Previews Instantly see how your email will look to any recipient, no matter what email client they use, so there are no nasty surprises [Learn more](/email-previews) ## Frequently asked questions ### Can I test both email and SMS with Mailosaur? Yes, Mailosaur is unique in its ability to test both [email](/email-testing) and [SMS.](/sms-testing) This means that you can test product messaging functionality end to end, for example if a flow requires you to go from an email, to then get an [OTP code](/mfa) through SMS, and then an email confirmation. This allows you the greatest visibility of your customer journey and to optimise both email and SMS communications. ### Is Mailosaur secure for testing sensitive and regulated workflows? Yes. Mailosaur is designed for testing sensitive workflows like account verification, password resets, payment alerts, and two-factor authentication notifications. You can test safely in development or staging, control data retention, and avoid using real customer data, making it suitable for teams with strict security or [compliance requirements](/blog/compliance-governance-security). ### Does Mailosaur offer custom plans for enterprises or high-volume teams? Yes, we will work with you to build a solution tailored to you and your team's needs, which may include things like access to phone numbers in any of our supported countries, extra seats, high volume SMS capabilities and hands-on onboarding along with support throughout. [Reach out to our team](/contact) in order to discuss the possibilities. ### What security certifications does Mailosaur have? Mailosaur is SOC 2 Type II attested, ISO 27001:2022 certified, PCI DSS compliant and GDPR compliant. To see how your data is used and protected, visit our ['Security and Trust'](/security) page. If your team needs more detail for a security review, like our SOC 2 report or a Security Assessment Pack, [reach out](/contact) to our friendly team. ### Can I try Mailosaur or speak to someone before committing to purchase? Yes. You can start with a [14‑day free trial](/app/signup) to explore Mailosaur on your own. If you’d prefer guidance, you can also [book a demo](/demo) to discuss your specific use case, whether that’s [marketing](/marketing) email [QA](//quality-assurance), automated transactional testing, or authentication workflows, before making a decision. ### Where can I find guides and documentation? Our [documentation pages](/docs) will show how quick and easy it is to integrate Mailosaur with your existing stack. There are specific guides for [popular test frameworks](/docs/automation) as well as for our [official API client libraries](/docs/automation). ## Ready to get started? Get in touch or create an account Book a demo or start your 14 day free trial and see what all the fuss is about. - [Book a demo](/demo) - [Start your free trial](/app/signup) --- Source: https://mailosaur.com/industries/utilities # Power smooth connections with every message Whether it’s a late payment notice or a service interruption alert, ensure every message lands, renders, and functions as expected. - [Book a demo](/demo) - [Start your free trial](/app/signup) ## Trusted by companies of all sizes ## Test every message your customers count on ### Prevent critical messaging errors Ensure links work and important messages aren’t sent incomplete or to the wrong user. Catch formatting issues, broken calls to action, or delays in delivery across billing alerts, contract notices, and service updates - before they cause confusion or complaints. ### Test at scale, with real-world accuracy From 2FA login flows to payment confirmations and works notifications, Mailosaur lets you test securely using isolated inboxes. Manage permissions, with inbox access split by project, team, or colleague, and create organised and logical structures for testing. ### Take control of your testing Empower your team to test for every user action, with unlimited email addresses, and international virtual phone numbers (with no time-consuming manual setup required). Use unique email/SMS addresses to [mimic any customer scenario](/features/send-reply-forward), from replying to an alert to updating details, or accessing their account. ## Trust is built one message at a time Utilities power everyday life - so every message matters. From bill notifications to outage alerts and security codes, there’s no room for error. Mailosaur helps energy providers test every email and SMS that keeps customers informed. Simulate real scenarios, spot issues before go-live, and ensure communications are accurate, timely, and reflect your service at its best. ## How have other customers used Mailosaur? ### AWeber QAs at AWeber use Mailosaur to programmatically send, retrieve, and check email, without affecting their sending reputation. [Find out more](/customers/aweber) ### P97 Product managers at P97 use Mailosaur to automate their email testing and drive exceptional user engagement. [Find out more](/customers/p97) ### Cold Banana With Mailosaur, Cold Banana automates test flows to reduce manual work and human error. [Find out more](/customers/cold-banana) ## Ready to learn more? Get started with a free demo or 14-day trial With a free trial and easy integration, you're minutes away from seeing how Mailosaur could be the answer to your testing needs. - [Book a demo](/contact) - [Start your free trial](/app/signup) ## Automate high-stakes testing at scale Manually testing the same flows, like meter alerts or bill reminders, can slow teams down. Mailosaur integrates with your CI/CD pipeline, so you can [automate](/automation) high-volume testing for login prompts, service notices, and outage updates without compromising on accuracy or compliance. Scale confidently and keep communications reliable for every customer. ## Consistent communication for all customers Emails about meter readings or service disruptions must be accessible, easy to comprehend, and contain appropriate further information and links. Mailosaur’s [email preview tool](/email-previews) helps you test how these messages render across different email clients and devices, so vital information doesn’t get buried, distorted, or missed entirely, and you offer a consistent service customers can depend on. ## See how crucial emails render before you hit send From repair updates to payment invoices and account setup flows, your emails may 'work' as they should, but will they render properly for every user? Preview your emails across devices, email clients, and even light and dark modes and ensure a smooth journey for every customer. - [Learn more about previews](/email-previews) ## Don't just take our word for it... > The ease of Mailosaur’s API access really made them stand out from the competition and helped us to accelerate the adoption of the platform across the company. Our team has needed little to no training as Mailosaur is a simple platform to work with — QA team at Coupa [Learn more](/customers/coupa) ## Security you can rely on With the highest standard of physical security and environmental controls, all of our systems are protected by up-to-date encryption protocols, cipher suites, and encrypted at rest using AES-256. Mailosaur is also ISO27001 certified, and PCI DSS compliant. - [Find out more about security](/security) ## Works with any stack Mailosaur provides official libraries and plugins for all major programming languages and test frameworks. - [Cypress](/cypress) - [Ghost Inspector](/ghost-inspector) - [Insomnia ](/docs/automation/insomnia) - [Playwright](/playwright) - [Postman](/postman) - [PowerShell](/docs/automation/powershell) - [WebdriverIO](/docs/automation/webdriverio) - [TestCafe](/docs/automation/testcafe) - [Selenium](/docs/automation/selenium) - [Robot Framework](/robot-framework) - [See our documentation](/docs) ## Our products ### Email Testing Create end-to-end tests that rely on email. Test account verification emails, password resets, email tracking, and more [Learn more](/email-testing) ### SMS Testing Build text messages that work. Create end-to-end tests that cover identity verification, alerting, promotional messages and more [Learn more](/sms-testing) ### Email Previews Instantly see how your email will look to any recipient, no matter what email client they use, so there are no nasty surprises [Learn more](/email-previews) ## Frequently asked questions ### Where can I find guides and documentation? Our [documentation pages](/docs) will show how quick and easy it is to integrate Mailosaur with your existing stack. There are specific guides for [popular test frameworks](/docs/automation) as well as for our [official API client libraries](/docs/automation). ### Does Mailosaur offer custom plans for enterprises or high-volume teams? Yes, we will work with you to build a solution tailored to you and your team's needs, which may include things like access to phone numbers in any of our supported countries, extra seats, high volume SMS capabilities and hands-on onboarding along with support throughout. [Reach out to our team](/contact) in order to discuss the possibilities. ### Is Mailosaur secure for testing sensitive and regulated workflows? Yes. Mailosaur is designed for testing sensitive workflows like account verification, password resets, payment alerts, and two-factor authentication notifications. You can test safely in development or staging, control data retention, and avoid using real customer data, making it suitable for teams with strict security or [compliance requirements](/blog/compliance-governance-security). ### Can I test both email and SMS with Mailosaur? Yes, Mailosaur is unique in its ability to test both [email](/email-testing) and [SMS.](/sms-testing) This means that you can test product messaging functionality end to end, for example if a flow requires you to go from an email, to then get an [OTP code](/mfa) through SMS, and then an email confirmation. This allows you the greatest visibility of your customer journey and to optimise both email and SMS communications. ## Time to take the plunge? Get in touch or create an account Book a demo with our friendly team, or start your free 14 day trial. - [Book a demo](/demo) - [Start your free trial](/app/signup) --- Source: https://mailosaur.com/customers/aweber # AWeber QAs at AWeber use Mailosaur to programmatically send, retrieve, and check email, without affecting their sending reputation. - **Location:** Pennsylvania, United States - **Industry:** Software & technology ## Problem AWeber’s QA team needed to automate email testing and guarantee a top-tier experience for their clients. ## Solution Using Mailosaur, AWeber’s QA team were able to get up and running fast, building out a test framework that separates email sending and retrieval for optimal results. ## The challenge AWeber’s QA team needed to automate email testing and guarantee a top-tier experience for their clients. As an email marketing platform with high daily activity, they needed a tool that could help: * Build out their test framework * Continually test the structure and composition of emails * Run automated tests for human-to-machine interfaces * Access all parts of the SMTP message > If you need a secure tool with a clean API to test emails you send, Mailosaur gives you everything you need for a low monthly price. ## Results Using Mailosaur, AWeber’s QA team were able to get up and running fast, building out a test framework that separates email sending and retrieval for optimal results. We completely leaned on Mailosaur to handle all email. > We want to ensure that our customers have a fabulous experience when they use AWeber's product. Email composition affects deliverability, and incorrect composition can land customer mail in the spam folder or worse. ## About AWeber AWeber is an email marketing platform that allows 100,000+ small businesses and entrepreneurs to create and send emails people love. AWeber simplifies email marketing, helping clients automate their emails and campaigns for industry-leading email deliverability. > We have caught bugs in staging that never reached the customer 🎉 ### Sending Use an email for every test run, project, team member, or idea you have. Our fake [SMTP servers ](/email-testing)have their own email address patterns! ### Testing Quickly identify potential issues and increase the chance of an email getting through. Never end up in your customer's spam folder! ### Optimizations Catch [broken links, images, and attachments](/features/links-and-codes). Check your subject line and HTML for errors and improvements. ### See how Mailosaur has helped other companies transform their quality assurance: * [OakNorth](/customers/oaknorth) * [Domino's Pizza](/customers/dominos) * [Coupa](/customers/coupa) * [The Department for Education](/customers/the-department-for-education) --- Source: https://mailosaur.com/customers/cold-banana # Cold Banana With Mailosaur, Cold Banana automates test flows to reduce manual work and human error. - **Location:** Bournemouth, UK - **Industry:** Software & technology ## Problem With the majority of Cold Banana’s user flows based around accounts, the QA team needed a way to test without signing up with unique emails. ## Solution Since working with Mailosaur, Cold Banana’s QA team can now automate test flows, run advanced tests on each deployment, and automatically generate new emails on demand. ## The challenge With the majority of Cold Banana’s user flows based around accounts, the QA team needed a way to test without signing up with unique emails. Manual signups can be time-consuming and error-prone; the team was keen to find a solution that could automate their workload and drive more advanced testing capabilities. > Mailosaur has perfected its service - it was exactly what we needed. And with unbeatable pricing it was a no brainer for us ## Results Since working with Mailosaur, Cold Banana’s QA team can now automate test flows, run advanced tests on each deployment, and automatically generate new emails on demand. "How this impacted the team:" * Automated test flows help [QAs](/quality-assurance) save valuable time each week * QAs can now run advanced tests on each deployment * Reduced manual errors * Improved team efficiency and productivity > Mailosaur is a critical part of our test infrastructure, and there's no doubt others will find the service's capabilities useful too. ## About Cold Banana Cold Banana is a .NET specialist web development agency that produces secure and robust platforms on a .NET framework, supported by CMS partners Umbraco, Kentico, Sitecore, Xamarin, and Ucommerce. Cold Banana helps global clients maintain and build out new e-commerce platforms, booking platforms, brochure sites, and mobile apps. ### See how Mailosaur has helped other companies transform their quality assurance: * [OakNorth](/customers/oaknorth) * [AWeber](/customers/aweber) * [Coupa](/customers/coupa) * [The Department for Education](/customers/the-department-for-education) --- Source: https://mailosaur.com/customers/coupa # Coupa With Mailosaur, Coupa has found their ideal solution to capture and analyze emails automatically, and improving their email security. - **Location:** California, United States - **Industry:** Software & technology ## Problem Coupa were facing several challenges before they started with Mailosaur and were looking for a solution to intercept emails so they could capture and analyze all their emails automatically. ## Solution The ease of Mailosaur’s API access really made them stand out from the competition and helped us to accelerate the adoption of the platform across the company. Coupa is the cloud-based Business Spend Management (BSM) platform that unifies processes across supply chain, procurement, and finance functions. Coupa empowers organizations around the world to maximize value and operationalize purpose through their business spend. We spoke to a member of their team to find out more about their experiences with Mailosaur and how we have helped them to improve customer security and increase productivity. Coupa were facing several challenges before they started with Mailosaur and were looking for a solution to intercept emails so they could capture and analyze all their emails automatically; helping to increase productivity as well as improve their email security. > We were originally using both the office and personal email for running our email automations. This created several issues for us in the management of our outbound emails, mostly significantly it was causing an issue with our email spam score. After a brief Google search and some research Coupa found what looked like a perfect solution in Mailosaur. > The ease of Mailosaur’s [API](/email-testing) access really made them stand out from the competition and helped us to accelerate the adoption of the platform across the company. Our team has needed little to no training as Mailosaur is a simple platform to work with, and this has also helped to accelerate the onboarding of new team members with ease. When looking at some of the additional benefits Mailosaur has brought to the team, Coupa highlights “The ability to configure several servers and the ability to search the given emails is a really appealing feature.” Coupa have been working with Mailosaur for the last 4 years, and over that time have seen improvements in their deliverability, increased productivity with their email testing automation. > We would definitely recommend Mailosaur to other businesses looking to improve their email automations, mainly for its ease of use, and the speed at which you can adopt the platform into your automations through its API access. ### See how Mailosaur has helped other companies transform their quality assurance: * [OakNorth](/customers/oaknorth) * [AWeber](/customers/aweber) * [NovemberFirst](/customers/november-first) * [The Department for Education](/customers/the-department-for-education) --- Source: https://mailosaur.com/customers/dominos # Domino's Pizza Explore how Domino's Pizza optimized their testing processes by integrating Mailosaur, a game-changing tool that enhanced efficiency in their email and SMS testing. - **Location:** UK - **Industry:** Food & drink ## Problem Domino’s Pizza needed a scalable solution to test email and SMS communications across their platform. Their previous setup with manual workarounds hampered test coverage, slowed delivery cycles, and made scaling test automation difficult. ## Solution Mailosaur provided Domino’s an all-in-one email and SMS testing suite, enabling automation across teams and systems. Flexible inbox architecture meant QAs could create dedicated inboxes for specific teams/ projects, avoiding conflicts and improving visibility. ## Key results * Significant increase in testing coverage across email and SMS * Improved test reliability with long-term message retention * Streamlined QA workflows using automation and API-first design * Multiple inboxes enabled cleaner team and project segregation * Faster test cycles with reduced manual setup * Scalable solution adopted across evergreen projects ## Domino’s challenges Before switching to Mailosaur, the Domino’s QA team faced several bottlenecks: * Manual creation of disposable email accounts was inefficient and error-prone * SMS testing lacked centralization, making it hard to monitor and validate reliably * Scaling tests across multiple teams led to inbox conflicts and reduced visibility * Existing tools offered limited automation support and sluggish onboarding * Domino’s needed a robust, developer-friendly tool that could help them automate faster without compromising quality, all while giving them better inbox control across the company ## Why Mailosaur? Mailosaur made an immediate impact, streamlining how Domino’s managed message testing across both email and SMS channels. With automation-ready APIs and an intuitive inbox model, the team quickly saw productivity gains and reduced friction across test cycles. > “Getting started with Mailosaur proved to be remarkably easy and convenient, paving the way for a seamless transition into a more automated and efficient testing framework.” The long-term storage of messages was also a big win - ensuring test environments could reference messages as needed without worrying about expiry or loss of test data. ## The outcome * Fully automated testing at scale - email and SMS testing is now automated and reusable, with faster iterations and fewer false positives. * Improved cross-team coordination - dedicated inboxes for different teams removed conflicts and enabled smoother collaboration. * Confidence in Evergreen Projects - Mailosaur now underpins validation across long-term product lines and feature branches. * Minimal setup, maximum impact - with fast onboarding and great documentation, the transition to Mailosaur required minimal overhead. ### See how Mailosaur has helped other companies transform their quality assurance: * [OakNorth](/customers/oaknorth) * [AWeber](/customers/aweber) * [Coupa](/customers/coupa) * [The Department for Education](/customers/the-department-for-education) --- Source: https://mailosaur.com/customers/malwarebytes # Malwarebytes Providing them with the essential tools to automate and perform high volumes of email testing daily. - **Location:** California, United States - **Industry:** Software & technology ## Problem The team had no means to generate test email addresses and needed to view different types of emails. The necessity to test multiple product emails with different email needs for each made their situation even more complex. ## Solution We can now test our emails before they go into production in a QA environment, ensuring that our emails are sent out correctly. Mailosaur has become an indispensable tool in our daily operations, used extensively by our Development and QA teams. Malwarebytes provides industry-leading endpoint protection, privacy, and threat prevention solutions. They have a team of expert threat researchers and protect millions of individuals and thousands of businesses worldwide daily. They operate out of California, with offices in Europe and Asia. Before Malwarebytes discovered Mailosaur, they were dealing with substantial email testing challenges. Their team had no means to generate test email addresses and needed to view different types of emails. The necessity to test multiple product emails with different email needs for each made their situation even more complex. They found their productivity being slowed down working around the same challenges. They really needed to find a new solution. This led them to a search for [email testing tools](/email-testing) and were introduced to Mailosaur through a simple web search. We spoke to Rohit Sonak Sr. Director, Quality Engineering at Malwarebytes and he said: > “Mailosaur stood out from the crowd because it offered everything we were looking for. We required a solution that could provide multiple servers, allow us to generate test email addresses, and support extensive email testing. Additionally, the ability to automate and perform high volumes of email testing daily was critical to our operations”. The features and bundle pricing of Mailosaur appealed to Malwarebytes immensely. Its comprehensive Email Testing capabilities, generous usage limits, flexible server options, and API integration made it the obvious choice above other options they researched. The API integration feature was particularly appealing as it was essential to their operational needs, and the test email limit usage allowed them to conduct thorough testing without constraints. > “Getting started with Mailosaur was extremely easy. The interface was intuitive, easy to learn and navigate, making the transition seamless for our team.” Mailosaur has been a great fit for testing Malwarebytes product functionality. It is now not just a tool; it is an integral part of their daily operations that boosts their productivity and efficiency. They have reported improved productivity, especially among their engineering teams. > “Using Mailosaur has significantly boosted our confidence in development and testing. We can now test our emails before they go into production in a QA environment, ensuring that our emails are sent out correctly. Mailosaur has become an indispensable tool in our daily operations, used extensively by our Development and QA teams.” > “One of the most positive experiences we've had with Mailosaur was during the launch of a new email template design. With Mailosaur, we were able to quickly check how the new design looked, making the implementation process so simple.” The ease of the end-to-end experience with Mailosaur, particularly with [Email Testing](/email-testing) and viewing how email templates would look in a live environment, certainly impressed the team at Malwarebytes. > “The single biggest reason we would recommend Mailosaur to others, would be for its overall ease of use and comprehensive features. The ability to experience the end-to-end product and see how emails would appear in a live environment makes Mailosaur an invaluable tool for any company facing similar email testing challenges. With Mailosaur, you can improve productivity, streamline your operations, and ensure the successful delivery of your emails.” ### See how Mailosaur has helped other companies transform their quality assurance: * [OakNorth](/customers/oaknorth) * [AWeber](/customers/aweber) * [Coupa](/customers/coupa) * [The Department for Education](/customers/the-department-for-education) --- Source: https://mailosaur.com/customers/november-first # November First After trying out various mail services, November First chose Mailosaur to automate E2E email testing for their software development team. - **Location:** Copenhagen - **Industry:** Financial services ## Problem The company’s software development team needed a way to automate their end-to-end email testing and generate, query, and obtain emails by connecting to an API. ## Solution With Mailosaur, November First have fully automated their end-to-end email testing. ## The challenge The company’s software development team needed a way to automate their end-to-end email testing and generate, query, and obtain emails by connecting to an API. After trying out various different mail services, they quickly found that Mailosaur gave the best API endpoints for accessing the emails in-server. > Mailosaur is the solution for any automated QA. It’s a simple and powerful tool that helps mock email responses, with great documentation that makes it easy to start. ## Results With Mailosaur, November First have fully automated their end-to-end email testing. The team has included email responses in their E2E testing, which means they can now test that all [emails](/email-testing) generated during onboarding have valid URLs and attributes, guaranteeing an exceptional user experience and increased email deliverability. > Easy to setup, easy to obtain emails. ## About November First November First is an international payment platform that provides advantageous rates across all international payments. Their users have access to lower exchange rates, lower fees, personalised support, and ERP integrations to help manage their international payments safely and efficiently. ### See how Mailosaur has helped other companies transform their quality assurance: * [OakNorth](/customers/oaknorth) * [AWeber](/customers/aweber) * [Coupa](/customers/coupa) * [The Department for Education](/customers/the-department-for-education) --- Source: https://mailosaur.com/customers/oaknorth # OakNorth Where reliable communication channels are pivotal for account authentication and transaction alerts, driving the imperative need for robust testing solutions. - **Location:** London, UK - **Industry:** Financial services ## Problem Problems included testing email and SMS communications effectively within their app dev cycle (including secure/ prompt delivery of OTPs), and the need to provide specific access to inboxes for different team members. ## Solution Mailosaur allowed comprehensive end-to-end testing of transactional email and SMS, including OTPs, and granted different levels of access to different teams, allowing them to dedicate inboxes for specific tests and projects. ## Key results * **2x faster app release cycle** * **Fully automated testing pipeline for message delivery** * **Easy OTP sharing for secure app store testing** * **Greater trust in app stability and security** > We highly recommend Mailosaur to any QA and development team seeking to optimise their testing processes for email and SMS functionalities. ## OakNorth's Challenges * OakNorth had challenges with testing email and SMS communications effectively within their 'React Native' app development cycle. Testing the secure and prompt delivery of messages, particularly one-time passcode (OTPs) for user authentication, posed a significant challenge. * OakNorth also wanted to provide members of their team access to an inbox for receiving SMS messages, which they would be able to use for work activities, including using Mailosaur to provide app reviewers at Apple and Google a secure way to log into a real financial account so that they can test that all parts of the app pass the review process. ## Why Mailosaur OakNorth quickly integrated Mailosaur into their testing workflows. The platform allowed the team to automate both [email](/email-testing) and [SMS testing](/sms-testing), enabling smooth end-to-end validation of OTP flows. Review teams were also given secure inbox access, accelerating app submissions. > Mailosaur's developer-friendly API seamlessly integrated with OakNorth's existing testing frameworks, facilitating efficient automation for our testing processes. ## The Outcome * **Improved Testing Coverage**: Enabled automated testing for email and SMS messages. * **Faster App Reviews**: OTPs were reliably accessible to Apple and Google reviewers. * **Increased Developer Efficiency**: Reduced time spent managing and debugging message delivery. * **Enhanced Product Confidence**: More stable releases and fewer bugs in production. > This has also expedited app store submissions by ensuring reviewers can access OTPs without issues, helping us maintain a competitive edge Luke Elliot, Director of Engineering OakNorth ### See how Mailosaur has helped other companies transform their quality assurance: * [NovemberFirst](/customers/november-first) * [Coupa ](/customers/coupa) * [Domino's Pizza](/customers/dominos) * [The Department for Education](/customers/the-department-for-education) --- Source: https://mailosaur.com/customers/p97 # P97 Product managers at P97 use Mailosaur to automate their email testing and drive exceptional user engagement. - **Location:** Texas, United States - **Industry:** Telecommunications ## Problem - Reliably create and test new emails, body, and subject lines - Efficiently automate test cases that require the verification of expected values in emails. - Automate API testing for new Azure B2C users ## Solution Using Mailosaur, P97 were able to build out their automation testing framework to support their ‘innovation-first’ approach and drive exceptional user experience, all for one small monthly fee. ## The challenge The team was looking for a reliable solution with ongoing support to help guide their email testing efforts. With a large focus on business innovation and user experience, P97’s product management team needed to: * Reliably create and test new [emails](/email-testing), body, and subject lines * Efficiently automate test cases that require the verification of expected values in emails. * Automate API testing for new Azure B2C users > Mailosaur provides APIs that efficiently create new email addresses. The reliability is outstanding! ## Results Using Mailosaur, P97 were able to build out their automation testing framework to support their ‘innovation-first’ approach and drive exceptional user experience, all for one small monthly fee. > The support Mailosaur offered was better than free solutions. The price you pay will give more value than trying to maintenance automation tests that use "free" email services. ## About P97 P97 is an award-winning mobile commerce and digital marketing platform that helps users accept mobile payments and deliver targeted digital offers. The P97 approach prioritises convenience, consumer engagement, and data-rich insights, helping retail and fuelling companies target the right customers at the right time. ### See how Mailosaur has helped other companies transform their quality assurance: * [OakNorth](/customers/oaknorth) * [AWeber](/customers/aweber) * [Coupa](/customers/coupa) * [The Department for Education](/customers/the-department-for-education) --- Source: https://mailosaur.com/customers/the-department-for-education # The Department for Education They needed an end-to-end solution for testing notifications, specifically requiring a method to test with two-factor authentication (2FA). - **Location:** UK - **Industry:** Education ## Problem The Department for Education (DfE) needed a secure, compliant, and scalable way to test email and SMS communications end-to-end, especially one with UK-based servers. Their existing setup relied on a patchwork of open-source tools and temporary fixes. ## Solution With a wealth of features, and UK-based data storage, Mailosaur addressed both security and technical gaps for DfE. Mailosaur's robust testing capabilities allowed staff to test 2FA flows, as well as how emails looked across devices and more. ## Key results * **Estimated 120% increase in email testing volume** * **Smooth automation setup** * **Increased confidence in 2FA workflows** * **Enhanced UX/ UI validation** * **Proactive cross-team adoption** > Mailosaur has an extremely easy to use and understand user interface. ## Department for Education challenges Prior to Mailosaur, DfE relied on a combination of Mailinator and manual testing methods. This setup posed multiple problems including: * Compliance concerns around where data would be stored * Limited testing support for 2-factor authentication, with workflows requiring messy workarounds and compromises * Time-consuming manual QA that involved digging through Gov Notify logs to verify message delivery * Low test coverage due to technical constraints With frequent activity across their service lines and growing pressure on the QA team, they needed a solution that simplified workflows, enabled better test visibility, and met their internal compliance standards. ## Why Mailosaur Mailosaur met DfE's most pressing need with its UK-based data storage, easing security concerns, while its intuitive dashboard layout made their previous patchwork testing fixes redundant. Beyond this, however, DfE appreciated the intuitive UI of Mailosaur. > Navigation is easy, the look and feel is great... it's kind of glossy, it's modern... supports dark mode. That's a big plus for me. There were also unexpected benefits, like the potential to trigger automated workflows from inbound messages, or leveraging the previews feature which has further expanded its value across departments. > If we couldn’t use Mailosaur anymore, it’d be a serious disruption. I’d only hope the replacement looks and works half as well. ## The outcome * Security concerns quelled by Mailosaur's extensive security precautions and UK-based storage * Huge uptick in testing volume, including automation, with further plans to expand use across teams and departments * Reduced manual debugging, as this was originally needed due to over-complex log diving * Increased confidence in 2FA workflows with virtual multi-device simulations > Every tester’s got their own personal manual server. We’ve got our automation server, we’ve got a server for local automation runs… life’s good in automation Peter Gabriel-Tomas, Department for Education ### See how Mailosaur has helped other companies transform their quality assurance: * [November First](/customers/november-first) * [Coupa ](/customers/coupa) * [Domino's Pizza](/customers/dominos) * [OakNorth](/customers/oaknorth) --- Source: https://mailosaur.com/customers/up-bup # UpBup Using Mailosaur, UpBup tailors communications to each family’s unique structure, ensuring a safer and more convenient childcare experience. - **Location:** Massachusetts, United States - **Industry:** Software & technology ## Problem As a startup with limited resources, the UpBup team needed to maximise the breadth of their testing capability, delivering emails that cater to every kind of family setup. ## Solution Since implementing Mailosaur, the team has been able to rapidly set up demo scenarios that demonstrate the full power of UpBup, showcasing their unique way of supporting modern-day families. ## The challenge As a startup with limited resources, the UpBup team needed to maximise the breadth of their testing capability, delivering emails that cater to every kind of family setup (single parent, parents with children from different marriages and relationships, parents with twins, etc). The team was looking for a high-quality solution to help them serve all kinds of families and childcare providers, producing communications that are highly personal and tailored to each familial structure. > Mailosaur quickly became an essential component of not only our quality assurance process but also a key tool in our sales demonstrations ## Results Since implementing Mailosaur, the team has been able to rapidly set up demo scenarios that demonstrate the full power of UpBup, showcasing their unique way of supporting modern-day families. UpBup uses Mailosaur to: * Save time testing parent accounts * Build out a high-quality, customised solution * Deliver communications that drive loyalty and trust > Having access to a single Mailosaur mailbox with all our parent test accounts saves a tremendous amount of time and enables us to build a quality solution that serves all families and childcare providers. ## About UpBup UpBup is an innovative cloud-based platform that enables childcare providers to carry out enrolment electronically, using signed childcare forms. With UpBup, childcare providers can carry out the form request, monitoring, and management process securely and remotely, to help ensure child safety while supporting parents and childcare providers. ### See how Mailosaur has helped other companies transform their quality assurance: * [OakNorth](/customers/oaknorth) * [AWeber](/customers/aweber) * [Coupa](/customers/coupa) * [The Department for Education](/customers/the-department-for-education) --- Source: https://mailosaur.com/customers # Customer stories Hear from QAs and Developers from businesses both large and small. Learn how they are using Mailosaur to build & Test software ### [OakNorth](/customers/oaknorth) Where reliable communication channels are pivotal for account authentication and transaction alerts, driving the imperative need for robust testing solutions. ### [The Department for Education](/customers/the-department-for-education) They needed an end-to-end solution for testing notifications, specifically requiring a method to test with two-factor authentication (2FA). ### [Cold Banana](/customers/cold-banana) With Mailosaur, Cold Banana automates test flows to reduce manual work and human error. ### [P97](/customers/p97) Product managers at P97 use Mailosaur to automate their email testing and drive exceptional user engagement. ### [November First](/customers/november-first) After trying out various mail services, November First chose Mailosaur to automate E2E email testing for their software development team. ### [Malwarebytes](/customers/malwarebytes) Providing them with the essential tools to automate and perform high volumes of email testing daily. - [Page 2](/customers/page/2) --- Source: https://mailosaur.com/legal/cookies # Cookie Notice **Effective: 6th March 2026** ## Use of cookies by Mailosaur Cookies are small text files that websites place on your computer or device. They are widely used to make websites work, improve performance, and provide information to site owners. This page explains the cookies we use on mailosaur.com and why. ## Essential cookies These cookies are necessary for core functionality, such as security, payment processing, and cookie consent management. They are always active. | Example cookies | Purpose | Expires | | ---------------------- | ----------------------------------------------------------------------------------------------- | ---------- | | `__hs_cookie_cat_pref` | Remembers your cookie consent preferences | 6 months | | `__stripe_mid` | Stripe fraud prevention — identifies your browser across visits to protect payment transactions | 1 year | | `__stripe_sid` | Stripe fraud prevention — identifies your browser session to protect payment transactions | 30 minutes | | `__cf_bm` | Cloudflare bot management — distinguishes humans from bots to protect the site | 30 minutes | | `_cfuvid` | Cloudflare — helps manage traffic without identifying individual visitors | Session | ## Analytics cookies (optional) We use analytics services to understand how you find and use our site. We use this information to improve our website and your experience. These cookies are only set when you accept analytics cookies via our cookie banner. | Example cookies | Purpose | Expires | | --------------- | ------------------------------------------------------------------------------------------------------------------------------- | ---------- | | `_ga`, `_ga_*` | Google Analytics — assigns a unique visitor ID to understand how people find and use the site | 2 years | | `__hstc` | HubSpot — tracks visitors across sessions so we can understand how people find and use the site | 6 months | | `__hssc` | HubSpot — tracks the current session (pages visited, duration) | 30 minutes | | `__hssrc` | HubSpot — detects whether you have started a new browser session | Session | | `_clck` | Microsoft Clarity — assigns a unique visitor ID to understand how people interact with the site (clicks, scrolling, navigation) | 1 year | ## Video player cookies (optional) Some pages of our website include videos embedded from YouTube. We use YouTube's privacy-enhanced mode, which means YouTube does not store information about you or set cookies unless you play a video. If you are signed in to a Google or YouTube account, Google may link your viewing data to your account. For more information, see the [Google Privacy Policy](https://policies.google.com/privacy). ### YouTube embedded player | Example cookies | Purpose | Expires | | ---------------------------------------------------- | ----------------------------------------------------------------------------------------- | ---------- | | `YSC` | YouTube — registers a unique ID to track which videos you have watched during the session | Session | | `VISITOR_INFO1_LIVE` | YouTube — estimates your bandwidth to determine the best video player interface | 6 months | | `yt-remote-device-id`, `yt-remote-connected-devices` | YouTube — stores your video player preferences | Persistent | ## How to manage cookies When you first visit our site, a cookie banner lets you accept or reject optional cookies. You can then further manage cookies via your web browser: * [Google Chrome](https://support.google.com/accounts/answer/61416) * [Microsoft Edge](https://support.microsoft.com/en-us/microsoft-edge/delete-cookies-in-microsoft-edge-63947406-40ac-c3b8-57b9-2a946a29ae09) * [Mozilla Firefox](https://support.mozilla.org/en-US/kb/enable-and-disable-cookies-website-preferences) * [Apple Safari](https://support.apple.com/en-gb/safari) To find out more about cookies, including how to see what cookies have been set, visit [www.aboutcookies.org](https://www.aboutcookies.org/) or [www.allaboutcookies.org](https://www.allaboutcookies.org/). Note that blocking essential cookies may affect the functionality of our site. --- Source: https://mailosaur.com/legal/enterprise-sla # Enterprise Service Level Agreement (SLA) **Applicable to customers with a Mailosaur Enterprise plan with SLA subscription only. Please speak to support if you do not already have this plan, but require it.** ## Definitions and interpretation In this Agreement, unless the context otherwise requires, the following expressions have the following meanings: * **“Customer”** refers to the owner of an Account, with an active Mailosaur Enterprise with SLA subscription. * **“Service”** relates to the features that comprise the Mailosaur product itself including, but not limited to, its API, SMTP & POP3 features and SMS features. * **“Uptime”** is the percentage of the total minutes that the Service was available for in total, in a given calendar quarter. * **“Downtime”** is a period of time Service was unavailable as determined by a combination of Mailosaur's internal and external monitoring systems. Capitalised terms used but not defined in this SLA have the meaning assigned in the [Terms of Service](/legal/terms-of-service) or otherwise the Customer’s applicable agreement. ## Uptime & Response/Resolution Time Guarantee Mailosaur agrees to maintain at least 99.9% Uptime for the Service. The calculation used is described below (“Uptime Calculation”). Note, Downtime does not affect every customer at the same time or in the same way. Mailosaur agrees to respond to support queries in relation to Service Uptime and availability within 2 hours, between the hours of 06:00-22:00 GMT/BST Monday-Friday. Mailosaur agrees to resolve support queries relating to Service Uptime and availability within 24 hours from first response. If Mailosaur does not meet the SLA, Customer will be entitled to Service Credits detailed below (“Service Credits”). ## Uptime calculation Uptime is determined using the following calculation: **(total minutes in a calendar quarter - Downtime) / total minutes in a calendar quarter)**. ## Service Credits A Service Credits claim must be made in writing within the calender quarter immediately following the quarter in which Downtime occurred. A claim may be based on either (not both) of the following calculations: * 10% of the amount Customer paid for the Service in a calendar quarter where the Uptime for the Service was less than or equal to 99.9%, but greater than 99.0%; or * 25% of the amount Customer paid for the Service in a calendar quarter where the Uptime of the Service was less than 99.0%. ## Exclusions Excluded from the Uptime Calculation are Service failures resulting from (i) Customer's acts, omissions, or misuse of the Service including violations of the Agreement; (ii) failure of Customer's internet connectivity; (iii) factors outside Mailosaur's reasonable control, including force majeure events; or (iv) Customer's equipment, services, or other technology. In addition, Downtime excludes a maximum of one scheduled maintenance event per calendar quarter. ## Service Credits Redemption If Mailosaur is unable to meet the SLA requirements, Customer may redeem Service Credits only upon written request to Mailosaur Support within thirty (30) days of the end of the calendar quarter. Service Credits may take the form of a refund or credit to Customer’s account, cannot be exchanged into a cash amount, are limited to a maximum of ninety (90) days of paid service per calendar quarter, require Customer to have paid any outstanding invoices, and expire upon termination of Customer’s agreement with Mailosaur. Service Credits are the sole and exclusive remedy for any failure by Mailosaur to meet any obligations in this SLA. --- Source: https://mailosaur.com/legal/privacy # Privacy Policy **Effective: 1st August 2022** Maintaining your privacy is really, really important to us. This Privacy Policy describes how Mailosaur collects, uses, and discloses personal data, and what choices you have with respect to that information. When we refer to “Mailosaur” (“us”, “we”), we mean Mailosaur Ltd, a company registered in England & Wales (#07999725) whose registered address is The Square, Basing View, Basingstoke, Hampshire RG21 4EB, United Kingdom. Mailosaur acts as the controller or processor of your information, as explained in more detail in the “Identifying the Data Controller and Processor” section below. When we refer to “Personal Data”, we mean any information about an individual (“Data Subject”) from which that person may be identified, that is protected by the data protection laws of the United Kingdom, the European Economic Area and other jurisdictions. It does not include any data or information from which any Data Subject’s identity has been removed. The Data Subjects to which this Privacy Policy is relevant are persons whose Personal Data is incorporated within information collected by Mailosaur, or submitted to Mailosaur by the Customer (see “Information We Collect and Receive”) and which Mailosaur processes as part of the Services delivery. These Data Subjects may be employees, agents, sub-contractors or customers of the Customer; as well as persons who have been granted access to a Customer Account for the purpose of routine submission of Customer Content to Mailosaur in the course of using the Services on behalf of the Customers; and employees, agents or sub-contractors of the Customer who are the managerial contacts of the Customer in all of its dealings with Mailosaur. ## Applicability Of This Privacy Policy This Privacy Policy applies to any Personal Data that is processed by means of Mailosaur’s online software, testing tools and platform, including the associated Mailosaur mobile and desktop applications (collectively, the “Services”), mailosaur.com and other Mailosaur websites (collectively, the “Websites”) and other interactions (e.g., customer service inquiries, webinars, conferences, etc.) with Mailosaur. If you are a Data Subject, your attention is drawn to the content of this Privacy Policy which is applicable to you. The Policy relates to the overall agreement with each of Mailosaur’s customers (“Customer”) that governs delivery, access, and use of the Services (the “Terms of Service”), including the processing of any messages, files or other content submitted through Services accounts (collectively, “Customer Content”). Our Customer (who may be you, your employer, or another entity or person) that entered into the Terms of Service controls their access to the Services (their “Account”) and the use of any associated Customer Content. If you have any questions about specific Account settings and privacy practices, please contact the Customer whose Account you use. This Privacy Policy does not apply to any third-party applications or software that integrate with the Services through the Mailosaur platform (“Third-Party Services”), or any other third-party products, services, or businesses. ## Information We Collect And Receive Mailosaur may collect and receive Customer Content and other information and data (“Other Information”) in a variety of ways: - **Customer Content.** Customers or individuals granted access to an Account by a Customer (“Authorized Users”) routinely submit Customer Content to Mailosaur when using the Services (e.g., electronic mail and SMS content for testing). - **Other Information.** Mailosaur also collects, generates and/or receives Other Information: - **Account Information.** To create or update an Account, you or your Customer (e.g., your employer) supply Mailosaur with an email address, password, and/or similar account details. In addition, Customers that purchase a paid version of the Services provide Mailosaur (or its payment processors) with billing details such as credit card information, banking information and/or a billing address. - **Usage Information.** - *Services Metadata.* When an Authorized User interacts with the Services, metadata is generated that provides additional context about the way Authorized Users work. For example, Mailosaur logs the Accounts, servers, users, features, content and links you interact with. - *Log data.* As with most websites and technology services delivered over the Internet, our servers automatically collect information when you access or use our Websites or Services and record it in log files. This log data may include the Internet Protocol (IP) address, the address of the web page visited before using the Website or Services, browser type and settings, the date and time the Services were used, information about browser configuration and plugins, language preferences and cookie data. - *Device information.* Mailosaur collects information about devices accessing the Services, including type of device, what operating system is used, device settings, application IDs, unique device identifiers and crash data. Whether we collect some or all of this Other Information often depends on the type of device used and its settings. - *Location information.* We receive information from you, your Customer and other third-parties that helps us approximate your location. We may, for example, use a business address submitted by your employer, or an IP address received from your browser or device to determine approximate location. Mailosaur may also collect location information from devices in accordance with the consent process provided by your device. - **Cookie Information.** Mailosaur uses cookies and similar technologies in our Websites and Services that help us collect Other Information. The Websites and Services may also include cookies and similar tracking technologies of third parties, which may collect Other Information about you via the Websites and Services and across other websites and online services. For more details about how we use these technologies, please see our [Cookie Policy](/legal/cookies). - **Third Party Services.** Customer may choose to permit or restrict Third Party Services for their Account. Typically, Third Party Services are software that integrate with our Services, and a Customer can permit its Authorized Users to enable and disable these integrations for their Account. Once enabled, the provider of a Third Party Service may share certain information with Mailosaur. For example, if a Customer chooses to use Google authentication to register for our Services, we may receive user name and email address of Authorized Users, along with additional information that the application has elected to make available to Mailosaur to facilitate the integration. Authorized Users should check the privacy settings and notices in these Third Party Services to understand what data may be disclosed to Mailosaur. When a Third Party Service is enabled, Mailosaur is authorized to connect and access Other Information made available to Mailosaur in accordance with our agreement with the Third Party Provider. We do not, however, receive or store passwords for any of these Third Party Services when connecting them to the Services. - **Additional Information Provided to Mailosaur.** We receive Other Information when submitted to our Websites or if you participate in a survey, contest, activity or event, apply for a job, request support, interact with our social media accounts or otherwise communicate with Mailosaur. Generally, no one is under a statutory or contractual obligation to provide any Customer Content or Other Information (collectively, “Information”) and no Data Subject is obliged by Mailosaur to supply any Personal Data unless he/she is subject to any obligation to do so by virtue of its relationship with any Customer. However, certain Information is collected automatically and, if some Information, such as Account setup details, is not provided, we may be unable to provide the Services. ## How We Use Information Customer Content will be used by Mailosaur in accordance with Customer instructions, including any applicable terms in the Terms of Service and the Customer’s use of Services functionality, and as required by applicable law. However, Mailosaur is a processor of Personal Data and the Customer is the controller. Customer may, for example, use the Services to grant and remove access to an Account, assign roles and configure settings, access, modify, export, share and remove Customer Content and otherwise apply its policies to the Services. Mailosaur uses Personal Data, which we may process on the basis of our Legitimate Interests in operating our Services, Websites and business, or on the basis of you having given your informed consent for us to do so (such as for direct marketing purposes). “Legitimate Interests” means the interest of our business in providing its Services to give our Customers the best and most secure experience. We ensure that we consider and balance any potential impact on Data Subjects whose Personal Data forms part of the Customer Content (both positive and negative) and the rights of Data Subjects before we process such Personal Data for our Legitimate Interests. We avoid using your Personal Data for activities where our interests are overridden by the impact on you, unless we have your consent or if we are otherwise permitted by law. You can obtain further information about how Mailosaur assesses its Legitimate Interests against any potential impacts on Data Subjects by contacting us at [dpo@mailosaur.com](mailto:dpo@mailosaur.com). More specifically, Mailosaur uses Other Information: - To provide, update, maintain and protect our Services, Websites and business. This includes use of Other Information to support delivery of the Services under a Terms of Service, prevent or address service errors, security or technical issues, analyze and monitor usage, trends and other activities or at an Authorized User’s request. - As required by applicable law, legal process or regulation. - To communicate with you by responding to your requests, comments and questions. If you contact us, we may use your Other Information to respond. - To develop and provide tools and additional features. Mailosaur tries to make the Services as useful as possible for specific Accounts and Authorized Users. For example, we may make Services suggestions based on historical use and predictive models, identify organizational trends and insights, to customize a Services experience or create new features and products. - To send emails and other communications. We may send you service, technical and other administrative emails, messages and other types of communications. We may also contact you to inform you about changes in our Services, our Services offerings, and important Services-related notices, such as security and fraud notices. These communications are considered part of the Services and you may not opt out of them. In addition, we sometimes send emails about new product features, promotional communications or other news about Mailosaur. These are marketing messages so you can control whether you receive them. - For billing, account management and other administrative matters. Mailosaur may need to contact you for invoicing, account management and similar reasons and we use account data to administer accounts and keep track of billing and payments. - To investigate and help prevent security issues and abuse. If Information is aggregated, anonymised or de-identified so it is no longer capable of being reasonably associated with an identified or identifiable natural person or constitutes Customer Content, Mailosaur may use it for any business purpose. ## Data Retention Mailosaur will retain Customer Content in accordance with a Customer’s instructions, including any applicable terms in the Terms of Service and Customer’s use of Services functionality, and as required by applicable law. Customer may be able to customise its retention settings and apply those customised settings at server level or other level. The deletion of Customer Content and other use of the Services by Customer may result in the deletion and/or de-identification of certain associated Other Information. For more detail, please contact [dpo@mailosaur.com](mailto:dpo@mailosaur.com). Mailosaur may retain Other Information pertaining to you for as long as necessary for the purposes described in this Privacy Policy. This may include keeping your Other Information after you have deactivated your account for the period of time needed for Mailosaur to pursue legitimate business interests, conduct audits, comply with (and demonstrate compliance with) legal obligations, resolve disputes and enforce our agreements. ## How We Share And Disclose Information This section describes how Mailosaur may share and disclose Information. Customers determine their own policies and practices for the sharing and disclosure of Information, and Mailosaur does not control how they or any other third parties choose to share or disclose Information. - **Customer’s Instructions.** Mailosaur will solely share and disclose Customer Content in accordance with a Customer’s instructions, including any applicable terms in the Terms of Service and Customer’s use of Services functionality, and in compliance with applicable law and legal process. - **Displaying the Services.** When an Authorized User submits Other Information, it may be displayed to other Authorized Users in the same or connected Accounts. For example, an Authorized User’s email address may be displayed with their Account profile. - **Customer Access.** Owners, administrators, Authorized Users and other Customer representatives and personnel may be able to access, modify or restrict access to Other Information. This may include, for example, your employer using Service features to export logs of Account activity, or accessing or modifying your profile details. - **Third Party Service Providers and Partners.** We may engage third party companies or individuals as service providers or business partners to process Other Information and support our business. These third parties may, for example, provide virtual computing and storage services. Additional information about the sub-processors we use to support delivery of our Services is set forth at [Mailosaur Sub-Processors](/legal/subprocessors). - **Corporate Affiliates.** Mailosaur may share Other Information with its corporate affiliates, parents and/or subsidiaries. - **During a Change to Mailosaur’s Business.** If Mailosaur engages in a merger, acquisition, bankruptcy, dissolution, reorganization, sale of some or all of Mailosaur’s assets or stock, financing, public offering of securities, acquisition of all or a portion of our business, a similar transaction or proceeding, or steps in contemplation of such activities (e.g. due diligence), some or all Other Information may be shared or transferred, subject to standard confidentiality arrangements. - **Aggregated or De-identified Data.** We may disclose or use aggregated or de-identified Other Information for any purpose. For example, we may share aggregated or de-identified Other Information with prospects or partners for business or research purposes, such as telling a prospective Mailosaur customer the average amount of time spent within a typical Account. - **To Comply with Laws.** If we receive a request for information, we may disclose Other Information if we reasonably believe disclosure is in accordance with or required by any applicable law, regulation or legal process. Please see the Data Request Policy to understand how Mailosaur responds to requests to disclose data from government agencies and other sources. - **To enforce our rights, prevent fraud, and for safety.** To protect and defend the rights, property or safety of Mailosaur or third parties, including enforcing contracts or policies, or in connection with investigating and preventing fraud or security issues. With Consent, Mailosaur may share Other Information with third parties when we have consent to do so. ## Security Mailosaur takes security of data very seriously. Mailosaur works hard to protect Other Information you provide from loss, misuse, and unauthorized access or disclosure. These steps take into account the sensitivity of the Other Information we collect, process and store, and the current state of technology. To learn more about current practices and policies regarding security and confidentiality of the Services, please see our [Security Practices](/security). Given the nature of communications and information processing technology, Mailosaur cannot guarantee that Information, during transmission through the Internet or while stored on our systems or otherwise in our care, will be absolutely safe from intrusion by others. ## Age Limitations To the extent prohibited by applicable law, Mailosaur does not allow use of our Services and Websites by anyone younger than 16 years old. If you learn that anyone younger than 16 has unlawfully provided us with personal data, please contact us and we will takes steps to delete such information. ## Changes To This Privacy Policy Mailosaur may change this Privacy Policy from time to time. Laws, regulations and industry standards evolve, which may make those changes necessary, or we may make changes to our business. We will post the changes to this page and encourage you to review our Privacy Policy to stay informed. If we make changes that materially alter your privacy rights, Mailosaur will provide additional notice, such as via email or through the Services. If you disagree with the changes to this Privacy Policy, you should deactivate your Services account. Contact the Customer if you wish to request the removal of Personal Data under their control. ## International Data Transfers Mailosaur may transfer your Personal Data from the United Kingdom or the European Economic Area to countries other than the one in which you live. In order to ensure adequate protection for your data, we will only ever use partners and suppliers in jurisdictions that have been determined to have “adequate” data protection regimes: this includes all European Economic Area countries, the United Kingdom, and Switzerland. With respect to other jurisdictions, Mailosaur will not transfer any Personal Data unless such jurisdiction ensures that there are adequate safeguards which shall include contracts between Mailosaur and the data recipient which contain standard contractual clauses approved under UK and/or EEA data protection legislation. ## Data Protection Officer To communicate with our Data Protection Officer, please email [dpo@mailosaur.com](mailto:dpo@mailosaur.com). ## Identifying The Data Controller And Processor Data protection law in certain jurisdictions differentiates between the “controller” and “processor” of information. In general, Customer is the controller of Customer Content. In general, Mailosaur is the processor of Customer Content and the controller of Other Information. Mailosaur Ltd, is a company registered in England & Wales (#07999725) and is the controller of Other Information and a processor of Customer Content relating to Authorized Users who use Accounts established for Customers. ## Your Rights Individuals located in certain jurisdictions, including the United Kingdom, the European Economic Area, and Switzerland, have certain statutory rights in relation to Personal Data . Subject to any exemptions provided by law, Data Subjects may have the right to request access to Information, as well as to seek to update, delete or correct this Information. You can usually do this using the settings and tools provided in the Services account. If you cannot use the settings and tools, contact us for additional access and assistance. To the extent that Mailosaur’s processing of your Personal Data is subject to the UK General Data Protection Regulation (GDPR), Mailosaur relies on its Legitimate Interests, described above, to process your Personal Data. Mailosaur may also process Other Information that constitutes your Personal Data for direct marketing purposes on the basis of having been given your informed consent to do so, and you have a right to object to Mailosaur’s use of your Personal Data for this purpose at any time. ## Data Protection Authority Subject to applicable law, you also have the right to (i) restrict Mailosaur’s use of Other Information that constitutes your Personal Data and (ii) lodge a complaint with your local data protection authority or the Information Commissioner’s Office, which is Mailosaur’s lead supervisory authority in the European Union. If you are a resident of the European Economic Area and believe we maintain your Personal Data within the scope of the General Data Protection Regulation (GDPR), you may direct questions or complaints to our lead supervisory authority: UK Information Commissioner's Office\ Wycliffe House\ Water Lane\ Wilmslow\ Cheshire SK9 5AF\ United Kingdom Phone: 0303 123 1113\ Fax: 01625 524 510\ Email: info@ico.org.uk Mailosaur Ltd is registered with the Information Commissioner's Office with registration number Z3554772. ## Contacting Mailosaur Please also feel free to contact Mailosaur if you have any questions about this Privacy Policy or Mailosaur’s practices, or if you are seeking to exercise any of your statutory rights. You may contact us at [support@mailosaur.com](mailto:support@mailosaur.com). --- Source: https://mailosaur.com/legal/subprocessors # Mailosaur Sub-Processors **Effective: 1st November 2026** Mailosaur Ltd (**“Mailosaur”**) may engage and use data processors with access to certain Customer Data (each, a **“Sub-Processor”**) in order to support delivery of our Services. Mailosaur currently uses third party Sub-Processors to provide infrastructure services, and to help provide customer support functions. Prior to engaging any third party Sub-Processor, Mailosaur performs due diligence to evaluate their privacy and security practices. All our processors have been evaluated and chosen with data security and privacy in mind. Written contracts/addenda are in place, incorporating the standard contractual clauses for data transfers between EU and non-EU countries as required. ## Infrastructure & Customer Engagement Sub-Processors Mailosaur may use the following Sub-Processors to host & securely manage Customer Data or provide other infrastructure that helps with the delivery of our Services: | Entity Name | Sub-Processing Activities | Data Location | Entity Country | | -------------------------------- | ------------------------- | ------------- | -------------- | | Google Cloud EMEA Limited | Cloud Service Provider | EU/UK | Ireland | | Microsoft Ireland Operations Ltd | Cloud Service Provider | EU/UK | Ireland | | HubSpot Ireland Ltd | Support, CRM & Marketing | EU/UK | Ireland | ## Payments, Billing, and Invoicing Sub-Processors Mailosaur may use the following Sub-Processors to manage invoicing, billing, and payment processing. The Customer Data stored with these sub-processors is limited to that required for these purposes (e.g. billing contact information): | Entity Name | Sub-Processing Activities | Data Location | Entity Country | | ------------ | ------------------------------ | -------------------- | -------------- | | Stripe, Inc. | Payments provider | EU/UK, United States | United States | | Xero Limited | Accounting & Resource Planning | United States | United Kingdom | ## Other Sub-Processors Mailosaur may use the following Sub-Processors to perform other Service functions that may, from time to time, require the processing or storage of Customer Data (e.g. sending/receiving email, video conferencing, document processing, and contract management): | Entity Name | Sub-Processing Activities | Data Location | Entity Country | | -------------------------------- | -------------------------------------------------------------- | ------------- | -------------- | | Microsoft Ireland Operations Ltd | Business Software inc. Microsoft 365, video conferencing, etc. | EU/UK | Ireland | ## Updates As we grow and evolve the Sub-Processors we engage may also change. We will endeavour to provide account owners with notice of any new Sub-Processors to the extent required under our Terms of Service, along with posting such updates here. Please check back frequently for updates. --- Source: https://mailosaur.com/legal/terms-of-service # Terms of Service **Effective: 1st November 2023** We are a company called **Mailosaur Ltd**, registered in England and Wales under company number 07999725 with our registered address at The Square, Basing View, Basingstoke, Hampshire RG21 4EB. Throughout these Customer Terms of Service (hereafter referred to as “terms”) we shall refer to ourselves as “Mailosaur”. By starting a free trial or by signing up to a Subscription Plan, you (the Customer) agree to these Customer Terms of Service. Agreed Terms 1. Definitions and interpretation 1. The definitions and rules of interpretation in this clause apply in these terms. * **User Account:** collectively the personal information and Credentials used by a User to access the Services. * **Customer Account:** the account(s) which permit the Customer (or its nominated representative(s)) to manage the subscription and information. * **Confidential Information:** means all confidential information (however recorded or preserved) disclosed by a party or its representatives to the other party and that party's representatives in connection with these terms, including but not limited to any information that would be regarded as confidential by a reasonable business person relating to: (i) the business, affairs, customers, clients, suppliers, plans, intentions, or market opportunities of the disclosing party; and (ii) the operations, processes, know-how, designs, trade secrets of the disclosing party. * **Credentials:** the set of unique identifiers including but not limited to a username and password created via mailosaur.com or corporate login credentials where SSO is in use by the Customer that enables a User to verify identity in order to log in to their User Account. * **Customer:** the entity which has signed up to the Services offered by Mailosaur Ltd in accordance with these terms. * **Customer Data:** the data inputted by the Customer, Users, or Mailosaur on the Customer’s behalf for the purpose of using the Services or facilitating the Customer's use of the Services. * **Data Protection Laws:** means (a) To the extent the UK GDPR applies, the law of the United Kingdom or of a part of the United Kingdom which relates to the protection of personal data, including all applicable laws, statutes, regulations, and codes from time to time in force relating to the UK GDPR; and (b) To the extent the EU GDPR applies, the law of the European Union or any member state of the European Union to which the Customer is subject, which relates to the protection of personal data, including all applicable laws, statutes, regulations, and codes from time to time in force relating to the EU GDPR. * **Documentation:** the document(s) made available to the Customer by Mailosaur online via *mailosaur.com* or such other web address notified by Mailosaur to the Customer from time to time which sets out a description of the Services and the User instructions for the Services. * **Effective Date:** the date of acceptance of these terms Service by the Customer. * **EU GDPR:** means the General Data Protection Regulation, Regulation (EU) 2016/679. * **Initial Subscription Term:** means the first full calendar month of paid use of the Services if the Customer chooses a monthly plan or the first 12 months of paid use of the Services if the Customer chooses an annual plan, either immediately following the expiry of a free trial or from the date on which the Customer activates a Managed Plan or Self-Service Plan. * **Managed Plan:** A Subscription Plan that is has been set up by Mailosaur's representatives. This type of plan will not auto-renew, and instead the Customer will be provided a quote in advance of the end of each Subscription Plan. Mailosaur will require the Customer’s approval before an invoice is created and renewal applied. Changes to this type of plan must be requested via Mailosaur’s representatives. * **Renewal Period:** the period for which a Subscription Plan is renewed (unless otherwise agreed by Mailosaur in writing, being a full calendar month for Customers with monthly plans and 12 months for Customers with annual plans) * **Self-Service Plan:** A Subscription Plan that is set up by the Customer within the Customer Account. This type of plan is managed by the Customer via their Customer Account and renewal is automatic. * **Services:** the services provided by Mailosaur to the Customer under these terms via mailosaur.com or any other website notified to the Customer by Mailosaur from time to time, as more particularly described in the Documentation. * **Subscription Fees:** the subscription fees payable by the Customer to Mailosaur for the chosen Subscription Plan as determined by the plans and associated fees currently in force which can be viewed at mailosaur.com and which may be replaced by Mailosaur at any time. * **Subscription Plan:** the subscription plan chosen by the Customer, and shown on the invoice, which entitles Users to access and use the Services in accordance with these terms. * **Subscription Term:** collectively the free trial, the Initial Subscription Term, and any subsequent Renewal Periods. * **UK GDPR:** has the meaning given to it in the Data Protection Act 2018. * **User:** any employees, agents and independent contractors of the Customer who are authorised by the Customer to use the Services via a User Account. 2. A person includes an individual, corporate, or unincorporated body (whether or not having separate legal personality) and that person's legal and personal representatives, successors or permitted assigns. A reference to a company shall include any company, corporation, or other body corporate, wherever and however incorporated or established. 3. Unless the context otherwise requires, words in the singular shall include the plural and in the plural shall include the singular. 4. A reference to a statute or statutory provision is a reference to it as it is in force as at the date of these terms. 5. A reference to a statute or statutory provision shall include all subordinate legislation made as at the date of these terms under that statute or statutory provision. 6. A reference to **writing** or **written** excludes fax but not email. 2. Provision of the Services 1. Mailosaur shall, during the Subscription Term, provide the Services to the Customer on and subject to these terms. 2. Mailosaur shall use commercially reasonable endeavours to make the Services available 24 hours a day except for: 1. any planned maintenance which has been communicated to the Customer by Mailosaur; and 2. any unscheduled or urgent maintenance (of which Mailosaur will endeavour to provide the Customer will as much advance notice as is reasonably and practicably possible). 3. The Customer acknowledges that the Services may change in form or nature at any time. Mailosaur shall provide reasonable advance notice of any material changes to the Services. 4. The Customer warrants that the individual setting up the Customer Account is authorised to enter into these terms for and on behalf of the Customer. Subject to the restrictions set out in clause 2 and the other conditions of these terms, Mailosaur hereby grants to the Customer a non-exclusive, non-transferable right and licence, without the right to grant sublicences, to permit the Users to use the Services via User Accounts during the Subscription Term solely for the Customer's internal business operations. 5. In relation to the Users, the Customer undertakes that: 1. the maximum number of Users that it authorises to access and use the Services via User Accounts shall not exceed the number of Users permitted in the Subscription Plan it has purchased from time to time; 2. it will not allow or suffer any User Accounts to be used by more than one individual User unless it has been reassigned in its entirety to another individual User, in which case the prior User shall no longer have any right to access or use the Services; 3. each User shall keep the Credentials they use to access their User Account secure, and shall not share these Credentials with others; 4. each User shall comply with these terms and any User specific terms and conditions communicated by Mailosaur from time to time. 6. The Customer shall not access, store, distribute or transmit any viruses, or any material (including Customer Data) during the course of its use of the Services that: 1. is unlawful, harmful, threatening, defamatory, obscene, infringing, harassing or racially or ethnically offensive; 2. facilitates illegal activity; 3. depicts sexually explicit images; 4. promotes unlawful violence; 5. is discriminatory based on race, gender, colour, religious belief, sexual orientation, disability; or 6. is otherwise suspicious, illegal or causes damage or injury to any person or property. 7. Mailosaur reserves the right, without liability or prejudice to its other rights to the Customer, to 1. review, flag, suspend, remove or disable access to any material (including Customer Data) that Mailosaur deems to breach the provisions of clause 2.6; and 2. disable or suspend the Customer Account and any User Accounts if Mailosaur reasonably believes that are in breach of the provisions of clause 2.6 or that are using the Services without authorization to access a third-party service. 8. The Customer shall not: 1. except as may be allowed by any applicable law which is incapable of exclusion by these terms and except to the extent expressly permitted under these terms: 1. attempt to copy, modify, duplicate, create derivative works from, frame, mirror, republish, download, display, transmit, or distribute all or any portion of the Services in any form or media or by any means; 2. attempt to de-compile, reverse compile, disassemble, reverse engineer, or otherwise reduce to human-perceivable form all or any part of the Services; 2. access all or any part of the Services or Documentation in order to build a product or service which competes with the Services; 3. use the Services or Documentation to create software programs that are similar to or compete with Mailosaur's services, or to repackage or present the Services or Documentation as the Customer’s own software solution. 4. license, sell, rent, lease, transfer, assign, distribute, display, disclose, or otherwise commercially exploit, or otherwise make the Services or Documentation available to any third party except the Users, 5. attempt to obtain, or assist third parties in obtaining, access to the Services, other than as provided under clause 2; 6. introduce or permit the introduction of any virus into Mailosaur's network and information systems; or 7. engage in any conduct which (in the reasonable opinion of Mailosaur) disrupts the provision of the Services. 9. The Customer shall use all reasonable endeavours to prevent any unauthorised access to, or use of, the Services and, in the event of any such unauthorised access or use, promptly notify Mailosaur. 3. Trial period 1. Mailosaur may offer a free trial for a period of 14 days (or other period as agreed by Mailosaur in writing) that allows the Customer to access and use the Services. At any time during or after the free trial period, the Customer has the option to continue access to the Services by paying the Subscription Fees. For the avoidance of doubt, no Subscription Fees shall be charged to the Customer during a free trial period. 2. The Customer acknowledges that it is bound by these terms during any free trial period. 3. Mailosaur reserves the right to decline or terminate a free trial to any Customer and for any reason. 4. Changing a Subscription Plan 1. Subject to clause 4.2, the Customer may, from time to time during the Subscription Term, change their Subscription Plan and/or payment details via the Customer Account (Self-Service Plan), or by Contacting Mailosour’s representatives (Managed Plan). 2. If the Customer upgrades their current Subscription Plan, this will be actioned immediately, and the Customer will be charged the pro-rated difference between what they have already paid and the cost of the new Subscription Plan for the remaining period of time in the applicable Initial Subscription Term or the Renewal Period. The Customer will then be charged the Subscription Fees associated with the new Subscription Plan from the start of the next Renewal Period. If the Customer downgrades their current Subscription Plan, the change will not take effect until the start of the next Renewal Period. 5. Mailosaur's obligations 1. Mailosaur shall provide the Services with reasonable skill and care. 2. Clause 5.1 shall not apply to the extent of any non-conformance which is caused by use of the Services contrary to Mailosaur's instructions, or modification or alteration of the Services by any party other than Mailosaur or Mailosaur's duly authorised contractors or agents. If the Services do not conform with clause 5.1, Mailosaur will, at its expense, use reasonable commercial endeavours to correct any such non-conformance in a reasonable timeframe. Such correction (where possible) constitutes the Customer's sole and exclusive remedy for any breach of clause 5.1. 3. Mailosaur: 1. does not warrant that: 1. the Customer's use of the Services will be uninterrupted or error-free; or 2. that the Services, Documentation and/or the information obtained by the Customer through the Services will meet the Customer's requirements. 2. is not responsible for any delays, delivery failures, or any other loss or damage resulting from the transfer of data over communications networks and facilities, including the internet, and the Customer acknowledges that the Services and Documentation may be subject to limitations, delays, and other problems inherent in the use of such communications facilities. 4. These terms shall not prevent Mailosaur from entering into similar agreements with third parties, or from independently developing, using, selling, or licensing documentation, products and/or services which are similar to those provided under these terms. 6. Customer's obligations 1. The Customer shall: 1. provide Mailosaur with: 1. all necessary co-operation in relation to these terms; and 2. all necessary access to such information as may be required by Mailosaur; in order to provide the Services, including but not limited to Customer Data, security access information and configuration services; 2. without affecting its other obligations under these terms, comply with all applicable laws and regulations applicable in the Customer’s jurisdiction or the United Kingdom with respect to its use of the Services; 3. carry out all other Customer responsibilities set out in these terms in a timely and efficient manner. 4. ensure that the Users use the Services in accordance with these terms, and any other User specific terms and conditions communicated by Mailosaur from time to time; 5. be responsible for any User's breach of these terms and/or any other User specific terms and conditions communicated by Mailosaur from time to time; 6. obtain and shall maintain all necessary licences, consents, and permissions necessary for Mailosaur, its contractors and agents to perform their obligations under these terms; 7. only access the Services through the normal means provided by Mailosaur and not attempt to download, convert, crawl or otherwise reverse-engineer any part of the Services; 8. if required, ensure that its network and systems comply with the relevant specifications provided by Mailosaur from time to time; 9. be, to the extent permitted by law and except as otherwise expressly provided in these terms, solely responsible for procuring, maintaining and securing its network connections and telecommunications links from its systems to Mailosaur's data centres, and all problems, conditions, delays, delivery failures and all other loss or damage arising from or relating to the Customer's network connections or telecommunications links or caused by the internet; and 10. grant to Mailosaur a non-exclusive, non-transferable licence to use, copy, store, transmit and display the Customer’s name and logo to the extent necessary to enable Mailosaur to state on its website and in any marketing materials that the Customer is or was a customer of Mailosaur. The Customer may revoke this licence at any time by sending written notice to Mailosaur. 2. The Customer shall own all right, title, and interest in and to all of the Customer Data that is not personal data and shall have sole responsibility for the legality, reliability, integrity, accuracy, and quality of all such Customer Data. 3. If Mailosaur’s ability to provide the Services is prevented, hindered, or delayed by any failure by the Customer to fulfil any obligation listed in clause 6 (**Customer Default**): 1. Mailosaur will be entitled to suspend performance of the Services until the Customer remedies the Customer Default, and to rely on the Customer Default to relieve Mailosaur from the performance of the Services, in each case to the extent the Customer Default prevents, hinders, or delays performance of the Services. In certain circumstances a Customer Default may entitle Mailosaur to terminate these terms under clause 14 (Termination); 2. Mailosaur will not be responsible for any costs or losses which the Customer sustains or incurs which arise directly or indirectly from Mailosaur’s failure or delay to perform the Services; and 3. the Customer shall indemnify Mailosaur against any costs or losses it sustains or incurs which arise directly or indirectly from a Customer Default. 7. Charges and payment 1. The Customer shall pay the Subscription Fees to Mailosaur in accordance with clause 7. 2. The Customer shall, upon request, provide to Mailosaur valid, up-to-date, and complete payment details and any other relevant valid, up-to-date, and complete contact and billing details. 3. Mailosaur shall collect payment of Subscription Fees via the method agreed between the Customer and Mailosaur. 4. When the Customer provides payment and billing details, the Customer hereby agrees to pay Mailosaur for the Subscription Fees payable in respect of the Initial Subscription Term 5. Subject to clause 14, for the Subscription Fees payable in respect of any Renewal Period. The Customer shall pay the Subscription Fees at the beginning of the Initial Subscription Term and at the beginning of each Renewal Period unless and until either party gives notice to terminate in accordance with these terms. 6. If a User’s payment fails to clear or is declined for whatever reason, then access to the Services may be immediately suspended. The Services will re-commence once payment is successfully completed. 7. If Mailosaur has not received payment by the due date, then without prejudice to any other rights and remedies available to Mailosaur: 1. Mailosaur may, without liability to the Customer, disable the Customer Account and any User Accounts and Mailosaur shall be under no obligation to provide any or all of the Services while Subscription Fees remain unpaid; and 2. Mailosaur shall be entitled to recover interest on the overdue sum from the due date until payment of the overdue sum. Interest will accrue each day at 4% a year above the Bank of England’s base rate from time to time. 8. All amounts and fees stated or referred to in these terms: 1. are non-cancellable and non-refundable; 2. are exclusive of value added tax, which shall be added to Mailosaur's invoice(s) at the appropriate rate. 9. Mailosaur shall be entitled to increase the Subscription Fees at the start of each Renewal Period. 8. Data protection 1. Both parties will comply with all applicable requirements of the Data Protection Laws. This clause is in addition to, and does not relieve, remove, or replace, a Party's obligations or rights under the Data Protection Laws. 2. The parties acknowledge that in most circumstances, both parties are data controllers under the Data Protection Laws. 3. If Mailosaur acts as a data processor in relation to any personal data for which the Customer is a data controller, Mailosaur shall: 1. process the personal data in compliance with the Data Protection Laws; 2. process the personal data only to the extent necessary to perform the Services; 3. assist the Customer, at their expense, in responding to any and all requests from data subjects and in ensuring the Customers compliance with the Data Protection Laws with respect to security, breach notifications, impact assessments, and consultations with supervisory authorities or regulators (including the UK’s data protection commissioner); 4. notify the Customer without undue delay of a data breach relating to any personal data for which the Customer is a data controller; 5. implement appropriate organisational and technical measures to protect against unauthorised or unlawful processing of personal data and against accidental loss or destruction of, or damage to, personal data; 6. be authorised by the Customer, by way of a general authorisation, to appoint sub-processors under these terms, providing the requirements of sub-clause 8.3 (g) are met in relation to any sub-processors based outside the UK; and 7. not transfer or store the personal data outside of the UK, EEA or Switzerland except where: (i) the recipient country has received an adequacy decision from the UK’s data protection commissioner; or (ii) the transfer is subject to appropriate safeguards. 4. The Customer warrants that they have all necessary appropriate consents and notices in place to enable lawful transfer of any personal data to Mailosaur for the duration and purposes of these terms so that Mailosaur may lawfully use, process and transfer the personal data in accordance with these terms on the Customers behalf. The Customer shall provide to us the details of the type(s) of personal data, the scope, nature and purpose of the processing, and the duration of the processing prior to Mailosaur commencing any Services. 5. The Customer warrants that all Users are over the age of 16. 6. In the event of any loss or damage to Customer Data, the Customer's sole and exclusive remedy against Mailosaur shall be for Mailosaur to use reasonable commercial endeavours to restore the lost or damaged Customer Data from the latest back-up of such Customer Data maintained by Mailosaur in accordance with its standard archiving and backup procedures. Mailosaur shall not be responsible for any loss, destruction, alteration, or disclosure of Customer Data caused by any third party (except those third parties sub-contracted by Mailosaur to perform services related to Customer Data maintenance and back-up for which it shall remain fully liable). 7. In the event that these terms are terminated for any reason, the Customer Account and each User Account will be closed and their access to the Services revoked. Any Customer Data will become inaccessible from the date on which the Services are revoked, however copies may be retained by Mailosaur as part of its standard backup procedures. 9. Third party providers 1. The Customer acknowledges that the Services and Documentation may enable or assist it to access the website content of, correspond with, and purchase products and services from, third parties via third-party websites and that it does so solely at its own risk. Mailosaur makes no representation, warranty or commitment and shall have no liability or obligation whatsoever in relation to the content or use of, or correspondence with, any such third-party website, or any transactions completed, and any contract entered into by the Customer, with any such third party. Any contract entered into, and any transaction completed via any third-party website is between the Customer and the relevant third party, and not Mailosaur. Mailosaur recommends that the Customer refers to the third party’s website terms and conditions and privacy policy prior to using the relevant third-party website. Mailosaur does not endorse or approve any third-party website nor the content of any of the third-party website made available via the Services or Documentation. 10. Intellectual Property rights 1. The Customer acknowledges and agrees that Mailosaur and/or its licensors own all intellectual property rights in the Services and Documentation. Except as expressly stated herein, these terms do not grant the Customer any rights to, under or in, any patents, copyright, database right, trade secrets, trade names, trade marks (whether registered or unregistered), or any other rights or licences in respect of the Services or the Documentation. 2. Mailosaur confirms that it has all the rights in relation to the Services and Documentation that are necessary to grant all the rights it purports to grant under, and in accordance with these terms. 11. Confidentiality 1. Both parties agree that, except as provided by clauses 11.2 and 11.3 below, or as authorised in writing by the other party, they shall: (a) keep confidential all Confidential Information; (b) not disclose any Confidential Information to any other party; (c) not use any Confidential Information for any purpose other than as contemplated under these terms; (d) not make any copies of, record in any way or part with possession of any Confidential Information; and (e) use reasonable endeavours to ensure that their respective directors, officers, employees, agents, sub-contractors or advisers also comply with this clause. 2. Both parties may disclose any Confidential Information to: (a) employees, officers, sub-contractors, or advisers for the purposes of exercising rights or carrying out obligations under with these terms; or (b) any governmental or other authority or regulatory body. Disclosure under this clause may be made only to the extent necessary for the provision of the Services under these terms, or as required by law. 3. Either party may use or disclose any Confidential Information if it is or becomes public knowledge through no fault of the recipient party. 4. No party shall use the other party’s Confidential Information for any purpose other than to exercise its rights and perform its obligations under or in connection with these terms. 12. Indemnity 1. The Customer shall defend, indemnify, and hold harmless Mailosaur against claims, actions, proceedings, losses, damages, expenses, and costs (including without limitation court costs and reasonable legal fees) arising out of or in connection with the Customer's or Users’ use of the Services, provided that: 1. the Customer is given prompt notice of any such claim; 2. Mailosaur provides reasonable co-operation to the Customer in the defence and settlement of such claim, at the Customer's expense; and 3. the Customer is given sole authority to defend or settle the claim. 2. In no event shall Mailosaur, its employees, agents and sub-contractors be liable to the Customer to the extent that the alleged infringement is based on: 1. a modification of the Services or Documentation by anyone other than Mailosaur; or 2. the Customer’s use of the Services or Documentation in a manner contrary to the instructions given to the Customer by Mailosaur; or 3. the Customer's use of the Services or Documentation after notice of alleged or actual infringement from Mailosaur or any appropriate authority. 13. Limitation of liability 1. Except as expressly and specifically provided in these terms: 1. The Customer assumes sole responsibility for results obtained from the use of the Services by the Customer, and for conclusions drawn from such use. Mailosaur shall have no liability for any damage caused by errors or omissions in any information, instructions or scripts provided to Mailosaur by the Customer in connection with the Services, or any actions taken by Mailosaur at the Customer's direction; 2. all warranties, representations, conditions, and all other terms of any kind whatsoever implied by statute or common law are, to the fullest extent permitted by applicable law, excluded from these terms; 3. the Services are provided to the Customer on an "as is" basis; and 4. Mailosaur accepts no liability for any disruption or non-availability of the Services resulting from external causes including, but not limited to, ISP equipment failure, host equipment failure, communications network failure, power failure, natural events, acts of war, acts of God or legal restrictions and censorship. 2. Nothing in these terms excludes liability: 1. for death or personal injury caused by negligence; or 2. for fraud or fraudulent misrepresentation. 3. Subject to clause 13.2: 1. Neither party shall be liable whether in tort (including for negligence or breach of statutory duty), contract, misrepresentation, restitution or otherwise for any loss of profits, loss of business, depletion of goodwill and/or similar losses or loss or corruption of data or information, or pure economic loss, or for any special, indirect or consequential loss, costs, damages, charges or expenses however arising under these terms; and 2. Mailosaur's total aggregate liability in contract, tort (including negligence or breach of statutory duty), misrepresentation, restitution or otherwise, arising in connection with the performance or contemplated performance of these terms shall be limited to the total Subscription Fees paid during the 12 months immediately preceding the date on which the claim arose. 4. Nothing in these terms excludes the liability of the Customer for any breach, infringement, or misappropriation of Mailosaur’s intellectual property rights. 14. Term and termination 1. These terms shall, unless otherwise terminated as provided by clause 14, commence on the Effective Date and shall continue for any free trial, any Initial Subscription Term and thereafter, these terms shall: 1. if a Managed Plan, be renewed for a Renewal Period, provided the Customer has given Mailosaur their approval in writing to do so following the receipt of the Renewal period quote. 2. if a Self-Service Plan, be automatically renewed for each Renewal Period, unless: 1. Mailosaur notifies the Customer of termination in writing for any reason, in which case these terms shall terminate immediately; 2. the Customer cancels their subscription or removes their payment details in the Customer Account or otherwise disables payment functionality, in which case these terms shall terminate upon the expiry of the applicable Initial Subscription Term or Renewal Period. 2. Without affecting any other right or remedy available to it, Mailosaur may terminate these terms at any time for the following reasons: 1. the Customer or any User has committed a material breach of these terms; 2. the Customer has failed to pay any amount due under these terms; 3. the Customer has indicated, expressly or impliedly or by its conduct, that it does not intend to or is unable to comply with these terms; 4. Mailosaur is required to do so by law; 5. Mailosaur determines in its sole discretion that it is no longer commercially viable to continue providing the Services; 6. the Customer becomes, or is in the opinion of Mailosaur likely to become, insolvent; 7. Mailosaur is no longer providing the Services in the Customer’s country of residence. 3. On termination of these terms for any reason: 1. all licences granted under these terms shall immediately terminate and the Customer and Users shall immediately cease all use of the Services; 2. each party shall return and make no further use of any equipment, property, and other items (and all copies of them) belonging to the other party; 3. Mailosaur may destroy or otherwise dispose of any of the Customer Data in its possession unless Mailosaur receives, no later than 10 days after the termination date, a written request for delivery of the Customer Data as available in the most recent back-up held by Mailosaur. Mailosaur shall use commercial endeavours to deliver the back-up of Customer Data to the Customer provided that all payments due under these terms have been received by Mailosaur; and 4. any rights, remedies, obligations, or liabilities of the parties that have accrued up to the date of termination, including the right to claim damages in respect of any breach of these terms which existed at or before the date of termination shall not be affected or prejudiced. 15. Force majeure 1. Neither party shall be in breach of these terms nor liable for delay in performing, or failure to perform, any of its obligations under these terms if such delay or failure result from events, circumstances or causes beyond its reasonable control. The time for performance of such obligations shall be extended accordingly. If the period of delay or non-performance continues for 30 days, the party not affected may terminate these terms by giving 7 days' written notice to the affected party. 16. Variation 1. No variation of these terms shall be effective unless it is in writing and signed by both parties (or their authorised representatives). 17. Waiver 1. A waiver of any right or remedy is only effective if given in writing and shall not be deemed a waiver of any subsequent right or remedy. 2. A delay or failure to exercise, or the single or partial exercise of, any right or remedy shall not waive that or any other right or remedy, nor shall it prevent or restrict the further exercise of that or any other right or remedy. 18. Rights and remedies 1. Except as expressly provided in these terms, the rights and remedies provided under these terms are in addition to, and not exclusive of, any rights or remedies provided by law. 19. Severance 1. If any provision or part-provision of these terms is or becomes invalid, illegal, or unenforceable, it shall be deemed deleted, but that shall not affect the validity and enforceability of the rest of these terms. 2. If any provision or part-provision of these terms are deemed deleted under clause 19.1 the parties shall negotiate in good faith to agree a replacement provision that, to the greatest extent possible, achieves the intended commercial result of the original provision. 20. Entire agreement 1. These terms constitute the entire agreement between the parties and supersedes and extinguishes all previous and contemporaneous agreements, promises, assurances and understandings between them, whether written or oral, relating to its subject matter. 2. Each party acknowledges that in entering into these terms it does not rely on, and shall have no remedies in respect of, any statement, representation, assurance, or warranty (whether made innocently or negligently) that is not set out in these terms. 3. Each party agrees that it shall have no claim for innocent or negligent misrepresentation or negligent misstatement based on any statement in these terms. 4. Nothing in this clause shall limit or exclude any liability for fraud. 21. Assignment 1. The Customer shall not, without the prior written consent of Mailosaur, assign, novate, transfer, charge, sub-contract, or deal in any other manner with all or any of its rights or obligations under these terms. 2. Mailosaur may at any time assign, transfer, charge, sub-contract, or deal in any other manner with all or any of its rights or obligations under these terms. 22. No partnership or agency 1. Nothing in these terms is intended to or shall operate to create a partnership between the parties, or authorise either party to act as agent for the other, and neither party shall have the authority to act in the name or on behalf of or otherwise to bind the other in any way (including, but not limited to, the making of any representation or warranty, the assumption of any obligation or liability and the exercise of any right or power). 23. Third party rights 1. These terms do not confer any rights on any person or party (other than the parties to these terms and, where applicable, their successors and permitted assigns) pursuant to the Contracts (Rights of Third Parties) Act 1999. 24. Notices 1. Any notice given to a party under or in connection with these terms shall be in writing and shall be sent by email to the following addresses (or an address substituted in writing by the party to be served): 1. Mailosaur: [support@mailosaur.com](mailto:support@mailosaur.com) 2. Customer: the then current email address listed in the Customer Account. 2. Any notice shall be deemed to have been received at the time of transmission, or, if this time falls outside normal business hours (9am-5pm) in the place of receipt, when normal business hours resume. 3. This clause does not apply to the service of any proceedings or other documents in any legal action or, where applicable, any arbitration or other method of dispute resolution. 25. Governing law 1. These terms and any dispute or claim arising out of or in connection with it or its subject matter or formation (including non-contractual disputes or claims) shall be governed by and interpreted in accordance with the law of England and Wales. 26. Jurisdiction 1. Each party irrevocably agrees that the courts of England and Wales shall have exclusive jurisdiction to settle any dispute or claim arising out of or in connection with these terms or its subject matter or formation (including non-contractual disputes or claims). --- Source: https://mailosaur.com/legal/user-terms # User Terms **Effective: 1st November 2023** We are a company called **Mailosaur Ltd**, registered in England and Wales under company number 07999725 with our registered address at The Square, Basing View, Basingstoke, Hampshire RG21 4EB. Throughout these Customer Terms of Service (hereafter referred to as “terms”) we shall refer to ourselves as “Mailosaur”, “we”, “us” or “our”. By creating an account with us and using the Services, the User (hereafter referred to as “you”) agree to these User Terms. Agreed Terms 1. Definitions * **User Account:** collectively the personal information and Credentials used by a User to access the Services via the Website. * **Credentials:** the set of unique identifiers including but not limited to a username and password created via mailosaur.com or corporate login credentials where SSO is in use by the Customer that enables a User to verify identity in order to log in to their User Account. * **Customer:** the entity which has signed up to the Services offered by Mailosaur Ltd and has designated access to the Services for a User. * **Customer Data:** the data inputted by the Customer, Users, or Mailosaur on the Customer's behalf for the purpose of using the Services or facilitating the Customer's use of the Services. * **Services:** the services provided by Mailosaur to the Customer under the Customer Terms of Service. * **Website:** the website *mailosaur.com* or any other website notified to the Customer by Mailosaur from time to time by which a User accesses the Services. * **User:** any employees, agents and independent contractors of the Customer who are authorised by the Customer to use the Services. 2. Mailosaur Disclaimers 1. You acknowledge that we may update and change our terms and Website from time to time. We do not guarantee that our Website or Services will always be available or be uninterrupted. We may suspend or withdraw or restrict the availability of all or any part of our Website or Services for business and operational reasons. 3. Other terms that may apply to you 1. These terms refer to the following additional terms, which may also apply to your use of our Website and Services: * Our Privacy Policy which sets out how we process personal data. * Our Customer Terms of Service which apply to the corporate subscriber who purchases our Services and which include various obligations for any User appointed by it. 4. Prohibited Acts 1. You shall not: 1. access, store, upload, distribute any material or any Customer Data during the course of using the Website or Services that: * is harmful, threatening, defamatory, obscene, infringing, harassing or racially or ethnically offensive; * is unlawful under any relevant law, regulation or other applicable instrument in their particular jurisdiction or the United Kingdom; * facilitates illegal activity; * depicts sexually explicit images; * promotes unlawful violence; * is discriminatory based on race, gender, colour, religious belief, sexual orientation, disability; or * is otherwise illegal or causes damage or injury to any person or property; and we reserve the right, without liability to you, to disable your access to any material that breaches these terms. 2. transmit any viruses; 3. attempt to copy, modify, duplicate, create derivative works from, frame, mirror, republish, download, display, transmit, or distribute all or any portion of the Website or Services in any form or media or by any means; 4. attempt to de-compile, reverse compile, disassemble, reverse engineer, or otherwise reduce to human-perceivable form all or any part of the Website or Services; 5. impersonate any other person, including but not limited to employees and representatives of Mailosaur or Mailosaur’s affiliates; 6. use the Services or Documentation to create software programs that are similar to or compete with Mailosaur's services, or to repackage or present the Services or Documentation as the Customer’s own software solution; 7. use the Services for unauthorised mass-communication such as spam or junk mail communications; 8. introduce, or permit the introduction of, any virus into Mailosaur’s network, Website, and system; or 9. conduct, facilitate, authorise, or permit any text or data mining or web scraping in relation to our Website or Services. 5. User Account Responsibilities 1. The User shall use all reasonable endeavours to prevent any unauthorised access to, or use of, the Website or Services and, in the event of any such unauthorised access or use, promptly notify Mailosaur. 2. You must treat your login and password information for your User Account as confidential and must not disclose it to any third party. 3. We have the right to disable any User Account password, whether chosen by you or allocated by us, at any time, if in our reasonable opinion you have failed to comply with any of the provisions of these terms. 4. If you know or suspect that anyone other than you knows your User Account Credentials information, you must promptly notify us at [support@mailosaur.com](mailto:support@mailosaur.com). 6. Third Party Links 1. Where our Website and Services contain links to other sites and resources provided by third parties, these links are provided for your information only. We are not responsible for such third party links or information you may obtain from them. 7. Rights you are giving us to use material you upload 1. When you upload Customer Data, you grant us a worldwide, non-exclusive, royalty-free, transferable licence to use, reproduce, distribute, prepare derivative works of, display, and perform that Customer Data in connection with the provision of our Services and across different media, including to promote our Services. 8. Our liability for loss or damage suffered by you 1. We do not exclude or limit in any way our liability to you where it would be unlawful to do so. We exclude all implied conditions, warranties, representations, or other terms that may apply to our Services, Website, or any content on it. 2. We will not be liable to you for any loss or damage, whether in contract, tort (including negligence), breach of statutory duty, or otherwise, even if foreseeable, arising under or in connection with: 1. use of, or inability to use, our site; or 2. use of or reliance on any content displayed on our site. 3. In particular, we will not be liable for: * loss of profits, sales, business, or revenue; * business interruption; * loss of anticipated savings; * loss of business opportunity, goodwill, or reputation; or * any indirect or consequential loss or damage. 9. How we may use your personal information 1. We will only use your personal information as set out in our [Privacy Policy](/legal/privacy). 10. Our intellectual property 1. You are not permitted to use any trade marks of Mailosaur Ltd without our prior written approval. We are the owner or the licensee of all intellectual property rights in our Website and Services (including the material published within). All such rights are reserved. 11. Breach of these terms 1. When we consider that a breach of these terms has occurred, we may take such action as we deem appropriate (in our absolute discretion). 2. Failure to comply with these terms may result in actions including but not limited to: * Immediate, temporary, or permanent withdrawal of your right to use our Website and/or Services. * Immediate, temporary, or permanent removal of any Customer Data uploaded by you to our Website and/or Services. * Issue of a warning to you. * Legal proceedings against you resulting from the breach. * Disclosure of such information to law enforcement authorities as we reasonably feel is necessary or as required by law. 12. Which country's laws apply to any disputes? 1. These terms, their subject matter, and their formation, are governed by the laws of England and Wales. The courts of England and Wales have exclusive jurisdiction to settle any dispute or claim arising out of or in connection with these terms or their subject matter or formation (including non-contractual disputes or claims). --- Source: https://mailosaur.com/newsletter # Subscribe to our newsletter Receive tips, ideas, and best practices from our testing and engineering experts --- Source: https://mailosaur.com/topics/cypress # Cypress Discover Cypress for end-to-end testing. Automate browser interactions, handle dynamic elements, and validate complex user flows with ease. Designed for QA testers who need speed, reliability, and precision in their test automation. ## Featured ### [Testing Password Resets with Cypress](/blog/testing-password-resets-with-cypress) Any website relying on accounts has had to deal with users needing a password reset. This critical step in account recovery has to be thoroughly tested to ensure it works properly, and to prevent it from becoming a security vulnerability ### [Top Email Testing Scenarios with Cypress ](/blog/top-email-testing-scenarios-with-cypress) Blog · Mailosaur · August 12, 2024 · 6 minutes Cypress is a powerful tool for email testing scenarios. Its versatility and flexibility make it easy to create custom tests for many different types of emails, including account verification emails, password reset systems, and more. ### [Mailosaur and Cypress - Quickstart guide](/docs/automation/cypress/quickstart) Documentation Get Mailosaur up and running within your Cypress project in a few steps ### [Malwarebytes](/customers/malwarebytes) Customer story Providing them with the essential tools to automate and perform high volumes of email testing daily. ## Blogs ### [Cypress vs Selenium: Which testing framework is better?](/blog/cypress-vs-selenium-which-testing-framework-is-better) Blog · Mailosaur · August 21, 2024 · 6 minutes Cypress and Selenium are popular open-source testing frameworks. Here is a comparison of Cypress vs. Selenium to help you determine which one is right for you. ### [Cypress vs Playwright: Which is Right for You?](/blog/cypress-vs-playwright-which-is-right-for-you) Blog · Mailosaur · July 18, 2024 · 6 minutes If you’re at all familiar with testing for web applications and processes, you’ve probably heard of both Cypress and Playwright – two common and versatile tools for developing and automating testing. ### [Testing Account Verification with Cypress](/blog/testing-account-verification-with-cypress) Blog · Mailosaur · July 9, 2024 · 6 minutes Account verification is an important step for increasing security and efficiency across your organization, but without rigorous testing it can introduce more problems than it solves. ### [Getting started with Cypress](/blog/getting-started-with-cypress) Blog · Mailosaur · May 12, 2021 · 5 minutes Cypress is an end-to-end testing framework that has won over developers and testers for its ease of use and flexibility. In this guide, we walk you through the Cypress installation process, before showing you how to create and run your first Cypress test. ### [What is Cypress?](/blog/what-is-cypress) Blog · Mailosaur · March 20, 2021 · 6 minutes Cypress is a framework for the automated testing of browser-based applications. You can use Mailosaur to test email and SMS with Cypress. --- Source: https://mailosaur.com/topics/playwright # Playwright Discover Playwright for end-to-end testing. Automate browser interactions, handle dynamic elements, and validate complex user flows with ease. Designed for QA testers who need speed, reliability, and precision in their test workflows. ## Featured ### [How to test login functionality using OTP codes with Playwright ](/blog/testing-otp-playwright) Broken or unreliable login systems can lead to frustrating user experiences, potential security vulnerabilities, and lost trust. ### [Automate email verification testing in Playwright (links + OTPs)](/blog/playwright-email-verification) Blog · Mailosaur · January 26, 2026 · 4 minutes Test email verification flows, including magic links and OTPs quickly and easily with Playwright ### [Mailosaur and Playwright - Quickstart guide](/docs/automation/playwright/quickstart) Documentation Get Mailosaur up and running within your Playwright project in a few steps ### [Domino's Pizza](/customers/dominos) Customer story Explore how Domino's Pizza optimized their testing processes by integrating Mailosaur, a game-changing tool that enhanced efficiency in their email and SMS testing. ## Blogs ### [Tutorial: two-factor authentication testing with Playwright and Mailosaur](/blog/automate-2fa-mfa-testing-playwright) Blog · Mailosaur · October 22, 2025 · 7 minutes An in-depth guide showing you how to test two-factor authentication with Playwright and Mailosaur. ### [How to use Playwright for testing email edge cases](/blog/playwright-email-edge-cases) Blog · Mailosaur · November 21, 2024 · 3 minutes Test invalid email addresses, navigate junk handlers, and optimize your communication flow using Playwright. ### [Cypress vs Playwright: Which is Right for You?](/blog/cypress-vs-playwright-which-is-right-for-you) Blog · Mailosaur · July 18, 2024 · 6 minutes If you’re at all familiar with testing for web applications and processes, you’ve probably heard of both Cypress and Playwright – two common and versatile tools for developing and automating testing. ### [Getting started with Playwright](/blog/getting-started-with-playwright) Blog · Mailosaur · September 21, 2021 · 6 minutes This article takes a look at Playwright, Microsoft’s new test automation framework, and compares it to some of the other major frameworks. Read on to discover how Playwright holds up against veteran frameworks and when it makes the most sense to use. --- Source: https://mailosaur.com/topics/selenium # Selenium Selenium is a widely-used tool for automating web application testing. Run tests across multiple browsers and platforms, ensuring consistent functionality and performance. Ideal for QA testers focused on efficient and reliable web testing. ## Featured ### [How to automate password reset tests with Selenium](/blog/selenium-password-reset-testing) Bring an end to broken password resets driving away users. ### [How to test order confirmation notifications with Selenium ](/blog/order-confirmation-testing-with-selenium) Blog · Mailosaur · October 18, 2024 · 6 minutes Catch mistakes early by automating the testing of order-to-delivery notification process using Selenium . ### [Using Mailosaur with Selenium](/docs/automation/selenium) Documentation All the guides you need to make the most of your Mailosaur subscription ### [OakNorth](/customers/oaknorth) Customer story Where reliable communication channels are pivotal for account authentication and transaction alerts, driving the imperative need for robust testing solutions. ## Blogs ### [How Selenium 4.40 improves end-to-end email verification testing](/blog/selenium-update) Blog · Mailosaur · January 20, 2026 · 4 minutes What's changed in Selenium 4.40 and how will it benefit you when testing email verification flows? ### [How to automate email verification with Selenium](/blog/selenium-email-verification) Blog · Mailosaur · October 1, 2025 · 3 minutes Stop people being blocked out of accounts new and old. ### [Reliably automating two-factor authentication testing with Selenium](/blog/automating-2fa-testing-selenium) Blog · Mailosaur · September 10, 2025 · 4 minutes Ensure one-time passwords work as intended. ### [Selenium’s 20th birthday present to itself](/blog/selenium-20th-anniversary) Blog · Mailosaur · November 6, 2024 · 2 minutes Version 4.26.0 arrives to celebrate 20 years of the ground-breaking automation platform. ### [How to test links and codes for Black Friday deals with Selenium](/blog/test-black-friday-deals-selenium) Blog · Mailosaur · October 22, 2024 · 6 minutes Practical steps for QA testers to test promotions and discounts via email and SMS. ### [Cypress vs Selenium: Which testing framework is better?](/blog/cypress-vs-selenium-which-testing-framework-is-better) Blog · Mailosaur · August 21, 2024 · 6 minutes Cypress and Selenium are popular open-source testing frameworks. Here is a comparison of Cypress vs. Selenium to help you determine which one is right for you. ## Customer stories ### [P97](/customers/p97) Customer story Product managers at P97 use Mailosaur to automate their email testing and drive exceptional user engagement. ### [Coupa](/customers/coupa) Customer story With Mailosaur, Coupa has found their ideal solution to capture and analyze emails automatically, and improving their email security.