Package mireka.smtp

Examples of mireka.smtp.RejectExceptionExt


            try {
                appender = maildrop.allocateAppender();
            } catch (LocalMailSystemException e) {
                logger.error("Cannot accept mail because of a "
                        + "maildrop failure", e);
                throw new RejectExceptionExt(e.errorStatus());
            }
            OutputStream out;
            try {
                out = appender.getOutputStream();
            } catch (LocalMailSystemException e) {
                logger.error("Cannot accept mail because of a "
                        + "maildrop failure", e);
                appender.rollback();
                throw new RejectExceptionExt(e.errorStatus());
            }
            try {
                out.write(constructReturnPathLine(mail));
                mail.mailData.writeTo(out);
            } catch (IOException e) {
                logger.error(
                        "Cannot accept mail because of an IO error "
                                + "occured while the mail was written into the maildrop",
                        e);
                appender.rollback();
                throw new RejectExceptionExt(
                        EnhancedStatus.TRANSIENT_LOCAL_ERROR_IN_PROCESSING);
            }
            try {
                appender.commit();
            } catch (LocalMailSystemException e) {
                logger.error("Cannot accept mail because of a "
                        + "maildrop failure", e);
                throw new RejectExceptionExt(e.errorStatus());
            }
        } finally {
            maildropRepository.releaseMaildrop(maildrop);
        }
    }
View Full Code Here


            message.setSubject(subject, "UTF-8");
            message.setText("");
            return message;
        } catch (MessagingException e) {
            logger.error("Cannot create a mail list MimeMessage", e);
            throw new RejectExceptionExt(
                    EnhancedStatus.TRANSIENT_LOCAL_ERROR_IN_PROCESSING);
        }
    }
View Full Code Here

            transmitter.transmit(mail);
            logger.debug("Transformed mail was submitted to transmitter: {}",
                    mail);
        } catch (LocalMailSystemException e) {
            logger.error("Cannot transmit mail", e);
            throw new RejectExceptionExt(e.errorStatus());
        } finally {
            mail.mailData.dispose();
        }
    }
View Full Code Here

        public FilterReply verifyRecipient(RecipientContext recipientContext)
                throws RejectExceptionExt {
            DnsblResult dnsblResult = dnsblChecker.getResult();
            if (dnsblResult.isListed) {
                EnhancedStatus smtpReply = calculateSmtpReply(dnsblResult);
                throw new RejectExceptionExt(smtpReply);
            }
            return FilterReply.NEUTRAL;
        }
View Full Code Here

        InputStream in;
        try {
            in = getMail().mailData.getInputStream();
        } catch (IOException e) {
            logger.error("Cannot open mail data input stream", e);
            throw new RejectExceptionExt(
                    EnhancedStatus.TRANSIENT_LOCAL_ERROR_IN_PROCESSING);
        }
        try {
            return new MimeMessage(session, in);
        } catch (MessagingException e) {
            logger.debug("Cannot parse MimeMessage", e);
            throw new RejectExceptionExt(EnhancedStatus.BAD_MESSAGE_BODY);
        } finally {
            try {
                in.close();
            } catch (IOException e) {
                logger.warn("Cannot close mail data input stream", e);
View Full Code Here

            transmitter.transmit(mail);
            logger.debug("Forward list mail was submitted to transmitter: {}",
                    mail);
        } catch (LocalMailSystemException e) {
            logger.error("Cannot transmit mail", e);
            throw new RejectExceptionExt(e.errorStatus());
        }
    }
View Full Code Here

            try {
                deferredFileOutputStream.close();
            } catch (IOException e1) {
                logger.warn("Cannot close deferredFileOutputStream", e1);
            }
            throw new RejectExceptionExt(
                    EnhancedStatus.TRANSIENT_LOCAL_ERROR_IN_PROCESSING);
        } catch (MessagingException e) {
            logger.error("Cannot write MimeMessage", e);
            try {
                deferredFileOutputStream.close();
            } catch (IOException e1) {
                logger.warn("Cannot close deferredFileOutputStream", e1);
            }
            throw new RejectExceptionExt(
                    EnhancedStatus.TRANSIENT_LOCAL_ERROR_IN_PROCESSING);
        }
        return new DeferredFileMailData(deferredFileOutputStream);
    }
View Full Code Here

        if (isMember(mail.getMail().from))
            return;
        if (nonMemberSenderValidator != null
                && nonMemberSenderValidator.shouldBeAccepted(mail))
            return;
        throw new RejectExceptionExt(new EnhancedStatus(550, "5.7.2",
                membersOnlyMessage));
    }
View Full Code Here

        if (attachmentsAllowed)
            return;

        try {
            if (mail.getMimeMessage().getContent() instanceof MimeMultipart) {
                throw new RejectExceptionExt(new EnhancedStatus(550, "5.7.0",
                        "Attachments are not allowed on this mailing list"));
            }
        } catch (IOException e) {
            logger.error("Cannot get content of a mail", e);
            throw new RejectExceptionExt(EnhancedStatus.BAD_MESSAGE_BODY);
        } catch (MessagingException e) {
            logger.error("Message content cannot be parsed", e);
            throw new RejectExceptionExt(EnhancedStatus.BAD_MESSAGE_BODY);
        }
    }
View Full Code Here

            // Check if the X-been-there header is set to the listserv's name
            // (the address). If it has, this means it's a message from this
            // listserv that's getting bounced back, so we need to swallow it
            if (address.toString().equals(
                    outgoingMessage.getHeader("X-been-there"))) {
                throw new RejectExceptionExt(new EnhancedStatus(450, "4.4.6",
                        "Mail list loop detected"));
            }

            setSubject(outgoingMessage);

            // If replies should go to this list, we need to set the header
            if (replyToList) {
                outgoingMessage.setHeader("Reply-To", address.toString());
            }
            // We're going to set this special header to avoid bounces
            // getting sent back out to the list
            outgoingMessage.setHeader("X-been-there", address.toString());

            outgoingMessage.setHeader("List-Id", "<" + listId + ">");
            outgoingMessage.setHeader("List-Post", "<" + address + ">");
            outgoingMessage.removeHeader("List-Help");
            outgoingMessage.removeHeader("List-Unsubscribe");
            outgoingMessage.removeHeader("List-Subscribe");
            outgoingMessage.removeHeader("List-Owner");
            outgoingMessage.removeHeader("List-Archive");

            return outgoingMessage;
        } catch (MessagingException e) {
            logger.error("Cannot create a mail list MimeMessage", e);
            throw new RejectExceptionExt(
                    EnhancedStatus.TRANSIENT_LOCAL_ERROR_IN_PROCESSING);
        }
    }
View Full Code Here

TOP

Related Classes of mireka.smtp.RejectExceptionExt

Copyright © 2018 www.massapicom. 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.