Package org.apache.james.mailbox

Examples of org.apache.james.mailbox.MessageManager.appendMessage()


                    MessageResult messageResult = messageResultIterator.next();
                    InputStreamContent content = (InputStreamContent) messageResult.getFullContent();

                    dstMailboxManager.startProcessingRequest(dstMailboxSession);
                    dstMessageManager.appendMessage(content.getInputStream(), messageResult.getInternalDate(), dstMailboxSession, messageResult.getFlags().contains(Flag.RECENT), messageResult.getFlags());
                    dstMailboxManager.endProcessingRequest(dstMailboxSession);
                    log.info("Message #" + j + " appended in destination mailbox with path=" + mailboxPath.toString());
                    j++;

                }
View Full Code Here


    private void createMailbox(MailboxSession mailboxSession, MailboxPath mailboxPath) throws MailboxException, UnsupportedEncodingException {
        getMockMailboxManager().startProcessingRequest(mailboxSession);
        getMockMailboxManager().createMailbox(mailboxPath, mailboxSession);
        MessageManager messageManager = getMockMailboxManager().getMailbox(mailboxPath, mailboxSession);
        for (int j=0; j < MESSAGE_PER_MAILBOX_COUNT; j++) {
            messageManager.appendMessage(new ByteArrayInputStream(MockMail.MAIL_TEXT_PLAIN.getBytes("UTF-8")),
                    Calendar.getInstance().getTime(),
                    mailboxSession,
                    true,
                    new Flags(Flags.Flag.RECENT));
        }
View Full Code Here

                    try {
                        MailboxSession session = getMailboxManager().createSystemSession("test", LoggerFactory.getLogger("Test"));

                        getMailboxManager().startProcessingRequest(session);
                        MessageManager m = getMailboxManager().getMailbox(path, session);
                        Long uid =  m.appendMessage(new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), session, false, new Flags());
                        System.out.println("Append message with uid=" + uid);
                        if (uids.put(uid, new Object()) != null) {
                            fail.set(true);
                        }
                        getMailboxManager().endProcessingRequest(session);
View Full Code Here

                            if (mailbox == null) {
                                final String error = "Mailbox for user " + user + " was not found on this server.";
                                throw new MessagingException(error);
                            }

                            mailbox.appendMessage(new MimeMessageInputStream(mail), new Date(), session, true, null);
                        } catch (IOException e) {
                            throw new MessagingException("Failed to write mail message", e);
                        } finally {
                            session.close();
                            mailboxManager.logout(session, true);
View Full Code Here

                        if (mailbox == null) {
                            final String error = "Mailbox for user " + user + " was not found on this server.";
                            throw new MessagingException(error);
                        }

                        mailbox.appendMessage(new MimeMessageInputStream(mail), new Date(), session, true, null);
                    } finally {
                        session.close();
                        mailboxManager.logout(session, true);

                        // stop processing request
View Full Code Here

                        MailboxSession session = getMailboxManager().createSystemSession("test", LoggerFactory.getLogger("Test"));

                        getMailboxManager().startProcessingRequest(session);
                        MessageManager m = getMailboxManager().getMailbox(path, session);
                       
                        System.out.println("Append message with uid=" + m.appendMessage(new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), session, false, new Flags()));
                        getMailboxManager().endProcessingRequest(session);
                        getMailboxManager().logout(session,false);
                    } catch (MailboxException e) {
                        e.printStackTrace();
                        fail.set(true);
View Full Code Here

                    MessageResult messageResult = messageResultIterator.next();
                    InputStreamContent content = (InputStreamContent) messageResult.getFullContent();

                    dstMailboxManager.startProcessingRequest(dstMailboxSession);
                    dstMessageManager.appendMessage(content.getInputStream(), messageResult.getInternalDate(), dstMailboxSession, messageResult.getFlags().contains(Flag.RECENT), messageResult.getFlags());
                    dstMailboxManager.endProcessingRequest(dstMailboxSession);
                    log.info("Message #" + j + " appended in destination mailbox with path=" + mailboxPath.toString());
                    j++;

                }
View Full Code Here

                        if (mailbox == null) {
                            final String error = "Mailbox for user " + user + " was not found on this server.";
                            throw new MessagingException(error);
                        }

                        mailbox.appendMessage(new MimeMessageInputStream(mail), new Date(), session, true, null);

                    } catch (MailboxException e) {
                        throw new MessagingException("Unable to access mailbox.", e);
                    } finally {
                        session.close();
View Full Code Here

            if (mailbox == null) {
                final String error = "Mailbox for username " + username + " was not found on this server.";
                throw new MessagingException(error);
            }

            mailbox.appendMessage(new MimeMessageInputStream(mail.getMessage()), new Date(), session, true, null);

            log("Local delivery with ToSenderFolder mailet for mail " + mail.getName() + " with sender " + sender.toString() + " in folder " + this.folder);
       
        } catch (MailboxException e) {
            throw new MessagingException("Unable to access mailbox.", e);
View Full Code Here

            MessageManager messageManager = mailboxManager.getMailbox(mailboxPath, mailboxSession);

            while (mailRepositoryIterator.hasNext()) {
                Mail mail = mailRepository.retrieve(mailRepositoryIterator.next());
                mailboxManager.startProcessingRequest(mailboxSession);
                messageManager.appendMessage(new MimeMessageInputStream(mail.getMessage()), new Date(), mailboxSession, isRecent, flags);
                mailboxManager.endProcessingRequest(mailboxSession);
            }

        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.