0

I am trying to read the email content with the help of Mailosaur. Below is my sample java code with Junit.

public class SampleEmailTest {

    @Test
    public void readEmail(){
        MailosaurClient client = new MailosaurClient("ABCDEFGHT");
        SearchCriteria criteria = new SearchCriteria();
        criteria.withSentTo("XXXXX.YYYYYY@MAILOSAUR.IO");
        try {
            List result = client.messages().search("", criteria).items();
            MessageSummary latestEmail = (MessageSummary) result.get(0);
            System.out.println("latestEmail" + latestEmail);
        }catch (Exception e){
            System.out.println("Exceptio is " + e); }            
    }
}

After running this code, I am receiving below exception.

com.mailosaur.MailosaurException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Can anyone please help me on this front.

Durgesh
  • 585
  • 4
  • 12
  • 33
  • It's a problem with the SSL certificates. Is your antivirus intercepting SSL communications? They tend to do a MiTM attack to be able to scan your stuff over SSL. – SurfMan Jun 21 '18 at 12:25
  • I am not sure about this. However, I have installed the Mailosaur certificate in my jre. For that I have referred below stackoverflow issue. https://stackoverflow.com/questions/21076179/pkix-path-building-failed-and-unable-to-find-valid-certification-path-to-requ However not getting any success. – Durgesh Jun 22 '18 at 04:49

0 Answers0