Closed saranyaelumalai-okta closed 2 years ago
Please have a look at the inheritance chain. DkimMessage is a MimeMessage and can be passed anywhere a MimeMessage can be passed.
Perhaps you are using a Transport class from JavaMail, while the newer Simple Java Mail releases depend on its successor Jakarta Mail?
In the example
private MimeMessage dkimSignMessage(MimeMessage message, String signingDomain, String selector, InputStream privateKeyStream) throws Exception {
DkimSigner dkimSigner = new DkimSigner(signingDomain, selector, privateKeyStream );
dkimSigner.setHeaderCanonicalization(Canonicalization.SIMPLE);
.....
return new DkimMessage(message, dkimSigner);
}`dkimSignMessage method declares Mimemessage return type but actually returns DkimMessage. Transport.send allows only MimeMessage not DkimMessage which causes compatibility issue. Please guide.