Simple Java mail recently added DKIM signature support. Here is your code, but now with simple Java mail:
public void sendMessage(String to, String subject, String content) { final Email email = new Email.Builder() .from(null, from) .to(null, to) .subject(subject) .textHTML(content) .build(); email.signWithDomainKey(new File(properties.getProperty("mail.smtp.dkim.privatekey")), properties.getProperty("mail.smtp.dkim.signingdomain"), properties.getProperty("mail.smtp.dkim.selector")); new Mailer(...).sendMail(email); }
The private key argument may be File , InputStream or byte[] .
Interestingly, behind the scenes, Simple Java Mail uses java-utils-mail-dkim (GitHub), which is the active fork on the inactive DKIM-for-JavaMail (GitHub), which was a continuation of the library you are currently using, DKIM for Javamail (SourceForge ) So the one you are using is very old.
source share