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’ (Email workflow testing tool with instant disposable emails)
To automate this, you can write the code something like the below mentioned:
import org.apcahe.commons.lang3.RandomStringUtils;
public class mail7{
private static final String EMAIL-DOMAIN = ‘Mailio’;
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();
}
please refer to this doc to get a better idea and solution for your problem.
Registration And Login Automation Using Selenium With Disposable Email