simple-java-mail / java-utils-mail-dkim

A DKIM library for Jakarta Mail
15 stars 6 forks source link

dkimSignMessage method declares Mimemessage return type but actually returns DkimMessage #1

Closed saranyaelumalai-okta closed 2 years ago

saranyaelumalai-okta commented 2 years ago

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.

bbottema commented 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?