Switchless TEST


Filtering emails shot from staging environment


  • Keywords:#pattern
  • author: #alex

Create a filter from the backend to not send mails to email IDs not matching these patterns.

Criteria:

  1. All test emails should follow a pattern. Examples:
    1. {username}[email protected]
    2. @company.com

How do I create multiple accounts matching this pattern?

If you want to create multiple accounts using the same email, use the '+' operator the create different versions of the email. Examples:

Implementation

Modify this in MailgunService.sendEmail() function:

if(process.env.NODE_ENV=='development' || process.env.NODE_ENV!='production'){
    data.to=`[email protected]`;
      //if there are any emails matching the pattern, add them
      var emails=options.to.split(',')
      emails.forEach(function(email){
        if(email.includes('@company.co') || email.includes('[email protected]'))
          data.to+=','+email

      })

    }