// Setup the API clientMailosaurClientmailosaur=newMailosaurClient("API_KEY");
MessageSearchParamsparams=newMessageSearchParams();
params.withServer("SERVER_ID");
SearchCriteriasearchCriteria=newSearchCriteria();
searchCriteria.withSentTo("my-test@SERVER_ID.mailosaur.net");
// Search for the messageMessagemessage= mailosaur.messages().get(params, searchCriteria);
// Perform test assertions
assertEquals("Support", message.from().get(0).name());
assertEquals("noreply@acme.com", message.from().get(0).email());
# 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 assertionsself.assertEqual("Support", message.sender[0].name)
self.assertEqual("noreply@acme.com", message.sender[0].email)
// Setup the API clientvar mailosaur = new MailosaurClient("API_KEY");
var criteria = new SearchCriteria() {
SentTo = "my-test@SERVER_ID.mailosaur.net"
};
// Search for the messagevar 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);
# 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)
// Setup the API clientconstMailosaurClient = require("mailosaur");
const mailosaur = newMailosaurClient("API_KEY");
// Search for the messageconst message = await mailosaur.messages.get("SERVER_ID", {
sentTo: "my-test@SERVER_ID.mailosaur.net",
});
// Perform test assertionsexpect(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 the box.
You don't need to create email addresses before using item, they just work! However, if you need help thinking of a unique email address, you can use this helper method:
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.
// Search for the messageconst 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. To look back further in your message history, If you want to look further back than this, just set the 'received after' parameter.
// Calculate a timestamp for yesterdayCalendarcalendar= Calendar.getInstance();
calendar.add(Calendar.DAY_OF_YEAR, -1);
longyesterday= calendar.getTimeInMillis();
// Use this timestamp in the searchMessageSearchParamsparams=newMessageSearchParams();
params.withServer("SERVER_ID");
params.withReceivedAfter(yesterday);
SearchCriteriasearchCriteria=newSearchCriteria();
searchCriteria.withSentTo("test123@SERVER_ID.mailosaur.net");
Messagemessage= mailosaur.messages().get(params, searchCriteria);
# 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)
// Calculate a datetime for yesterdayvar yesterday = DateTime.Today.AddDays(-1);
var criteria = new SearchCriteria() {
SentTo = "test123@SERVER_ID.mailosaur.net"
};
// Use this timestamp in the searchvar message = mailosaur.Messages.Get("SERVER_ID", criteria, receivedAfter: yesterday);
# 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)
// Calculate a datetime for yesterdayconst yesterday = newDate(Date.now() - 24 * 60 * 60 * 1000);
// Use this timestamp in the searchconst 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 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
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(). Instead, we recommend using the messages.get() 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.
// List the most recent messagesMessageListParamsparams=newMessageListParams();
params.withServer("SERVER_ID");
MessageListResultresult= mailosaur.messages().list(params);
// Get the most recent message (the first one in the list)MessageSummarylatestMessage= result.items().get(0);
// Get the full message objectMessagemessage= mailosaur.messages().getById(latestMessage.id());
System.out.println(message.html().body());
# 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)
// List the most recent messagesvar 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 objectvar message = mailosaur.Messages.GetById(latestMessage.Id);
Console.WriteLine(message.Html.Body);
# 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)
// List the most recent messagesconst 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 objectconst message = await mailosaur.messages.getById(latestMessage.id);
console.log(message.html.body);
Searching for multiple messages
Identify if multiple messages meet the same criteria.
// Search for all messages sent to someone@SERVER_ID.mailosaur.net.SearchCriteriacriteria=newSearchCriteria();
criteria.withSentTo("someone@SERVER_ID.mailosaur.net");
// Limit results to the first 10 matches only.MessageSearchParamsparams=newMessageSearchParams();
params.withServer("SERVER_ID")
.withPage(0)
.withItemsPerPage(10);
MessageListResultresult= mailosaur.messages().search(params, criteria);
// Get the most recent message (the first one in the list)MessageSummarylatestMessage= result.items().get(0);
// Get the full message objectMessagemessage= mailosaur.messages().getById(latestMessage.id());
System.out.println(message.html().body());
# 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)
// 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 objectvar message = mailosaur.Messages.GetById(latestMessage.Id);
Console.WriteLine(message.Html.Body);
# 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)
// 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 objectconst 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:
// 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());
# Test the email subject lineself.assertEqual("Password reset", message.subject)
# Test sender informationself.assertEqual("Support", message.sender[0].name)
self.assertEqual("noreply@acme.com", message.sender[0].email)
# Test recipient informationself.assertEqual("John Smith", message.to[0].name)
self.assertEqual("john@SERVER.mailosaur.net", message.to[0].email)
// 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);
# 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)
// Test the email subject lineexpect(message.subject).toBe("Password reset");
// Test sender informationexpect(message.from[0].name).toBe("Support");
expect(message.from[0].email).toBe("noreply@acme.com");
// Test recipient informationexpect(message.from[0].name).toBe("John Smith");
expect(message.from[0].email).toBe("john@SERVER.mailosaur.net");
Most emails will contain separate HTML and plain text content. You can see below how to test either content type:
Plain text content
// Check that the email contains some text
System.out.println(message.text().body()); // "Hi Jason, ..."
# Check that the email contains some textprint(message.text.body) # "Hi Jason, ..."
// Check that the email contains some text
Console.WriteLine(message.Text.Body); // "Hi Jason, ..."
# Check that the email contains some text
puts(message.text.body) # "Hi Jason, ..."
// Check that the email contains some textconsole.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:
// Check that raw HTML contains some expected content
System.out.println(message.html().body()); // "<span>Hello world</span>"
# Check that raw HTML contains some expected contentprint(message.html.body) # "<span>Hello world</span>"
// Check that raw HTML contains some expected content
Console.WriteLine(message.Html.Body); // "<span>Hello world</span>"
# Check that raw HTML contains some expected content
puts(message.html.body) # "<span>Hello world</span>"
// Check that raw HTML contains some expected contentconsole.log(message.html.body); // "<span>Hello world</span>"
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:
// Working with links in HTML contentLinklinkInHtml= message.html().links().get(0);
assertEquals("Google Search", linkInHtml.text());
assertEquals("https://www.google.com/", linkInHtml.href());
// Working with links in plain text contentLinklinkInPlainText= message.text().links().get(0);
assertEquals("https://www.google.com/", linkInPlainText.href());
# 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)
// Working with links in HTML contentvar 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 contentvar linkInPlainText = message.Text.Links[0];
Assert.Equal("https://www.google.com/", linkInPlainText.Href);
# 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)
// Working with links in HTML contentconst 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 contentconst 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:
Stringhref= message.html().links().get(0).href();
// Make an HTTP call to simulate someone clicking a linkvarclient= HttpClient.newHttpClient();
varrequest= HttpRequest.newBuilder(URI.create(href)).build();
varresponse= client.send(request, null);
System.out.println(response.statusCode()); // 200
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
var href = message.Html.Links[0].Href;
// Make an HTTP call to simulate someone clicking a linkusing (var client = new HttpClient()) {
var result = await client.GetAsync(href);
Console.WriteLine(result.StatusCode); // 200
}
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) # 200end
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:
// Working with codes in HTML contentLinkcodeInHtml= message.html().codes().get(0);
assertEquals("456812", codeInHtml.value());
// Working with codes in plain text contentLinkcodeInText= message.text().codes().get(0);
assertEquals("456812", codeInText.value());
# 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)
// Working with codes in HTML contentvar codeInHtml = message.Html.Codes[0];
Assert.Equal("456812", codeInHtml.Value);
// Working with codes in plain text contentvar codeInText = message.Text.Codes[0];
Assert.Equal("456812", codeInText.Value);
# 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)
// Working with codes in HTML contentconst codeInHtml = message.html.codes[0];
expect(codeInHtml.value).toBe("456812");
// Working with codes in plain text contentconst codeInText = message.text.codes[0];
expect(codeInText.value).toBe("456812");
Testing attachments
Any email attachments are made available via the attachments array:
// Number of attachments found
System.out.println(message.attachments().size()); // 2// Get the first attachmentAttachmentattachment= message.attachments().get(0);
// Check attachment attributes
assertEquals("example.pdf", attachment.fileName());
assertEquals("application/pdf", attachment.contentType());
assertEquals(4028, attachment.length());
# Number of attachments foundprint(len(message.attachments)) # 2# Get the first attachment
attachment = message.attachments[0]
# Check attachment attributesself.assertEqual("example.pdf", attachment.file_name)
self.assertEqual("application/pdf", attachment.content_type)
self.assertEqual(4028, attachment.length)
// Number of attachments found
Console.WriteLine(message.Attachments.Count);
// Get the first attachmentvar attachment = message.Attachments[0];
// Check attachment attributes
Assert.Equal("example.pdf", attachment.FileName);
Assert.Equal("application/pdf", attachment.ContentType);
Assert.Equal(4028, attachment.Length);
# 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)
// Number of attachments foundconsole.log(message.attachments.length); // 2// Get the first attachmentconst attachment = message.attachments[0];
// Check attachment attributesexpect(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:
Any images found within the HTML content of an email are made available via the html.images array:
// Number of images found
System.out.println(message.html().images().size());
// Get the first imagevarimage= message.html().images().get(0);
// Check image attributes
assertEquals("https://example.com/balloon.png", image.src());
assertEquals("A hot air balloon", image.alt());
# Number of images foundprint(len(message.html.images))
# Get the first image
image = message.html.images[0]
# Check image attributesself.assertEqual("https://example.com/balloon.png", image.src)
self.assertEqual("A hot air balloon", image.alt)
// Number of images found
Console.WriteLine(message.Html.Images.Count);
// Get the first imagevar 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)
# 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)
// Number of images foundconsole.log(message.html.images.length);
// Get the first imageconst image = message.html.images[0];
// Check image attributesexpect(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 is working as expected, you can simply perform an HTTP request:
// Make an HTTP call to trigger the web beaconvarclient= HttpClient.newHttpClient();
varrequest= HttpRequest.newBuilder(URI.create(image.src())).build();
varresponse= client.send(request, null);
System.out.println(response.statusCode()); // 200
import requests
# ...# Make an HTTP call to trigger the web beacon
response = requests.get(image.src)
print(response.status_code) # 200
// Make an HTTP call to trigger the web beaconusing (var client = new HttpClient()) {
var result = await client.GetAsync(image.Src);
Console.WriteLine(result.StatusCode); // 200
}
# 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) # 200end
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:
CodeMessageCreateOptionsoptions=newMessageCreateOptions();
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);
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)
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
}
);
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)
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:
Attachmentattachment=newAttachment();
attachment.withFileName("cat.png");
attachment.withContent("{BASE64_ENCODED_FILE}");
attachment.withContentType("image/png");
CodeMessageCreateOptionsoptions=newMessageCreateOptions();
options.withTo("verified-address@example.com")
.withSend(true)
.withSubject("Request")
.withText("Please can you give us a call back?")
.withAttachments(Arrays.asList(newAttachment[] { attachment }));
mailosaur.messages().create("SERVER_ID", options);
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)
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>() { attachment },
Send = true
}
);
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)
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 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:
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, so you can send email to it:
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:
mailosaur.messages().delete("MESSAGE_ID");
mailosaur.messages.delete("MESSAGE_ID")
mailosaur.Messages.Delete("MESSAGE_ID");
mailosaur.messages.delete("MESSAGE_ID")
await mailosaur.messages.del("MESSAGE_ID");
Delete all messages
Permanently deletes all messages held in the specified server/inbox. Also deletes any attachments related to each message. This operation cannot be undone: