Package org.apache.james.mime4j.dom.address

Examples of org.apache.james.mime4j.dom.address.Mailbox


        assertEquals("From: JD <john.doe@acme.org>, "
                + "Mary Smith <mary@example.net>", decode(field));
    }

    public void testTo() throws Exception {
        Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("JD <john.doe@acme.org>");
        Mailbox mailbox2 = AddressBuilder.DEFAULT.parseMailbox("jane.doe@example.org");
        Mailbox mailbox3 = AddressBuilder.DEFAULT.parseMailbox("Mary Smith <mary@example.net>");
        Group group = new Group("The Does", mailbox1, mailbox2);

        AddressListField field = Fields.to(group);
        assertEquals("To: The Does: JD <john.doe@acme.org>, "
                + "jane.doe@example.org;", decode(field));
View Full Code Here


                + "jane.doe@example.org;, Mary Smith\r\n <mary@example.net>",
                decode(field));
    }

    public void testCc() throws Exception {
        Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("JD <john.doe@acme.org>");
        Mailbox mailbox2 = AddressBuilder.DEFAULT.parseMailbox("jane.doe@example.org");
        Mailbox mailbox3 = AddressBuilder.DEFAULT.parseMailbox("Mary Smith <mary@example.net>");
        Group group = new Group("The Does", mailbox1, mailbox2);

        AddressListField field = Fields.cc(group);
        assertEquals("Cc: The Does: JD <john.doe@acme.org>, "
                + "jane.doe@example.org;", decode(field));
View Full Code Here

                + "jane.doe@example.org;, Mary Smith\r\n <mary@example.net>",
                decode(field));
    }

    public void testBcc() throws Exception {
        Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("JD <john.doe@acme.org>");
        Mailbox mailbox2 = AddressBuilder.DEFAULT.parseMailbox("jane.doe@example.org");
        Mailbox mailbox3 = AddressBuilder.DEFAULT.parseMailbox("Mary Smith <mary@example.net>");
        Group group = new Group("The Does", mailbox1, mailbox2);

        AddressListField field = Fields.bcc(group);
        assertEquals("Bcc: The Does: JD <john.doe@acme.org>, "
                + "jane.doe@example.org;", decode(field));
View Full Code Here

                + "jane.doe@example.org;, Mary Smith\r\n <mary@example.net>",
                decode(field));
    }

    public void testReplyTo() throws Exception {
        Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("JD <john.doe@acme.org>");
        Mailbox mailbox2 = AddressBuilder.DEFAULT.parseMailbox("jane.doe@example.org");
        Mailbox mailbox3 = AddressBuilder.DEFAULT.parseMailbox("Mary Smith <mary@example.net>");
        Group group = new Group("The Does", mailbox1, mailbox2);

        AddressListField field = Fields.replyTo(group);
        assertEquals("Reply-To: The Does: JD <john.doe@acme.org>, "
                + "jane.doe@example.org;", decode(field));
View Full Code Here

                .parseMailbox("JD <john.doe@acme.org>"));
        assertEquals("Resent-Sender: JD <john.doe@acme.org>", decode(field));
    }

    public void testMailboxList() throws Exception {
        Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("JD <john.doe@acme.org>");
        Mailbox mailbox2 = AddressBuilder.DEFAULT.parseMailbox("Mary Smith <mary@example.net>");

        MailboxListField field = Fields.mailboxList("Resent-From", Arrays
                .asList(mailbox1, mailbox2));
        assertEquals("Resent-From: JD <john.doe@acme.org>, "
                + "Mary Smith <mary@example.net>", decode(field));
View Full Code Here

        assertEquals("Resent-From: JD <john.doe@acme.org>, "
                + "Mary Smith <mary@example.net>", decode(field));
    }

    public void testAddressList() throws Exception {
        Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("JD <john.doe@acme.org>");
        Mailbox mailbox2 = AddressBuilder.DEFAULT.parseMailbox("jane.doe@example.org");
        Mailbox mailbox3 = AddressBuilder.DEFAULT.parseMailbox("Mary Smith <mary@example.net>");
        Group group = new Group("The Does", mailbox1, mailbox2);

        AddressListField field = Fields.addressList("Resent-To", Arrays.asList(
                group, mailbox3));
        assertEquals("Resent-To: The Does: JD <john.doe@acme.org>, "
View Full Code Here

    }

    public void testSetFrom() throws Exception {
        MessageImpl m = new MessageImpl();

        Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("john.doe@example.net");
        Mailbox mailbox2 = AddressBuilder.DEFAULT.parseMailbox("jane.doe@example.net");

        m.setFrom(mailbox1);
        assertEquals("john.doe@example.net", m.getHeader().getField("From")
                .getBody());
View Full Code Here

    }

    public void testSetTo() throws Exception {
        MessageImpl m = new MessageImpl();

        Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("john.doe@example.net");
        Mailbox mailbox2 = AddressBuilder.DEFAULT.parseMailbox("jane.doe@example.net");
        Group group = new Group("Does", mailbox1, mailbox2);
        Mailbox mailbox3 = AddressBuilder.DEFAULT.parseMailbox("Mary Smith <mary@example.net>");

        m.setTo(group);
        assertEquals("Does: john.doe@example.net, jane.doe@example.net;", m
                .getHeader().getField("To").getBody());
View Full Code Here

    }

    public void testSetCc() throws Exception {
        MessageImpl m = new MessageImpl();

        Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("john.doe@example.net");
        Mailbox mailbox2 = AddressBuilder.DEFAULT.parseMailbox("jane.doe@example.net");
        Group group = new Group("Does", mailbox1, mailbox2);
        Mailbox mailbox3 = AddressBuilder.DEFAULT.parseMailbox("Mary Smith <mary@example.net>");

        m.setCc(group);
        assertEquals("Does: john.doe@example.net, jane.doe@example.net;", m
                .getHeader().getField("Cc").getBody());
View Full Code Here

    }

    public void testSetBcc() throws Exception {
        MessageImpl m = new MessageImpl();

        Mailbox mailbox1 = AddressBuilder.DEFAULT.parseMailbox("john.doe@example.net");
        Mailbox mailbox2 = AddressBuilder.DEFAULT.parseMailbox("jane.doe@example.net");
        Group group = new Group("Does", mailbox1, mailbox2);
        Mailbox mailbox3 = AddressBuilder.DEFAULT.parseMailbox("Mary Smith <mary@example.net>");

        m.setBcc(group);
        assertEquals("Does: john.doe@example.net, jane.doe@example.net;", m
                .getHeader().getField("Bcc").getBody());
View Full Code Here

TOP

Related Classes of org.apache.james.mime4j.dom.address.Mailbox

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.