MailSlurp logo

guides

Automated Email Replies with Inbox Repliers Plus

Configuring Automated Email Reply Rules for Inboxes and Catch-All Addresses using MailSlurp. Set up customizable repliers, track events, and more!

repliers

MailSlurp supports automated email replies that can be configured to match particular inboxes or recipients.

Creating inbox repliers

// add an auto reply rule to inbox
const replier = await mailslurp.inboxReplierController.createNewInboxReplier({
  createInboxReplierOptions: {
    inboxId: inbox1.id,
    match: '*',
    field: CreateInboxReplierOptionsFieldEnum.SENDER,
    body: 'We are not home right now',
  },
});

Track reply events

// get events for inbox replier
const events = await mailslurp.inboxReplierController.getInboxReplierEvents({
  id: replier.id,
});
expect(events.numberOfElements).toEqual(1);
expect(events.content![0].status).toEqual(
  InboxReplierEventProjectionStatusEnum.SUCCESS
);

Testing inbox reply

// send email from inbox2 to inbox1 and expect an auto-reply
log.info('Send email');
const sent = await mailslurp.inboxController.sendEmailAndConfirm({
  inboxId: inbox2.id!!,
  sendEmailOptions: {
    to: [inbox1.emailAddress!!],
    subject: 'Hello',
    body: 'Are you home?',
  },
});
expect(sent.to).toContain(inbox1.emailAddress);

// see that inbox2 gets a reply
const receivedEmail = await mailslurp.waitController.waitForLatestEmail({
  inboxId: inbox2.id,
  timeout: 60000,
  unreadOnly: true,
});
expect(receivedEmail.subject).toContain('Hello');
expect(receivedEmail.body).toContain('We are not home right now');

Other options

Auto-repliers are one-way responses. There are other similar options available:

dresses