Is there any disposable email service that allows receiving verification emails at a temporary address that self-destructs after 24 hours so that it will be helpful in automation of 'customer registration and verification' test case?
8 Answers
Yes in the current scenario we have so many disposable email service providers available in the market. they provide the free public and private inbox for a temporary email address. recently I found some very good disposable email service providers and one of them is https://mail7.io.
import org.apcahe.commons.lang3.RandomStringUtils;
public class mail7{
private static final String EMAIL-DOMAIN = ‘mail.io’;
private static final String EMAIL_APIKEY = ‘mail7_api_key’;
private static final String EMAIL_APISecret = ‘mail7_api_secret’;
private String emailid;
public usernameGenerator(){
String username = RandomStringUtils.randomAlphanumeric(8).toLowerCase();
System.out. println(“Random Username is ” + username);
return username;
}
public getInbox(String username){
HttpResponse <String> httpResponse = Unirest.get(“"https://api.mail7.io/inbox?apikey=" + EMAIL_APIKEY + "&apisecret=" + EMAIL_APISecret + "&to=" + username”)
.asString();
System.out.println( httpResponse.getHeaders().get("Content-Type"));
System.out.println(httpResponse.getBody());
return httpResponse.getBody();
}
With Gmail the sender can add a +
and any combination of words or numbers after your email address and you'll still receive the email.
if your [address is] [email protected], you could send mail to [email protected] or [email protected].
So you can potentially get by with only a single Gmail email address and you can check the recipient of received emails to see which test it corresponds to.
Of course Gmail has an API with which you can programmatically receive emails, if required (or you can potentially use regular POP).
It appears you can also set up a filter to automatically delete old emails.
If you don't want to use Gmail: While other providers might not support the exact same functionality, they may support something similar. I would start by checking whether something like this exists with whichever provider your company is using as their primary email provider or if a rule could be set up to achieve something like this.
The other option, as mentioned in the comments, would be to set up a local mail server on whichever machine the test is run or have a test mail server that's either permanently running on your local network or that's created as part of the test process.
Minimising or avoiding external dependencies in tests is always a good thing to strive towards. You don't want your tests to fail or to be unable to test if some external service has downtime. Or they could make a change that breaks your tests. There's also always the risk of confidential or private data accidentally ending up in a test. If you're sending that data to some untrusted third party, that could be quite a problem (even if they pinky promise to keep your data secure and delete it after 24 hours).
-
on gmail . in the before the @ are ignored (common scam with subscribe account). So [email protected] is the same as [email protected], [email protected] and so on– J_riteCommented Jun 10, 2020 at 12:56
Following options are quite good too. Have been using them for quite some time:
Mailinator.com
Guerrilla Mail
Mailsac
Mailtrap
For creating mailboxes during manual testing, we use mailinator whereas in automation tests, if there is email communication involved and we have to read certain email content as part of tests (as is the case with you), we use guerrillmail. In our case, we have to read verification codes sent in emails and on some occasions, we have to validate certain links sent in emails.
If you search online, you will get many services which provide free temporary email.
Here are a few examples,
Apart from this you can also use Gmail.
Google allows to append +<number>
to your ID and send emails to the same inbox as the actual email address.
For example, if your email address is [email protected], then you can send an email to
All the emails will be sent to the [email protected] inbox.
Now, you may be concerned about disposing of the test emails.
Well, for that you can set a filter in your gmail to send those test emails to your Trash folder. Google automatically deletes all emails older than 30 days. This much time would be sufficient for you to verify that the emails were actually delivered and have the correct information and format.
For manual testing, I've used 10 Minute Mail, which (like the name says), self-destructs the email address after 10 minutes.
Depending on how you're automating the signup process, it may not work for your case but the option is there if you need it.
-
1Someone proposed an edit which changed the URL of the service I linked. I have overridden the approval of that edit - despite sharing similar names it is not the same service. That edit should've been a separate answer.– RobotnikCommented Dec 21, 2021 at 21:30
If the service is free, you pay with your data.
For any professional purpose, you should seriously think about what kind of mail service provider you are using, and what kind of contract you have with them.
- Running your own mail server is an option, but it leaves your admin staff to run something they're not specialized in.
- Alternatively, outsource that task to an external provider. Someone with a Service Level Agreement.
There are many, just search in google using "temporary email id" fews are below:
I recently learned about yopmail. We used it for manual testing. You can use [any_name_you_want]@yopmail.com, e.g [email protected] or [email protected]
It will display any messages sent to that address publically and from anyone who uses the email address so expect to see other peoples work for commonly used emails. An example is shown below with a common address ([email protected]) used by many.
Whereas noone else has currently used michaeldurrant