I need to use a throwaway email address domain in my test scripts. Currently, we are using mailinator
but it blocks users after a certain limit of bulk emails is reached.
Is there any other better way of achieving this?
I need to use a throwaway email address domain in my test scripts. Currently, we are using mailinator
but it blocks users after a certain limit of bulk emails is reached.
Is there any other better way of achieving this?
I have used a trick with gmail where you can append +string on any address. The string I filled in was a Unix Time Stamp.
Original Email Address: [email protected]
Testing Email Address: [email protected]
+
in email addresses is allowed. (I've had once a web mailer which interpreted + as space, and thus rejected my mail address.)
Commented
Nov 9, 2017 at 20:10
For manual testing (ie, visually inspecting the emails), you should use a local SMTP server, like Bhavani. I've used Mailcatcher in the past and really enjoyed it.
Any time you need to test something where the application under test interacts with outside services, you have a couple of choices:
1) Stubbing 2) Use a real service
Then there's a choice between using an internal or external stub or service.
Stubbing is where you build a fake interface, that just does enough for the application under test to be tested. The problem is that for something like SMTP, where you have many, many error conditions and the like, in order to stub properly, you might as well write your own SMTP server. Or you could use one of the many options that come up when you google "stub smtp server."
The second option is using a real SMTP server (or, better, several different SMTP servers). For integration testing, this is the best way to go. This is because standards can be interpreted differently, and you need to make sure that your application works with different interpretations of the standards.
Then you have a choice between managing the service internally, externally for free, or externally for a fee. If you're testing anything you plan to charge for, I would very strongly suggest either hosting the service internally, or externally where you have some sort of contractual agreement with the service. In the case of mailinator, for example, anyone can read mail that has been sent to a given inbox. If your competitors find out that you're using a publicly available, world-readable service to test new products with, there's a chance they will be able to figure out what you're working on.
I've handled the scenario with the local smtp server setup with the open source tools like hMailserver. After setting up, you can define your own domains and email ids.
I use https://www.guerrillamail.com/inbox it has a selection of domains for you to use which gets over the blocking issue.
I don't get why you need throw away email addresses. Can't you just remove the account and re-use the same email address again in your tests?
I would have a look at Mailtrap, they have a service with which you can catch mails send from your servers without sending them to a real inbox somewhere. Also I think you can create mailboxes, receive and check email content and such with their API.
There are various online solutions the provide you with unlimited email addresses for testing. We are using Mailosaur with Cypress to test our signup and password reset processes.
In addition to @kirbycobes answer:
plus addressing / subaddressing is now also available Exchange Online / Office 356
As of May 2022, plus addressing (also known as subaddressing) is enabled by default in Exchange Online. Subaddressing is an industry-defined way to support dynamic, disposable recipient (not sender) email addresses for mailboxes.
Plus addressing uses the syntax:
<local-part>+<tag>@<domain>
. For example, [email protected]. The original email address must be valid. The+tag
value that you add is arbitrary, although regular character restrictions for SMTP email addresses apply (for example, no spaces).