Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8976819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:13:55+00:00 2026-06-15T19:13:55+00:00

Is there a library or a way to do this without an external library?

  • 0

Is there a library or a way to do this without an external library? I am using apache james as my mail server and currently send email like this:

public void sendMessage(String to, String subject, String content) {
    MimeMessage message = new MimeMessage(session);
    try {
        message.addRecipients(Message.RecipientType.TO, to);
        message.setFrom(new InternetAddress(from));
        message.setSubject(subject);
        message.setContent(content, "text/html; charset=utf-8");
        Transport.send(message);
    } catch (MessagingException e) {
        e.printStackTrace();
    }       
}

But i’d like to sign the email with DKIM before hand. I understand I need to implement DKIM signing into the james server and plan on use jDKIM to do this, I also understand I need to create the keys using something like http://www.port25.com, but how do I actually sign the email in java before I send it out?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T19:13:57+00:00Added an answer on June 15, 2026 at 7:13 pm

    I ended up using DKIM for Javamail which can be downloaded at:
    DKIM For Javamail

    Here is an example (Its pretty well documented in the examples in the download):

    public void sendMessage(String to, String subject, String content) {
        //Create DKIM Signer
        DKIMSigner dkimSigner = null;
        try {
            dkimSigner = new DKIMSigner(properties.getProperty("mail.smtp.dkim.signingdomain"), properties.getProperty("mail.smtp.dkim.selector"), properties.getProperty("mail.smtp.dkim.privatekey"));
            dkimSigner.setIdentity(properties.getProperty("mail.user") + "@" + properties.getProperty("mail.smtp.dkim.signingdomain"));
            dkimSigner.setHeaderCanonicalization(Canonicalization.SIMPLE);
            dkimSigner.setBodyCanonicalization(Canonicalization.RELAXED);
            dkimSigner.setLengthParam(true);
            dkimSigner.setSigningAlgorithm(SigningAlgorithm.SHA1withRSA);
            dkimSigner.setZParam(true);
        } catch (Exception e) {
        e.printStackTrace();
            }
        if(dkimSigner != null) {
            //Create message
            Message message = new SMTPDKIMMessage(session, dkimSigner);
            try {
                message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to, false));
                message.setFrom(new InternetAddress(from));
                message.setSubject(subject);
                message.setContent(content, "text/html; charset=utf-8");
                Transport.send(message);
            } catch (MessagingException e) {
                e.printStackTrace();
            }   
        }           
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a library/simple way to flip an image? Flip image like this: AABBCC
Is there a way in C#, perhaps using an external library of some kind,
Is there a way using the Net::SFTP Library in Ruby ( API Link )
Is there any way to temporary use a namespace ? I'm using a library
Is there any easy way / library / external app to introduce Unit of
I have an external library that takes an IntPtr. Is there any safe way
Using the Qt library, is there a way to automatically update a QDateTimeEdit using
I'm calling a method from an external library with a (simplified) signature like this:
Is there a standard way / C# library to convert a string into a
Is there a way for a shared library to be notified when it is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.