{"id":18990802,"url":"https://github.com/mailslurp/mailslurp-client","last_synced_at":"2025-05-12T14:59:02.072Z","repository":{"id":34245995,"uuid":"171124057","full_name":"mailslurp/mailslurp-client","owner":"mailslurp","description":"Official MailSlurp Client","archived":false,"fork":false,"pushed_at":"2025-05-11T21:49:17.000Z","size":19067,"stargazers_count":47,"open_issues_count":1,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-11T21:51:57.288Z","etag":null,"topics":["email","javascript","sms","testing","typescript"],"latest_commit_sha":null,"homepage":"https://www.mailslurp.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mailslurp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-02-17T13:16:16.000Z","updated_at":"2025-05-11T21:49:24.000Z","dependencies_parsed_at":"2024-04-15T01:49:32.772Z","dependency_job_id":null,"html_url":"https://github.com/mailslurp/mailslurp-client","commit_stats":{"total_commits":246,"total_committers":9,"mean_commits":"27.333333333333332","dds":0.6422764227642277,"last_synced_commit":"6fa755bcd43973caa3a05924c8f7a51d3f4b21e2"},"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailslurp%2Fmailslurp-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailslurp%2Fmailslurp-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailslurp%2Fmailslurp-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailslurp%2Fmailslurp-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mailslurp","download_url":"https://codeload.github.com/mailslurp/mailslurp-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253761013,"owners_count":21960052,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["email","javascript","sms","testing","typescript"],"created_at":"2024-11-08T17:11:32.401Z","updated_at":"2025-05-12T14:59:02.030Z","avatar_url":"https://github.com/mailslurp.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MailSlurp Javascript Client\n\nCreate real email addresses on demand. Send and receive emails and attachments from code and tests using Javascript or Typescript. Use real phone numbers to process inbound TXT messages.\n\n[MailSlurp](https://www.mailslurp.com) is an email and SMS [API](https://docs.mailslurp.com/js/) service that lets you create real email addresses in code. You can then send and receive emails and attachments in Javascript applications and tests. You can also [create phone numbers](/) and fetch inbound SMS. \n\nMailSlurp is free for personal use but requires an [API KEY](https://app.mailslurp.com). Please see the [getting started guide](https://www.mailslurp.com/guides/getting-started/) for an introduction on key MailSlurp concepts or continue reading. \n\n## Tutorial\n\n[![NodeJS mailslurp tutorial](https://www.mailslurp.com/video-thumbnails/node-mailslurp-still.jpg)](https://youtu.be/V3kmUe9eeic)\n\n## Quick start\nInstall with npm `npm install --save mailslurp-client` or `yarn add mailslurp-client`\n\n```javascript\n// import mailslurp-client\nconst MailSlurp = require('mailslurp-client').default;\n// OR import { MailSlurp } from \"mailslurp-client\"\n\n// create a client\nconst apiKey = process.env.API_KEY ?? 'your-api-key';\nconst mailslurp = new MailSlurp({ apiKey });\n\n// create an inbox\nconst inbox = await mailslurp.inboxController.createInbox({});\nexpect(inbox.emailAddress).toContain('@mailslurp');\n```\n\nMore usage examples are included below.\n\n## Links\nHere are some links to get started (or see below for code examples).\n\n- [Main class methods](https://mailslurp.github.io/mailslurp-client/classes/MailSlurp.html)\n- [Method Documentation](https://mailslurp.github.io/mailslurp-client/index.html)\n- [NPM Package](https://www.npmjs.com/package/mailslurp-client)\n- [REST API Docs](https://docs.mailslurp.com/api/)\n- [GraphQL Client](https://www.mailslurp.com/guides/graphql-email-api)\n- [Github Source](https://github.com/mailslurp/mailslurp-client)\n\n## Get started\n\nThis section describes how to get up and running with the Javascript client.\n\nSee the [guides page](https://www.mailslurp.com/guides/) for more examples and use with common frameworks. For use with CypressJS see the official [Cypress MailSlurp plugin](https://www.npmjs.com/package/cypress-mailslurp).\n\nSee the method documentation for a [list of all functions](https://mailslurp.github.io/mailslurp-client/index.html). \n\n\u003e See the `test/integration.spec.ts` in this package for usage examples of this client.\n\n### Create API Key\n\nFirst you'll need an API Key. [Create a free account](https://app.mailslurp.com) and copy the key from your dashboard.\n\n### Install NPM dependency\n\nInstall MailSlurp using NPM (NodeJS) or by including the [source code](https://github.com/mailslurp/mailslurp-client) in your project.\n\n```bash\nnpm install --save mailslurp-client\n```\n\n## Using in code\nHere is how to use MailSlurp in your project.\n\n### Import MailSlurp library\n```javascript\nconst MailSlurp = require(\"mailslurp-client\").default;\n// or\nimport { MailSlurp } from \"mailslurp-client\";\n```\n\n### Instantiate a MailSlurp client\n\nCreate a MailSlurp instance by instantiating a class with [your API Key](https://app.mailslurp.com).\n\n```javascript\nconst mailslurp = new MailSlurp({ apiKey: \"your_api_key\" });\n```\n\n\n#### Timeouts\nMailSlurp API endpoints are built to hold a connection open if the query is told to wait for certain conditions - like a new email arriving. For this reason it is important to use appropriate timeouts in tests or when settings up a fetch client.\n\n\u003e MailSlurp recommends a 60_000 ms timeout to ensure emails arrive consistently. SMTP is a slow protocol so you may need to allow time for emails to arrive.\n\n\n#### Fetch settings\nMailSlurp is built on Javascript `fetch`. If you want to override the default `fetch` client you can do so when configuring MailSlurp.\n\n```typescript\nconst { MailSlurp } = require('mailslurp-client');\nconst crossFetch = require('cross-fetch');\nconst mailslurp = new MailSlurp({\n  fetchApi: crossFetch,\n  apiKey: apiKey,\n});\n```\n\n#### Fetch handling exceptions\nAny method that returns non-2xx response throws an exception by default (unless you use methods with the `Raw` suffix). There are valid 404 responses that you should handle, these include the 408 returned from `waitFor` methods when the required matching emails could not be found.\n\n- `4xx` (400, 404...) response codes indicate a client error. Access the error message on the response body\n- `5xx` (500, 501...) response codes indicate a server error. If encountered please contact support.\n\n```typescript\ntry {\n  await mailslurp.waitController.waitForLatestEmail({\n    inboxId: inboxId,\n    timeout: timeout,\n    unreadOnly: true,\n  });\n} catch (e) {\n  // handle the error and status code in your code\n  const statusCode = e.status;\n  const errorMessage = await e.text();\n\n  expect(errorMessage).toContain('Failed to satisfy email query for inbox');\n  expect(statusCode).toEqual(408);\n}\n```\n\n#### Fetch without exceptions (using ApiResponse)\nIf you prefer not to use `try/catch` you can use methods with the `Raw` suffix. These methods return an `ApiResponse\u003cT\u003e` that includes a status and result instead of throwing exceptions.\n\n```typescript\n// use methods with `Raw` suffix to access a wrapped response\n// that contains the status instead of throwing an exception\nconst inboxRaw: ApiResponse\u003cInboxDto\u003e =\n  await mailslurp.inboxController.createInboxRaw({});\nexpect(inboxRaw.raw.ok).toBeTruthy();\nconst inbox = await inboxRaw.value();\nexpect(inbox.id).toBeTruthy();\n```\n\n### API Controllers\nNote the `MailSlurp` object is a class with many common methods. It does not contain all MailSlurp API methods. **The full API is available as individually exported controllers**.\n\nSee the [MailSlurp class documentation](https://mailslurp.github.io/mailslurp-client/classes/MailSlurp.html) for all methods or\nsee the `test/integration.spec.ts` file for usage examples. You can also instantiate controllers directly. See the [API controllers](https://mailslurp.github.io/mailslurp-client/index.html) for method details.\n\n```javascript\n// controllers are available on a MailSlurp instance\nconst { MailSlurp } = require('mailslurp-client');\nconst mailslurp = new MailSlurp({ apiKey });\nawait mailslurp.inboxController.createInbox({});\n// or by import controllers and instantiating with a configuration\nconst { InboxControllerApi } = require('mailslurp-client');\nconst inboxController = new InboxControllerApi(new Configuration({ apiKey }));\nawait inboxController.createInbox({});\n```\n\n## Email usage examples\n\nHere are some snippets of common usage.\n\n### Create an email address\nMailSlurp inboxes have real email addresses. There are several ways to create them. See the docs for full [inbox object reference](https://mailslurp.github.io/mailslurp-client/interfaces/InboxDto.html).\nInboxes can be either `SMTP` or `HTTP` type mailboxes. `HTTP` inboxes are powered by AWS SES and are great for most use cases. `SMTP` inboxes use a custom mail server running at `mx.mailslurp.com` to support older email clients. `SMTP` inboxes are more suitable for public facing usage.\n\n#### Simple usage\nYou can create an inbox with a randomly assigned email address ending in `@mailslurp.com` like so:\n\n```javascript\nconst inbox = await mailslurp.createInbox();\n// { id: '123', emailAddress: '123@mailslurp.com' }\n```\n\n#### Create inbox options\nUse the `createInboxWithOptions` or methods on the `inboxController` property to create email addresses using more options.\n\n```javascript\nawait mailslurp.inboxController.createInbox({});\n```\n\n\u003e To use custom domains see the [domain verification guide](https://www.mailslurp.com/guides/custom-domains/)\n\n### Get an inbox\nInboxes have real email addresses. See the [inbox reference](https://mailslurp.github.io/mailslurp-client/interfaces/InboxDto.html) for all properties.\n\n```javascript\nconst mailslurp = new MailSlurp(config);\nconst { id: inboxId } = await mailslurp.createInbox();\nconst inbox = await mailslurp.getInbox(inboxId);\nexpect(inbox.id).toEqual(inboxId);\n```\n\n### Access mailbox and emails using SMTP client\nYou can access SMTP_INBOX type inboxes using an SMTP client like nodemailer. First create an inbox then call the `getImapSmtpAccessDetails` function to obtain SMTP username and password:\n\n```javascript\nconst {MailSlurp} = require('mailslurp-client');\nconst nodemailer = require(\"nodemailer\");\nconst apiKey = process.env.API_KEY;\nconst mailslurp = new MailSlurp({ apiKey });\n\n// get access details for smpt server\nconst server = await mailslurp.getImapSmtpAccessDetails();\n\n// use details to configure SMTP client like NodeMailer\nconst opts = {\n    host: server.smtpServerHost,\n    port: server.smtpServerPort,\n    secure: false, // Disable tls recommended\n    auth: {\n        user: server.smtpUsername,\n        pass: server.smtpPassword,\n        type: \"PLAIN\" // Note the use of PLAIN AUTH\n    },\n}\nconst transport = nodemailer.createTransport(opts)\n```\n\n### List inboxes\nInbox lists are paginated and sortable. List methods return a projection of an inbox. See the [inbox projection reference](https://mailslurp.github.io/mailslurp-client/interfaces/InboxPreview.html) for properties.\n\n```javascript\nconst mailslurp = new MailSlurp(config);\n\n// get paginated inboxes\nconst [index, size] = [0, 20];\nconst pageInboxes = await mailslurp.getAllInboxes(0, 20);\n\nexpect(pageInboxes.size).toEqual(size);\nexpect(pageInboxes.number).toEqual(index);\n```\n\n### Fetch emails from inbox\nTo read emails that already exist in an inbox use the [EmailController](https://mailslurp.github.io/mailslurp-client/classes/EmailControllerApi.html) `getEmail` method. To wait for expected emails that may not have arrived yet use the [WaitForController](https://mailslurp.github.io/mailslurp-client/classes/WaitForControllerApi.html).\n\nThere are many ways to receive and fetch emails in MailSlurp. Emails have many properties including body, subject, attachments and more. See the API docs for [full email reference](https://mailslurp.github.io/mailslurp-client/interfaces/Email.html).\n\n```javascript\nconst inbox = await mailslurp.createInbox();\nawait mailslurp.sendEmail(inbox.id, {\n  to: [inbox.emailAddress],\n  subject: 'test',\n});\n\n// wait for first email\nconst latestEmail = await mailslurp.waitForLatestEmail(inbox.id, timeoutMs);\nexpect(latestEmail.subject).toContain('test');\n\n// send another\nawait mailslurp.sendEmail(inbox.id, {\n  to: [inbox.emailAddress],\n  subject: 'second',\n});\n\n// wait for second using controller instead\nconst secondEmail = await mailslurp.waitController.waitForLatestEmail({\n  inboxId: inbox.id,\n  unreadOnly: true,\n});\nexpect(secondEmail.subject).toContain('second');\n\nconst allEmails = await mailslurp.getEmails(inbox.id);\nexpect(allEmails).toHaveLength(2);\n```\n\nFor more fetching methods see the [WaitForController](https://mailslurp.github.io/mailslurp-client/classes/WaitForControllerApi.html) and the [EmailController](https://mailslurp.github.io/mailslurp-client/classes/EmailControllerApi.html)\n\n### Send emails\nTo send emails use the [SendEmailOptions](https://mailslurp.github.io/mailslurp-client/interfaces/SendEmailOptions.html) arguments with the [InboxController](https://mailslurp.github.io/mailslurp-client/classes/InboxControllerApi.html) or MailSlurp [instance methods](https://mailslurp.github.io/mailslurp-client/classes/MailSlurp.html).\n\n```typescript\nconst inbox = await mailslurp.createInbox();\nconst options = {\n  to: [emailAddress],\n  subject: 'Hello',\n  body: 'Welcome',\n};\nconst sent = await mailslurp.sendEmail(inbox.id, options);\nexpect(sent.subject).toContain('Hello');\n```\n\n#### Sending with queues\nIf your plan permits you can send emails using a queue. This allows you to safely recover emails that failed to send and retry them. Use queue to ensure that emails are always delivered regardless of your account status, bounce limit, or payment failures.\n```typescript\nawait mailslurp.inboxController.sendEmailWithQueue({\n  inboxId: inboxId,\n  sendEmailOptions: {\n    to: [recipient],\n    subject: 'Sent with a queue',\n    body:\n      'Use queues to allow recovery of failed email ' +\n      'sending when account reaches limits or has payment issues',\n  },\n  // validate before adding to queue to fail early\n  validateBeforeEnqueue: false,\n});\n```\n\n### Verify email addresses\nValidate an email address to find out if it exists and can receive email. This can help reduce your bounce rate and improve your sending reputation.\n\n```javascript\nconst mailslurp = new MailSlurp(config);\nconst res =\n  await mailslurp.emailVerificationController.validateEmailAddressList({\n    validateEmailAddressListOptions: {\n      emailAddressList: ['contact@mailslurp.dev', 'bad@mailslurp.dev'],\n    },\n  });\nexpect(res.resultMapEmailAddressIsValid['contact@mailslurp.dev']).toEqual(\n  true\n);\nexpect(res.resultMapEmailAddressIsValid['bad@mailslurp.dev']).toEqual(\n  false\n);\n```\n\n### Upload attachment\nUpload attachment using the [AttachmentController](https://mailslurp.github.io/mailslurp-client/classes/AttachmentControllerApi.html).\n\nAttachments can be uploaded as base64 strings. The ids returned can be used with `SendEmailOptions` send functions. See the [upload attachment options](https://mailslurp.github.io/mailslurp-client/interfaces/UploadAttachmentOptions.html) for more information.\n\n```javascript\nconst mailslurp = new MailSlurp(config);\n\n// read a file as a base64 encoded string\nconst pathToAttachment = path.join(__dirname + '/attachment.txt');\nconst fileBase64Encoded = await fs.promises.readFile(pathToAttachment, {\n  encoding: 'base64',\n});\n\n// upload the attachment as base64 string and get atttachment id\nconst [attachmentId] =\n  await mailslurp.attachmentController.uploadAttachment({\n    uploadAttachmentOptions: {\n      base64Contents: fileBase64Encoded,\n      contentType: 'text/plain',\n      filename: path.basename(pathToAttachment),\n    },\n  });\n```\n\n### Send attachment\nTo send an attachment first upload the file using the [AttachmentController](https://mailslurp.github.io/mailslurp-client/classes/AttachmentControllerApi.html) then send an email containing the attachment ID with the [InboxController](https://mailslurp.github.io/mailslurp-client/classes/InboxControllerApi.html).\n\nYou can send attachments by including their IDs in the attachments options when sending.\n\n```javascript\nconst inbox1 = await mailslurp.createInbox();\nconst inbox2 = await mailslurp.createInbox();\n\n// send email and get saved result\nconst sentEmail = await mailslurp.inboxController.sendEmailAndConfirm({\n  inboxId: inbox1.id,\n  sendEmailOptions: {\n    to: [inbox2.emailAddress],\n    attachments: [attachmentId],\n    subject: 'Send attachments',\n    body: 'Here are your files',\n  },\n});\n\nexpect(sentEmail.attachments.length).toEqual(1);\n```\n\n### Receive attachments\nTo wait for expected emails to arrive and read their contents use the [WaitFor controller](https://mailslurp.github.io/mailslurp-client/classes/WaitForControllerApi.html) endpoints.\n\n```javascript\n// first wait for an email\nconst email = await mailslurp.waitController.waitForLatestEmail({\n  inboxId: inboxId,\n  timeout: 30000,\n  unreadOnly: true,\n});\n\n// check has attachments\nexpect(email.attachments.length).toEqual(1);\n\n// download with email controller as base64 string\nconst attachmentDto =\n  await mailslurp.emailController.downloadAttachmentBase64({\n    attachmentId: email.attachments[0]!!,\n    emailId: email.id,\n  });\n\n// can access content\nexpect(attachmentDto.base64FileContents).toBeTruthy();\nconst fileContent = new Buffer(\n  attachmentDto.base64FileContents,\n  'base64'\n).toString();\nexpect(fileContent).toContain('test');\n\n// can access size etc\nexpect(attachmentDto.sizeBytes).toBeTruthy();\nexpect(attachmentDto.contentType).toBeTruthy();\n```\n\n### Wait for multiple emails\nThe WaitForController contains many methods for waiting for emails to arrive in an inbox. See the [waitFor controller reference](https://mailslurp.github.io/mailslurp-client/classes/WaitForControllerApi.html) for more information.\n\n```javascript\nit('can wait for multiple emails', async () =\u003e {\n  const mailslurp = new MailSlurp(config);\n\n  // example of creating inboxes simultaneously\n  const inbox1 = await mailslurp.createInbox();\n  const inbox2 = await mailslurp.createInbox();\n\n  // send two emails\n  await mailslurp.sendEmail(inbox1.id, {\n    to: [inbox2.emailAddress],\n    subject: 'Hello Dogs',\n  });\n  await mailslurp.sendEmail(inbox1.id, {\n    to: [inbox2.emailAddress],\n    subject: 'Hello Cats',\n  });\n\n  // wait for 2 emails\n  const emails = await mailslurp.waitController.waitForEmailCount({\n    count: 2,\n    inboxId: inbox2.id,\n    sort: WaitForEmailCountSortEnum.DESC,\n  });\n\n  const subjects = emails.map((e) =\u003e e.subject);\n  expect(subjects).toContain('Hello Dogs');\n  expect(subjects).toContain('Hello Cats');\n});\n```\n\n### Wait for matching emails\nMailSlurp allows one to wait for emails that match certain parameters. Here is an example:\n\n```javascript\nconst inbox1 = await mailslurp.createInbox();\nconst inbox2 = await mailslurp.createInbox();\n\n// specify recipient (must be array)\nconst to = [inbox2.emailAddress];\n\n// send two emails\nawait mailslurp.sendEmail(inbox1.id, { to, subject: 'Apples' });\nawait mailslurp.sendEmail(inbox1.id, { to, subject: 'Oranges' });\n\n// wait for matching email based on subject (see MatchOptions for all options)\nconst matchOptions: MatchOptions = {\n  matches: [\n    {\n      field: MatchOptionFieldEnum.SUBJECT,\n      should: MatchOptionShouldEnum.CONTAIN,\n      value: 'Apples',\n    },\n  ],\n};\nconst expectCount = 1;\nconst matchingEmails = await mailslurp.waitController.waitForMatchingEmails(\n  {\n    inboxId: inbox2.id,\n    matchOptions: matchOptions,\n    count: expectCount,\n    timeout: timeoutMillis,\n    unreadOnly: true,\n  }\n);\nexpect(matchingEmails.length).toEqual(1);\nexpect(matchingEmails[0].subject).toEqual('Apples');\n```\n\nSee the [MatchOptions documentation](https://mailslurp.github.io/mailslurp-client/interfaces/MatchOptions.html) for reference.\n\n### Extract email content\nYou can extract useful information from emails using regular expressions. See the [EmailController](https://mailslurp.github.io/mailslurp-client/classes/EmailControllerApi.html) for more information:\n\n```javascript\nconst inbox1 = await mailslurp.createInbox();\nconst inbox2 = await mailslurp.createInbox();\n\nconst to = [inbox2.emailAddress];\nconst body = 'Hi there. Your code is: 123456';\nawait mailslurp.sendEmail(inbox1.id, { to, body });\n\n// wait for email\nconst email = await mailslurp.waitController.waitForLatestEmail({\n  inboxId: inbox2.id,\n  timeout: timeoutMillis,\n  unreadOnly: true,\n});\nconst pattern = 'code is: ([0-9]{6})';\nexpect(email.body).toContain('Your code is');\n\n// pass the pattern to mailslurp to match for emails\nconst result = await mailslurp.emailController.getEmailContentMatch({\n  contentMatchOptions: { pattern },\n  emailId: email.id,\n});\n\n// access the match groups\nexpect(result.matches).toHaveLength(2);\nexpect(result.matches[0]).toEqual('code is: 123456');\nexpect(result.matches[1]).toEqual('123456');\n```\n\n## Phone SMS/TXT usage\nMailSlurp supports inbound SMS using real phone numbers. See the [SMS guide](https://app.mailslurp.com/guides/txt-sms/) or the developer [documentation](https://docs.mailslurp.com/txt-sms/) to get started.\n\n### Create phone numbers\nPhone numbers must be created in the MailSlurp [dashboard](https://app.mailslurp.com). Once you create a number you can use it in code.\n\n### List numbers\nFetch phone numbers with the phone controller.\n\n```typescript\nconst {\n  content: [phone],\n} = await mailslurp.phoneController.getPhoneNumbers({\n  phoneCountry: GetPhoneNumbersPhoneCountryEnum.US,\n});\nexpect(phone.phoneNumber).toContain('+1');\n```\n\n### Receive SMS\nUse the wait for controller to wait for inbound SMS messages:\n\n```typescript\nconst sms = await mailslurp.waitController.waitForLatestSms({\n  waitForSingleSmsOptions: {\n    phoneNumberId: phone.id,\n    timeout: 30_000,\n    unreadOnly: true,\n  },\n});\nexpect(sms.body).toContain('Here is your code');\nexpect(sms.fromNumber).toEqual('+13252527014');\n```\n\nYou can also use webhooks with the `NEW_SMS` event to receive text messages.\n\n## Testing\nMailSlurp is testing email and SMS in code. Testing can include the analysis of email content, feature support, and the sending and receiving of emails and SMS to test applications and processes. MailSlurp can be used with common test frameworks.\n\n### Connect with common test frameworks\n- [Testing guide](https://docs.mailslurp.com/testing/)\n- [Cypress](https://docs.mailslurp.com/cypress-mailslurp/)\n- [Playwright](https://docs.mailslurp.com/playwright/)\n- [Selenium](https://docs.mailslurp.com/selenium/)\n\n### Email feature support testing\nCheck rendering of email HTML, CSS, and images across different devices and mail clients. MailSlurp can analyze your emails and [detect HTML, CSS, and image features](https://www.mailslurp.com/product/email-compatibility-tester/) that may not be supported by all email clients. \n\n```typescript\nconst { result } =\n  await mailslurp.emailController.checkEmailBodyFeatureSupport({\n    emailId: email.id,\n  });\nexpect(result.detectedFeatures).toContain(\n  EmailFeatureSupportResultDetectedFeaturesEnum.html_doctype\n);\nexpect(\n  result.featurePercentages.find(\n    (it) =\u003e\n      it.status === EmailFeatureSupportStatusPercentageStatusEnum.SUPPORTED\n  )?.percentage\n).toBeGreaterThan(50);\n```\n\n### Find broken links\nYou can parse emails and detect 404s and broken links. MailSlurp will attempt to call the resource to ensure it exists. Check for dead links like this:\n\n```typescript\nconst result = await mailslurp.emailController.checkEmailBody({\n  emailId: email.id,\n});\nexpect(result.hasIssues).toEqual(true);\nexpect(result.linkIssues.length).toEqual(1);\nexpect(result.linkIssues[0].url).toEqual(\n  'https://api.mailslurp.com/not-existing'\n);\n```\n\n### Detect missing images\nBroken images can be detected in emails. MailSlurp will attempt to load the image and detect if it is missing. Check for missing images like this:\n\n```typescript\nconst result = await mailslurp.emailController.checkEmailBody({\n  emailId: email.id,\n});\nexpect(result.hasIssues).toEqual(true);\nexpect(result.imageIssues.length).toEqual(1);\nexpect(result.imageIssues[0].url).toEqual(\n  'https://www.mailslurp.com/broken-image.png'\n);\n```\n\nSee the [content testing guide](https://docs.mailslurp.com/email-feature-check/) for more information.\n\n## Webhooks\nTo have received emails sent to your server using HTTP webhook push create a webhook using the [WebhookController](https://mailslurp.github.io/mailslurp-client/classes/WebhookControllerApi.html) or see the [webhook email guide](https://docs.mailslurp.com/webhooks/).\n\n### Create webhooks\nYou can create webhooks in code or using the [MailSlurp dashboard](https://app.mailslurp.com/).\n\n```typescript\nawait mailslurp.webhookController.createWebhook({\n    inboxId,\n    webhookOptions: {\n        url: \"https://my-server.com/webhook\",\n        eventName: CreateWebhookOptionsEventNameEnum.NEW_EMAIL\n    }\n})\n```\n\n### Listen to webhooks\nTo consume webhooks first create a webhook for an inbox and a given [webhook event](https://docs.mailslurp.com/webhooks). Set the webhook URL to an endpoint on your server. Your server must be publicly accessible and return a 200 or 201 status code in 30 seconds. To test locally use a service like ngrok.io to tunnel your local machine to a public URL. [The payload](https://docs.mailslurp.com/webhooks) posted to your end point will depend on the event type. Here is a listen example using express\n\n\u003e **Note:** you can use any framework or language you like with webhooks.\n\n```typescript\n// example express server that you control\nconst app = express();\napp.use(bodyParser.json());\n// receive new email webhook payload via post\napp.post('/new-email-endpoint', async (request, response) =\u003e {\n  // can use typescript types\n  const payload = request.body as WebhookNewEmailPayload;\n\n  // do something with with email id\n  expect(payload.emailId).toBeTruthy();\n\n  // return a 2xx status code so MailSlurp knows you received it\n  return response.sendStatus(200);\n});\nconst server = app.listen(port);\n```\n\n### Testing webhook server\n\n```typescript\n// get a test payload for NEW_EMAIL event\nconst testPayload =\n  await mailslurp.webhookController.getTestWebhookPayloadNewEmail();\n// post payload to your server to test it\nconst testResponse = await fetch(\n  `http://localhost:${port}/new-email-endpoint`,\n  {\n    method: 'POST',\n    headers: {\n      'content-type': 'application/json',\n    },\n    body: JSON.stringify(testPayload),\n  }\n);\n// expect 200\nexpect(testResponse.status).toEqual(200);\n```\n\n## More Documentation\n\n- [Webhook documentation](https://docs.mailslurp.com/webhooks/)\n- [Method documentation](https://mailslurp.github.io/mailslurp-client/)\n- [Guides](https://www.mailslurp/guides/)\n- [API Key](https://app.mailslurp.com/sign-up/)\n- [Example repositories](https://www.mailslurp.com/examples/)\n\n## Resources\n\n- [Dashboard App](https://app.mailslurp.com)\n- [Documentation](https://mailslurp.github.io/mailslurp-client/index.html)\n- [Github](https://github.com/mailslurp/mailslurp-client)\n- [NPM package](https://www.npmjs.com/package/mailslurp-client)\n\n## Feedback, support, and feature requests\nThe MailSlurp team welcomes any [feedback and feature requests](https://www.mailslurp.com/feedback/). Please use the [support portal to report any bugs](https://www.mailslurp.com/support/) or speak with support.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmailslurp%2Fmailslurp-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmailslurp%2Fmailslurp-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmailslurp%2Fmailslurp-client/lists"}