I'm looking to test an account-creation feature of my product. The back-end of my application (which I do not control, so I can't intercept the sending of the email) sends an email to the address of my choice. I will need to then retrieve that email so that I can "click" on the activation link to complete the account creation. I'm using wdio and my tests are written in JavaScript, so JavaScript/node packages would be most convenient/appropriate. Any suggestions of services/packages to help with that?

Basically, I'm imagining this flow: In the account sign-up flow, I specify an email address of testaddress+unique@someservice.org. I then query the someservice.org until I get the account activation email that was addressed to testaddress+unique, retrieve the email, and parse it to extract the activation link.


It would depend on your email server (receiver). E.g., Protonmail and Gmail offer APIs that you can use to fetch received emails.

  // Proton Mail
  const pm = await ProtonMail.connect({
    username: 'foobar@protonmail.com',
    password: 'somethingsecure'

  // Get emails in inbox
  const emailsInInbox = await pm.getEmails('inbox')

 // GMail
 GET https://www.googleapis.com/gmail/v1/users/me/messages?q=in:sent after:2014/01/01 before:2014/02/01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.