Capturing a code within an outlook email

Hi,

I’ve just started using Katalon, and was wondering if there is any way to pick up a code that is sent to an outlook email address, and then using that code within the webiste (that I was in(

Thanks

Hello,

similar case was solved in this topic, have a look.

I read that one. But there is nothing in that topic thread about capturing certain text within the email

I think there is.

if(message.getSubject().contains("Verify your email for project") || message.getSubject().contains("Sign in to project")){
	//System.out.println("Subject: " + message.getSubject());
	MimeMultipart messageBody = message.getContent();

	String desc = messageBody.getBodyPart(1).getContent().toString();

	//System.out.println("Description: " + desc);
	Pattern linkPattern = Pattern.compile("href=\"(.*?)\"",  Pattern.CASE_INSENSITIVE|Pattern.DOTALL);
	Matcher pageMatcher = linkPattern.matcher(desc);
	while(pageMatcher.find()){
		links.add(pageMatcher.group(1));
}
} else{
	System.out.println("Email:"+ i + " is not a wanted email");
}

This is the part where the link is being searched. You need to rewrite this code to parse the mail and search your code, then store it somewhere.

1 Like