Examples of MimeMessageInputStreamSource


Examples of org.apache.james.core.MimeMessageInputStreamSource

            if ( !session.getCurrentMailbox().hasInsertRights( session.getCurrentUser() ) ) {
                session.noResponse( command, "Insert access not granted." );
                return true;
            }
           
            MimeMessageInputStreamSource source;
            try {
                source =
                    new MimeMessageInputStreamSource("Mail" + System.currentTimeMillis() + "-" + mailbox.getNextUID(),
                                                     new ByteArrayInputStream(byteout.toByteArray()));
            } catch (MessagingException me) {
                me.printStackTrace();
                return false;
            }
View Full Code Here

Examples of org.apache.james.core.MimeMessageInputStreamSource

     * @param mail
     * @throws MessagingException
     */
    protected void populateMailMimeMessage(Message message, Mail mail) throws MessagingException {
        if (message instanceof BytesMessage) {
            mail.setMessage(new MimeMessageCopyOnWriteProxy(new MimeMessageInputStreamSource(mail.getName(), new BytesMessageInputStream((BytesMessage) message))));
        } else {
            throw new MailQueueException("Not supported JMS Message received " + message);
        }

    }
View Full Code Here

Examples of org.apache.james.core.MimeMessageInputStreamSource

       this.mailboxManager = mailboxManager;
   }
  
    @SuppressWarnings("unchecked")
    public void onLine(SMTPSession session, byte[] line, LineHandler<SMTPSession> next) {
        MimeMessageInputStreamSource mmiss = (MimeMessageInputStreamSource) session.getState().get(SMTPConstants.DATA_MIMEMESSAGE_STREAMSOURCE);

        try {
            OutputStream out = mmiss.getWritableOutputStream();

            // 46 is "."
            // Stream terminated
            if (line.length == 3 && line[0] == 46) {
                out.flush();
View Full Code Here

Examples of org.apache.james.core.MimeMessageInputStreamSource

                    mail.setAttribute(JAMES_BLOB_URL, blobMessage.getURL());
                } catch (MalformedURLException e) {
                    // Ignore on error
                    logger.debug("Unable to get url from blobmessage for mail " + mail.getName());
                }
                mail.setMessage(new MimeMessageCopyOnWriteProxy(new MimeMessageInputStreamSource(mail.getName(), blobMessage.getInputStream())));

            } catch (IOException e) {
                throw new MailQueueException("Unable to populate MimeMessage for mail " + mail.getName(), e);
            } catch (JMSException e) {
                throw new MailQueueException("Unable to populate MimeMessage for mail " + mail.getName(), e);
View Full Code Here

Examples of org.apache.james.core.MimeMessageInputStreamSource

            if ( !session.getCurrentMailbox().hasInsertRights( session.getCurrentUser() ) ) {
                session.noResponse( command, "Insert access not granted." );
                return true;
            }
           
            MimeMessageInputStreamSource source;
            try {
                source =
                    new MimeMessageInputStreamSource("Mail" + System.currentTimeMillis() + "-" + mailbox.getNextUID(),
                                                     new ByteArrayInputStream(byteout.toByteArray()));
            } catch (MessagingException me) {
                me.printStackTrace();
                return false;
            }
View Full Code Here

Examples of org.apache.james.core.MimeMessageInputStreamSource

                if (in instanceof SharedInputStream) {
                    String sourceId = message.getJMSMessageID();
                    long size = message.getLongProperty(JAMES_MAIL_MESSAGE_SIZE);
                    source = new MimeMessageBlobMessageSource((SharedInputStream) in, size, sourceId);
                } else {
                    source = new MimeMessageInputStreamSource(mail.getName(), in);
                }
       
                mail.setMessage(new MimeMessageCopyOnWriteProxy(source));
            } catch (IOException e) {
                throw new MailQueueException("Unable to populate MimeMessage for mail " + mail.getName(), e);
View Full Code Here

Examples of org.apache.james.core.MimeMessageInputStreamSource

            if ( !session.getCurrentMailbox().hasInsertRights( session.getCurrentUser() ) ) {
                session.noResponse( command, "Insert access not granted." );
                return true;
            }
           
            MimeMessageInputStreamSource source;
            try {
                source =
                    new MimeMessageInputStreamSource("Mail" + System.currentTimeMillis() + "-" + mailbox.getNextUID(),
                                                     new ByteArrayInputStream(byteout.toByteArray()));
            } catch (MessagingException me) {
                me.printStackTrace();
                return false;
            }
View Full Code Here

Examples of org.apache.james.core.MimeMessageInputStreamSource

    }

    protected void setUp() throws Exception {
        super.setUp();
        mailRepository = getMailRepository();
        MimeMessageInputStreamSource mmis = null;
        try {
            mmis = new MimeMessageInputStreamSource("test", new SharedByteArrayInputStream((content+sep+body).getBytes()));
        } catch (MessagingException e) {
        }
        mimeMessage = new MimeMessageCopyOnWriteProxy(mmis);
        Collection<MailAddress> recipients = new ArrayList<MailAddress>();
        recipients.add(new MailAddress("rec1","domain.com"));
View Full Code Here

Examples of org.apache.james.core.MimeMessageInputStreamSource

       this.mailboxManager = mailboxManager;
   }
  
    @SuppressWarnings("unchecked")
    public void onLine(SMTPSession session, byte[] line, LineHandler<SMTPSession> next) {
        MimeMessageInputStreamSource mmiss = (MimeMessageInputStreamSource) session.getState().get(SMTPConstants.DATA_MIMEMESSAGE_STREAMSOURCE);

        try {
            OutputStream out = mmiss.getWritableOutputStream();

            // 46 is "."
            // Stream terminated
            if (line.length == 3 && line[0] == 46) {
                out.flush();
View Full Code Here

Examples of org.apache.james.core.MimeMessageInputStreamSource

     * @param session SMTP session object
     * @param argument the argument passed in with the command by the SMTP client
     */
    protected SMTPResponse doDATA(SMTPSession session, String argument) {
        try {
            MimeMessageInputStreamSource mmiss = new MimeMessageInputStreamSource(mailServer.getId());
            session.getState().put(SMTPConstants.DATA_MIMEMESSAGE_STREAMSOURCE, mmiss);
        } catch (MessagingException e) {
            session.getLogger().warn("Error creating mimemessagesource for incoming data",e);
            return new SMTPResponse(SMTPRetCode.LOCAL_ERROR, "Unexpected error preparing to receive DATA.");
        }
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.