Skip to main content

Inbox connectors

Inbox connectors allow you to connect external mailboxes with MailSlurp inboxes. This means you can send and receive emails using MailSlurp APIs and dashboards by syncing with existing mail accounts over IMAP and SMTP. This feature supports popular providers like Google/Gmail, Outlook/Exchange, as well as custom IMAP and SMTP servers.


Connectors are a way to link external email accounts with MailSlurp inboxes. They are comprised of several components:

ConnectorMain component with ID and email address
Connector inboxThe MailSlurp inbox for storing synced emails
External mailboxExternal email account hosted by your provider
IMAP settingsSettings for reading emails from external mailbox
SMTP settingsSettings for sending emails via external mailbox
Sync settingsSettings for background automatic syncing
Connector eventsEvent and logs saved for each sync and send

Creating a connector

You can create inbox connectors in the dashboard or using the API. In the dashboard you can choose between common providers like Google and Microsoft or use custom settings:

Using the Javascript SDK, here is an example:

const connector = await connectorController.createConnectorWithOptions({
createConnectorWithOptions: {
// configure email and name
createConnectorOptions: {
emailAddress: externalInbox.emailAddress,
name: 'example-connector',
enabled: true
// configure imap settings
createConnectorImapConnectionOptions: {
enabled: true,
imapHost: externalMailServer.imapServerHost,
imapPort: externalMailServer.imapServerPort,
imapPassword: externalMailServer.imapPassword,
imapUsername: externalMailServer.imapUsername,
imapSsl: false,
startTls: false
// configure smtp settings
createConnectorSmtpConnectionOptions: {
enabled: true,
smtpHost: externalMailServer.smtpServerHost,
smtpPort: externalMailServer.smtpServerPort,
smtpPassword: externalMailServer.smtpPassword,
smtpUsername: externalMailServer.smtpUsername,
smtpSsl: false,
startTls: false
// no automatic sync set
createConnectorSyncSettingsOptions: undefined

See the connector controller for more options.

Connecting Google Accounts

To connect Gmail/Google workspace accounts you need to first create an app password for your google account.

  1. Go to your Google account settings
  2. Search for "app password" in the search bar
  3. Create a new app password for MailSlurp
  4. Copy the password into the MailSlurp connector SMTP and IMAP password settings
  5. Use your email account as the username for each setting.

Next, ensure you have enabled IMAP in Gmail settings.

  1. In Gmail, click Settings gear icon, then click All settings
  2. Click the Forwarding and POP/IMAP tab
  3. In the IMAP section, select Enable IMAP, then save changes.

Then configure the connector connection settings to use the Gmail mail servers:

IMAP usernameYour email
IMAP passwordYour app password
IMAP port993
IMAP StartTLSfalse
SMTP usernameYour email
SMTP passwordYour app password
SMTP port465
SMTP StartTLStrue

Connecting Microsoft Accounts

IMAP usernameYour email
IMAP passwordYour external password or app password
IMAP port993
IMAP StartTLSfalse
SMTP usernameYour email
SMTP passwordYour external password or app password
SMTP port587
SMTP StartTLStrue

Testing connections

Once you add IMAP and SMTP connections you can see the status in the dashboard:

You can test connections against the servers using the test connection endpoints:

const testResult = await connectorController.testConnectorImapConnection({

You can also see the status and logs of the connection in the dashboard:

Syncing emails

Syncing is the process of fetching emails from an external mailbox and storing them in a MailSlurp inbox. Synchronizing emails between an external inbox and a MailSlurp connector is done via several mechanisms:

Direct sync example

const result: ConnectorSyncRequestResult = await connectorController.syncConnector({
// enable logging to debug
logging: true
// can view IMAP logs
expect(result.syncResult?.logs?.some(line => line.includes('CAPABILITY IMAP4rev1'))).toBeTruthy();

Sending emails

To send emails from a 3rd party account using MailSlurp inboxes and APIs either:

  • use the existing send email methods with the connectors inboxId.
  • use the connector sendEmailFromConnector method.