Examples of DeliverEvent


Examples of com.ettrema.mail.DeliverEvent

     *
     */
    public void deliver(String sFrom, String sRecipient, final InputStream data) throws TooMuchDataException, IOException {
        log.debug("deliver email from: " + sFrom + " to: " + sRecipient);
        log.debug("email from: " + sFrom + " to: " + sRecipient);
        final DeliverEvent event = new DeliverEvent(sFrom, sRecipient, data);
        Filter terminal = new Filter() {

            public void doEvent(FilterChain chain, Event e) {
                MailboxAddress from = MailboxAddress.parse(event.getFrom());
                MailboxAddress recip = MailboxAddress.parse(event.getRecipient());

                MimeMessage mm = parseInput(data);

                Mailbox recipMailbox = resourceFactory.getMailbox(recip);
                log.debug("recipient is known to us, so store: " + recip);
View Full Code Here

Examples of com.ettrema.mail.DeliverEvent

     */
    @Override
    public void deliver(String sFrom, String sRecipient, final InputStream data) throws TooMuchDataException, IOException {
        log.debug("deliver email from: " + sFrom + " to: " + sRecipient);
        log.debug("email from: " + sFrom + " to: " + sRecipient);
        final DeliverEvent event = new DeliverEvent(sFrom, sRecipient, data);
        Filter terminal = new Filter() {

            public void doEvent(FilterChain chain, Event e) {
                MailboxAddress from = MailboxAddress.parse(event.getFrom());
                MailboxAddress recip = MailboxAddress.parse(event.getRecipient());

                MimeMessage mm = parseInput(data);

                Mailbox recipMailbox = resourceFactory.getMailbox(recip);
                if (recipMailbox != null && !recipMailbox.isEmailDisabled()) {
                    log.debug("recipient is known to us, so store: " + recip);
                    storeMail(recipMailbox,mm);
                } else {
                    Mailbox fromMailbox = resourceFactory.getMailbox(from);
                    if (fromMailbox != null && !fromMailbox.isEmailDisabled() ) {
                        log.debug("known from address, so will transmit: from: " + from);
                        mailSender.sendMail(mm);
                    } else {
                        throw new NullPointerException("Neither from address nor recipient are known to us. Will not store or send: from: " + event.getFrom() + " to: " + event.getRecipient());
                    }
                }

            }
        };
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.