Package mireka.smtp

Examples of mireka.smtp.EnhancedStatus


        @Override
        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


    private static EnhancedStatus enhancedStatusFromRemoteResponse(
            MailSystemStatus smtpStatus) {
        if (smtpStatus instanceof EnhancedStatus) {
            return (EnhancedStatus) smtpStatus;
        } else if (smtpStatus instanceof Rfc821Status) {
            return new EnhancedStatus((Rfc821Status) smtpStatus);
        } else {
            throw new RuntimeException("Unexpected: " + smtpStatus.getClass());
        }
    }
View Full Code Here

                    + "exactly.  "
                    + "Dropping the enhanced status information. "
                    + e.toString());
            return new Rfc821Status(originalResponse);
        }
        return new EnhancedStatus(originalResponse.getCode(),
                enhancedStatusCode, message);
    }
View Full Code Here

        } catch (UnknownHostException e) {
            // impossible
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new SendException("Connection failed: " + e.toString(), e,
                    new EnhancedStatus(450, "4.4.0",
                            "No answer from host or bad connection"), remoteMta);
        } finally {
            if (smartClient != null) {
                smartClient.quit();
            }
View Full Code Here

        Integer connectionCountObject = connections.get(address);
        int connectionCount =
                connectionCountObject == null ? 0 : connectionCountObject;
        if (connectionCount >= maxConnectionsToHost) {
            int recommendedDelay = 5 + random.nextInt(11);
            throw new PostponeException(recommendedDelay, new EnhancedStatus(
                    451, "4.4.5",
                    "Too much connections to the destination system"),
                    "There are already " + connectionCount
                            + " connections to host " + address
                            + ", it must not be connected now. "
View Full Code Here

        Response srcResponse = new Response(500, ENHANCED_EXAMPLE);
        MailSystemStatus basicResponse =
                new ResponseParser()
                        .createResponseLookingForEnhancedStatusCode(srcResponse);
        assertThat(basicResponse, instanceOf(EnhancedStatus.class));
        EnhancedStatus enhancedResponse = (EnhancedStatus) basicResponse;
        assertEquals("5.7.1", enhancedResponse.getEnhancedStatusCode());

        assertEquals("Delivery not authorized, message refused",
                enhancedResponse.getMessage());
        assertEquals(500, enhancedResponse.getSmtpReplyCode());
    }
View Full Code Here

                new MailAddressFactory().createRecipient("jane@example.com");
        // f.status =
        // new EnhancedStatus(550, "5.2.1",
        // "Mailbox disabled, not accepting messages");

        f.status = new EnhancedStatus(550, "5.2.1", longErrorMessage());
        f.remoteMtaDiagnosticStatus =
                new Rfc821Status(new Response(550,
                        "Requested action not taken: mailbox unavailable"));
        f.remoteMta = new RemoteMta(IP3.getHostName());
        f.failureDate = new Date();
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);
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);
View Full Code Here

TOP

Related Classes of mireka.smtp.EnhancedStatus

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.