Is there any disposable email service that allow us to receive veriifcation mail at temparory address and verify them?

Surendranath Birudala's picture

I need to automate the process where each time I need to register a user with a different email and verify them. Is there any such email service that allows testers to automate the process of getting a token / URL from a temporary mail address?

1 Answer

kuldeep chhipa's picture

Yes, at present there are so many disposable email service providers available in the market. they provide free public and private inbox for a temporary email address. Recently I found few very good disposable email service providers and one of them is ‘mail7.io’

Documentation is also very good.

To automate this, you can write the code something like the below mentioned:

public class ExampleUsageTest {
private static final String YOUR_API_KEY = "your_mail7_api_key_here";
private static final String YOUR_API_SECRET = "your_mail7_api_secret_here";

String getEmailBody(String UserName) throws IOException {
URL url = new URL(<a href="/%26quot%3Bhttps%3A//api.mail7.io/inbox?apikey">"https://api.mail7.io/inbox?apikey=</a>" + YOUR_API_KEY + "&amp;apisecret=" + YOUR_API_SECRET + "&amp;to=" + UserName);
HttpURLConnection con;
con = (HttpURLConnection) url.openConnection();

// handle error response code it occurs
int responseCode = con.getResponseCode();
InputStream inputStream;
if (200 &lt;= responseCode &amp;&amp; responseCode &lt;= 299) {
inputStream = con.getInputStream();
} else {
inputStream = con.getErrorStream();
}

BufferedReader in =new BufferedReader(
new InputStreamReader(
inputStream));

StringBuilder response = new StringBuilder();
String currentLine;

while ((currentLine = in.readLine()) != null)
response.append(currentLine);

in .close();

return response.toString();
}
}

Please refer to this doc to get a better idea and solution for your problem. doc link

StickyMinds is a TechWell community.

Through conferences, training, consulting, and online resources, TechWell helps you develop and deliver great software every day.