JavaMail question.

G

guiding5

Hello, mysterious ALL.

I need an advice on implementation of S/MIME and PGP/MIME using
JavaMail API.

The task is to encrypt messages using inline calls for
openssl/openPGP/gnuPG (Linux).
Its easy to retrieve message's content from JavaMail objects, but
I'm facing a problem of injecting encrypted messages back. Suddenly
JavaMail API is looking too bulky and way to overkill to use. Looks
like I need to implement a lot of classes to simply insert "ready"
content into the message.

Here the question:
Is there a way to simply set content type and add headers to the
message?
Is there a way to wrap MimePart in something with easy access to its
content? (I'd like to have something like setContentType(),
setContent(String/File), addHeader(String).

P.S. Looking into different implementations of SMIME/PGP didn't
really help; most of the implementations are way too bulky.

Thanks in advance,
Best regards, Guiding5.
 
I

iksrazal

Hello, mysterious ALL.

I need an advice on implementation of S/MIME and PGP/MIME using
JavaMail API.

The task is to encrypt messages using inline calls for
openssl/openPGP/gnuPG (Linux).
Its easy to retrieve message's content from JavaMail objects, but
I'm facing a problem of injecting encrypted messages back. Suddenly
JavaMail API is looking too bulky and way to overkill to use. Looks
like I need to implement a lot of classes to simply insert "ready"
content into the message.

Here the question:
Is there a way to simply set content type and add headers to the
message?
Is there a way to wrap MimePart in something with easy access to its
content? (I'd like to have something like setContentType(),
setContent(String/File), addHeader(String).

P.S. Looking into different implementations of SMIME/PGP didn't
really help; most of the implementations are way too bulky.

Thanks in advance,
Best regards, Guiding5.

A couple quick things:

1) A while back I fixed a few bugs for the protomatter project at
sourceforge in their MailLog packages - the point being there is a
some support classes for a simple mailer there (non-javaMail) that
supports MIME. It has some methods like:

MailMessage m = new MailMessage();
m.setTo(to);
m.setFromAddress(fromAddress);
m.setFromName(fromName);
m.setCC(cc);
m.setBCC(bcc);
m.setSubject(subjectFormat.formatMessageSubject(message));

if (html)
{
MIMEMessage container = new MIMEMessage();
MIMEAttachment a = new MIMEAttachment("text/html", "message body",
b.toString());
container.addAttachment(a);
m.setBody(container);
}

You might be able to find there what you are after.

2) Encryption of email in Java is most often done with the
javax.crypto.* interfaces usually with the provider being from Bouncy
Castle.

HTH,
iksrazal
http://www.braziloutsource.com/
 
G

Guiding5

1) Going to try the protomatter's classes, seems like its much simplier
implementation.

2) javax.crypto.* provides interface for encryption providers and is
not what i looking for.

Thanks for the help !
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,821
Messages
2,569,725
Members
45,511
Latest member
Osiris-Team

Latest Threads

Top