/** * Creates an <code>Email</code> from a file containing an <strong>uncompressed</strong> MIME email * and another file containing metadata. If the metadata file doesn't exist, the metadata will be * empty. * @param emailStream * @param metadataStream * @param passwordHolder * @throws MessagingException * @throws IOException * @throws PasswordException * @throws GeneralSecurityException */ public Email(InputStream emailStream, InputStream metadataStream, PasswordHolder passwordHolder) throws MessagingException, IOException, PasswordException, GeneralSecurityException { this(emailStream, false); if (metadataStream != null) metadata = new EmailMetadata(metadataStream); else metadata = new EmailMetadata(); }
/** * Creates an <code>Email</code> from a byte array containing a <strong>compressed</strong> MIME email. * @param bytes * @throws MessagingException * @throws IOException */ public Email(byte[] bytes) throws MessagingException, IOException { this(new ByteArrayInputStream(bytes), true); messageId = new UniqueId(); metadata = new EmailMetadata(); }
/** * @param includeSendTime Whether to add a "Date" header. */ public Email(boolean includeSendTime) { super(Session.getDefaultInstance(new Properties())); messageId = new UniqueId(); metadata = new EmailMetadata(); this.includeSendTime = includeSendTime; }
private EmailMetadata getMetadata(File file) throws IOException, GeneralSecurityException, PasswordException { InputStream metadataStream = new BufferedInputStream(new EncryptedInputStream(new FileInputStream(file), passwordHolder)); EmailMetadata metadata = new EmailMetadata(metadataStream); return metadata; }
/** * Returns the metadata for an email. If the metadata file doesn't exist or cannot be read, * an empty {@link EmailMetadata} object is returned. This method never returns <code>null</code>.<br/> * The returned metadata object is not connected to the * @throws PasswordException * @throws GeneralSecurityException */ private EmailMetadata getMetadata(String messageId) throws GeneralSecurityException, PasswordException { File file = getMetadataFile(messageId); if (!file.exists()) return new EmailMetadata(); try { return getMetadata(file); } catch (IOException e) { log.error("Can't read metadata file: <" + file.getAbsolutePath() + ">", e); return new EmailMetadata(); } }
/** * Creates an <code>Email</code> from an InputStream containing a compressed or uncompressed MIME email. * @param inputStream * @param compressed <code>true</code> if the stream contains compressed data * @throws MessagingException * @throws IOException */ public Email(InputStream inputStream, boolean compressed) throws MessagingException, IOException { super(Session.getDefaultInstance(new Properties()), compressed?Email.decompress(inputStream):inputStream); messageId = new UniqueId(); includeSendTime = getSentDate() != null; metadata = new EmailMetadata(); }
Hash delVerificationHash4 = new Hash(new byte[] {-69, -24, -109, 1, 69, -122, -69, 113, -68, -90, 55, -28, 105, 97, 125, 70, 51, 58, 14, 2, -13, -53, 90, -29, 36, 67, 36, -94, -108, -125, 11, 123}); EmailMetadata metadata = new EmailMetadata();