June 23, 2011

When You A Need Bunch Of Test Email Addresses

Sometimes, you need a bunch of email addresses for testing purposes.  Perhaps you need to test a login or registration page, or perhaps your application sends emails to many different people.

You could create many real email accounts for your tests.  But sometimes there's an easier way. Sometimes you can use a single email account instead, and just use variants of a single email address.

In many email systems, anything after the plus sign in the local part of the email address is ignored.  So, all of these are delivered to the same mailbox:
  • foo.bar@gmail.com
  • foo.bar+123@gmail.com
  • foo.bar+234@gmail.com
  • foo.bar+test1@gmail.com
  • foo.bar+regression.test.11.29.2011@gmail.com
In gmail, periods within your gmail address are ignored.  So, all of these are delivered to the same mailbox:
  • foobar@gmail.com
  • foo.bar@gmail.com
  • f.o.o.b.a.r@gmail.com
Note that consecutive periods like foo..bar@gmail.com are fine for gmail, but are generally considered invalid and hence undeliverable by most email sending systems. copyrightjoestrazzere

Only in gmail, both of these are delivered to the same address:
  • foo.bar@gmail.com
  • foo.bar@googlemail.com
These methods will usually allow you to register many times on your system-under-test with emails that will be considered different, but will actually deliver to the same account.  And you can usually filter these incoming emails to keep them separate from your other emails if needed.

see also:


This article originally appeared in my blog: All Things Quality
My name is Joe Strazzere and I'm currently a Director of Quality Assurance.
I like to lead, to test, and occasionally to write about leading and testing.
Find me at http://strazzere.blogspot.com/.

6 comments:

  1. AnonymousJune 27, 2011

    Excellent!

    One of our applications is a sort of user portal where e-mails are used as login and to send notifications. I used already the "+" gmail aliases, specially in the notifications' use cases, to receive them in known e-mail inboxes.

    These "tricks" help you focusing more on testing and less on preparing the tests, so thanks for pointing it out!

    ReplyDelete
  2. Glad you liked it, Mauri.

    ReplyDelete
  3. // In gmail, periods within your gmail address are ignored. So, all of these are delivered to the same mailbox//

    This is new to me.. Is this happened recently? or when starting itself Gmail id ignoring the dots?

    ReplyDelete
  4. No, Dinesh. I believe GMail has always been like this.

    ReplyDelete
  5. so by using one GMail id we can create the multiple user accounts in websites (except facebook an few websites)

    In any way this will affect security of the websites?

    ReplyDelete
  6. I'm not sure i can imagine how that could affect website security, but I suppose that depends on the individual website.

    ReplyDelete