How to verify mask letter in email using java

I will get random email id in my confirmation page.That should be in below format. a****[email protected]
Can I verify email format in selenium?

<div class="cart-wrapper grid-container">
<div class="grid-40">
<div class="cart-confirmation-copy">
<p class="cart-confirmation-email">A***[email protected]</p>
</div>
</div>

beside using selenium use JavaMail to validate the email format. You just need to getText() from selenium then pass it to the function

Using the official java email package is the easiest:

public static boolean isValidEmailAddress(String email) {
   boolean result = true;
   try {
      InternetAddress emailAddr = new InternetAddress(email);
      emailAddr.validate();
   } catch (AddressException ex) {
      result = false;
   }
   return result;
}

Hope it will help you 🙂