In DKIMSigner class header Canonicalization is hard coded to SIMPLE (RELAXED should be better, or we could let the user choose). This may lead to Invalid Dkim, see https://wordtothewise.com/2016/12/dkim-canonicalization-or-why-microsoft-breaks-your-mail/ dkimSigner.setHeaderCanonicalization(Canonicalization.SIMPLE);