1

Looking for a Java library to convert a mailto link to a MIME message, or at least fill in the parts of it that are contained within the mailto link. Only solution I've found (an SO question) involves use of Desktop which I'm pretty sure my application cannot depend on (highly concurrent, running on a web server).

djechlin
  • 59,258
  • 35
  • 162
  • 290
  • What are you trying to accomplish? Most users who surf your web site will have their web browser configured to open their mail client with the information from the mailto: link pre-filled in the composition window. – tripleee Oct 03 '12 at 06:25

1 Answers1

0

As far as I can tell something simple does not exist. The following code worked using the Uri class from Android, which was not complicated to excise from the Android libraries:

MailTo mailTo = MailTo.parse(unsubscribeUrl);

        Map<String, String> headers = mailTo.getHeaders();
        Set<Map.Entry<String, String>> values = headers.entrySet();

        for (Map.Entry<String, String> header : values) {
            message.addHeader(header.getKey(), header.getValue());
        }
djechlin
  • 59,258
  • 35
  • 162
  • 290