Examples of MailImpl


Examples of org.apache.james.core.MailImpl

     *                            on the spool
     */
    public void sendMail( MailAddress sender, Collection recipients, MimeMessage message, String state )
            throws MessagingException
    {
        MailImpl mail = new MailImpl( getId(), sender, recipients, message );
        mail.setState( state );
        sendMail( mail );
    }
View Full Code Here

Examples of org.apache.james.core.MailImpl

        // if headers do not contains minimum REQUIRED headers fields throw Exception
        if ( !headers.isValid() ) {
            throw new MessagingException( "Some REQURED header field is missing. Invalid Message" );
        }
        ByteArrayInputStream headersIn = new ByteArrayInputStream( headers.toByteArray() );
        sendMail( new MailImpl( getId(), sender, recipients, new SequenceInputStream( headersIn, msg ) ) );
    }
View Full Code Here

Examples of org.apache.james.core.MailImpl

     * @throws MessagingException if an exception is caught while placing the mail
     *                            on the spool
     */
    public void sendMail( Mail mail ) throws MessagingException
    {
        MailImpl mailimpl = ( MailImpl ) mail;
        try {
            spool.store( mailimpl );
        }
        catch ( Exception e ) {
            try {
                spool.remove( mailimpl );
            }
            catch ( Exception ignored ) {
            }
            throw new MessagingException( "Exception spooling message: " + e.getMessage(), e );
        }
        if ( getLogger().isDebugEnabled() ) {
            StringBuffer logBuffer =
                    new StringBuffer( 64 )
                    .append( "Mail " )
                    .append( mailimpl.getName() )
                    .append( " pushed in spool" );
            getLogger().debug( logBuffer.toString() );
        }
    }
View Full Code Here

Examples of org.apache.james.core.MailImpl

        if ( useIMAPstorage ) {
            ImapMailbox mbox = null;
            try {
                user = ( JamesUser ) localusers.getUserByName( username );
                mbox = imapHost.getInbox( user );
                MailImpl mail = new MailImpl( message );
                mbox.store( mail );
                getLogger().info( "Message " + message.getMessageID() +
                                  " stored in " +
                                  mbox.getFullName() );
                mbox = null;
            }
            catch ( Exception e ) {
                getLogger().error( "Exception storing mail: " + e );
                e.printStackTrace();
                if ( mbox != null ) {
                    mbox = null;
                }
                throw new RuntimeException( "Exception storing mail: " + e );
            }
        }
        else {
            Collection recipients = new HashSet();
            recipients.add( recipient );
            MailImpl mailImpl = new MailImpl( getId(), sender, recipients, message );
            MailRepository userInbox = getUserInbox( username );
            if ( userInbox == null ) {
                StringBuffer errorBuffer =
                        new StringBuffer( 128 )
                        .append( "The inbox for user " )
View Full Code Here

Examples of org.apache.james.core.MailImpl

     * @throws MessagingException if an exception is caught while placing the mail
     *                            on the spool
     */
    public void sendMail(MailAddress sender, Collection recipients, MimeMessage message, String state)
            throws MessagingException {
        MailImpl mail = new MailImpl(getId(), sender, recipients, message);
        mail.setState(state);
        sendMail(mail);
    }
View Full Code Here

Examples of org.apache.james.core.MailImpl

        // if headers do not contains minimum REQUIRED headers fields throw Exception
        if (!headers.isValid()) {
            throw new MessagingException("Some REQURED header field is missing. Invalid Message");
        }
        ByteArrayInputStream headersIn = new ByteArrayInputStream(headers.toByteArray());
        sendMail(new MailImpl(getId(), sender, recipients, new SequenceInputStream(headersIn, msg)));
    }
View Full Code Here

Examples of org.apache.james.core.MailImpl

     *
     * @throws MessagingException if an exception is caught while placing the mail
     *                            on the spool
     */
    public void sendMail(Mail mail) throws MessagingException {
        MailImpl mailimpl = (MailImpl)mail;
        try {
            spool.store(mailimpl);
        } catch (Exception e) {
            try {
                spool.remove(mailimpl);
            } catch (Exception ignored) {
            }
            throw new MessagingException("Exception spooling message: " + e.getMessage(), e);
        }
        if (getLogger().isDebugEnabled()) {
            StringBuffer logBuffer =
                new StringBuffer(64)
                        .append("Mail ")
                        .append(mailimpl.getName())
                        .append(" pushed in spool");
            getLogger().debug(logBuffer.toString());
        }
    }
View Full Code Here

Examples of org.apache.james.core.MailImpl

            }
        }

        Collection recipients = new HashSet();
        recipients.add(recipient);
        MailImpl mailImpl = new MailImpl(getId(), sender, recipients, message);
        MailRepository userInbox = getUserInbox(username);
        if (userInbox == null) {
            StringBuffer errorBuffer =
                new StringBuffer(128)
                    .append("The inbox for user ")
View Full Code Here

Examples of org.apache.james.core.MailImpl

    private void stat() {
        userMailbox = new Vector();
        userMailbox.addElement(DELETED);
        for (Iterator it = userInbox.list(); it.hasNext(); ) {
            String key = (String) it.next();
            MailImpl mc = userInbox.retrieve(key);
            // Retrieve can return null if the mail is no longer in the store.
            // In this case we simply continue to the next key
            if (mc == null) {
                continue;
            }
View Full Code Here

Examples of org.apache.james.core.MailImpl

        if (state == TRANSACTION) {
            long size = 0;
            int count = 0;
            try {
                for (Enumeration e = userMailbox.elements(); e.hasMoreElements(); ) {
                    MailImpl mc = (MailImpl) e.nextElement();
                    if (mc != DELETED) {
                        size += mc.getMessageSize();
                        count++;
                    }
                }
                StringBuffer responseBuffer =
                    new StringBuffer(32)
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.