01: package org.bouncycastle.mail.smime.test;
02:
03: import org.bouncycastle.jce.provider.BouncyCastleProvider;
04:
05: import javax.mail.MessagingException;
06: import javax.mail.internet.MimeBodyPart;
07: import javax.mail.internet.MimeMultipart;
08: import java.security.Security;
09:
10: public class SMIMETestUtil {
11: public static final boolean DEBUG = true;
12:
13: static {
14: Security.addProvider(new BouncyCastleProvider());
15: }
16:
17: /*
18: *
19: * MAIL
20: *
21: */
22:
23: public static MimeBodyPart makeMimeBodyPart(String msg)
24: throws MessagingException {
25:
26: MimeBodyPart _mbp = new MimeBodyPart();
27: _mbp.setText(msg);
28: return _mbp;
29: }
30:
31: public static MimeBodyPart makeMimeBodyPart(MimeMultipart mm)
32: throws MessagingException {
33:
34: MimeBodyPart _mbp = new MimeBodyPart();
35: _mbp.setContent(mm, mm.getContentType());
36: return _mbp;
37: }
38:
39: public static MimeMultipart makeMimeMultipart(String msg1,
40: String msg2) throws MessagingException {
41:
42: MimeMultipart _mm = new MimeMultipart();
43: _mm.addBodyPart(makeMimeBodyPart(msg1));
44: _mm.addBodyPart(makeMimeBodyPart(msg2));
45:
46: return _mm;
47: }
48: }
|