Package org.apache.james.protocols.smtp

Examples of org.apache.james.protocols.smtp.MailAddress


    @Test
    public void testWhiteListed() throws MailAddressException {
        DNSRBLHandler rbl = createHandler();

        setRemoteIp("127.0.0.2");
        setupMockedSMTPSession(new MailAddress("any@domain"));

        rbl.setWhitelist(new String[] { "bl.spamcop.net." });
        rbl.setGetDetail(true);
        rbl.doRcpt(mockedSMTPSession, null, new MailAddress("test@localhost"));
        assertNull(mockedSMTPSession.getAttachment(RBL_DETAIL_MAIL_ATTRIBUTE_NAME, State.Connection));
        assertNull("Not blocked", mockedSMTPSession.getAttachment(RBL_BLOCKLISTED_MAIL_ATTRIBUTE_NAME, State.Connection));
    }
View Full Code Here


        };
    }

    @Test
    public void testSPFpass() throws Exception {
        MailAddress sender = new MailAddress("test@spf1.james.apache.org");
        MailAddress rcpt = new MailAddress("test@localhost");
        setupMockedSMTPSession("192.168.100.1", "spf1.james.apache.org");
        SPFHandler spf = new SPFHandler();

        spf.setDNSService(mockedDnsService);
View Full Code Here

        assertEquals("declined", HookReturnCode.DECLINED, spf.doRcpt(mockedSMTPSession, sender, rcpt).getResult());
    }

    @Test
    public void testSPFfail() throws Exception {
        MailAddress sender = new MailAddress("test@spf2.james.apache.org");
        MailAddress rcpt = new MailAddress("test@localhost");
        setupMockedSMTPSession("192.168.100.1", "spf2.james.apache.org");
        SPFHandler spf = new SPFHandler();

        spf.setDNSService(mockedDnsService);
View Full Code Here

        assertEquals("fail", HookReturnCode.DENY, spf.doRcpt(mockedSMTPSession, sender, rcpt).getResult());
    }

    @Test
    public void testSPFsoftFail() throws Exception {
        MailAddress sender = new MailAddress("test@spf3.james.apache.org");
        MailAddress rcpt = new MailAddress("test@localhost");
        setupMockedSMTPSession("192.168.100.1", "spf3.james.apache.org");
        SPFHandler spf = new SPFHandler();

        spf.setDNSService(mockedDnsService);
View Full Code Here

                spf.doRcpt(mockedSMTPSession, sender, rcpt).getResult());
    }

    @Test
    public void testSPFsoftFailRejectEnabled() throws Exception {
        MailAddress sender = new MailAddress("test@spf3.james.apache.org");
        MailAddress rcpt = new MailAddress("test@localhost");

        setupMockedSMTPSession("192.168.100.1", "spf3.james.apache.org");
        SPFHandler spf = new SPFHandler();

        spf.setDNSService(mockedDnsService);
View Full Code Here

        assertEquals("softfail reject", HookReturnCode.DENY, spf.doRcpt(mockedSMTPSession, sender, rcpt).getResult());
    }

    @Test
    public void testSPFpermError() throws Exception {
        MailAddress sender = new MailAddress("test@spf4.james.apache.org");
        MailAddress rcpt = new MailAddress("test@localhost");

        setupMockedSMTPSession("192.168.100.1", "spf4.james.apache.org");
        SPFHandler spf = new SPFHandler();

        spf.setDNSService(mockedDnsService);
View Full Code Here

        assertEquals("permerror reject", HookReturnCode.DENY, spf.doRcpt(mockedSMTPSession, sender, rcpt).getResult());
    }

    @Test
    public void testSPFtempError() throws Exception {
        MailAddress sender = new MailAddress("test@spf5.james.apache.org");
        MailAddress rcpt = new MailAddress("test@localhost");

        setupMockedSMTPSession("192.168.100.1", "spf5.james.apache.org");

        SPFHandler spf = new SPFHandler();
View Full Code Here

                getResult());
    }

    @Test
    public void testSPFNoRecord() throws Exception {
        MailAddress sender = new MailAddress("test@spf6.james.apache.org");
        MailAddress rcpt = new MailAddress("test@localhost");

        setupMockedSMTPSession("192.168.100.1", "spf6.james.apache.org");
        SPFHandler spf = new SPFHandler();

        spf.setDNSService(mockedDnsService);
View Full Code Here

        assertEquals("declined", HookReturnCode.DECLINED, spf.doRcpt(mockedSMTPSession, sender, rcpt).getResult());
    }

    @Test
    public void testSPFpermErrorRejectDisabled() throws Exception {
        MailAddress sender = new MailAddress("test@spf4.james.apache.org");
        MailAddress rcpt = new MailAddress("test@localhost");
        setupMockedSMTPSession("192.168.100.1", "spf4.james.apache.org");
        SPFHandler spf = new SPFHandler();

        spf.setDNSService(mockedDnsService);
View Full Code Here

        return conf;
    }

    @Test
    public void testRejectInvalidUser() throws Exception {
        MailAddress mailAddress = new MailAddress(INVALID_USER + "@localhost");
        SMTPSession session = setupMockedSMTPSession(setupMockedSMTPConfiguration(), mailAddress, false);

        int rCode = handler.doRcpt(session, null, mailAddress).getResult();

        assertEquals("Rejected", rCode, HookReturnCode.DENY);
View Full Code Here

TOP

Related Classes of org.apache.james.protocols.smtp.MailAddress

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.