Class MailTestUtils

java.lang.Object
io.micronaut.email.test.MailTestUtils

public final class MailTestUtils extends Object
Utility to read and delete emails from a Gmail inbox. Useful to test Transactional email integration.
Author:
Sergio del Amo
  • Constructor Details

    • MailTestUtils

      public MailTestUtils()
  • Method Details

    • countAndDeleteInboxEmailsBySubject

      public static int countAndDeleteInboxEmailsBySubject(String user, String password, String subject) throws jakarta.mail.MessagingException
      Parameters:
      user - SMTP user
      password - SMTP password
      subject - Target subject
      Returns:
      the number of emails which matched the target subject
      Throws:
      jakarta.mail.MessagingException - exception thrown while reading emails
    • countAndDeleteInboxEmailsBySubject

      public static int countAndDeleteInboxEmailsBySubject(String subject) throws jakarta.mail.MessagingException
      Parameters:
      subject - Target subject
      Returns:
      the number of emails which matched the target subject
      Throws:
      jakarta.mail.MessagingException - exception thrown while reading emails