Package org.apache.james.mime4j.field.address

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


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

    public void testCc() throws Exception {
        Mailbox mailbox1 = Mailbox.parse("JD <john.doe@acme.org>");
        Mailbox mailbox2 = Mailbox.parse("jane.doe@example.org");
        Mailbox mailbox3 = Mailbox.parse("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.getRaw()));
View Full Code Here


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

    public void testBcc() throws Exception {
        Mailbox mailbox1 = Mailbox.parse("JD <john.doe@acme.org>");
        Mailbox mailbox2 = Mailbox.parse("jane.doe@example.org");
        Mailbox mailbox3 = Mailbox.parse("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.getRaw()));
View Full Code Here

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

    public void testReplyTo() throws Exception {
        Mailbox mailbox1 = Mailbox.parse("JD <john.doe@acme.org>");
        Mailbox mailbox2 = Mailbox.parse("jane.doe@example.org");
        Mailbox mailbox3 = Mailbox.parse("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.getRaw()));
View Full Code Here

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

    public void testMailboxList() throws Exception {
        Mailbox mailbox1 = Mailbox.parse("JD <john.doe@acme.org>");
        Mailbox mailbox2 = Mailbox.parse("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.getRaw()));
View Full Code Here

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

    public void testAddressList() throws Exception {
        Mailbox mailbox1 = Mailbox.parse("JD <john.doe@acme.org>");
        Mailbox mailbox2 = Mailbox.parse("jane.doe@example.org");
        Mailbox mailbox3 = Mailbox.parse("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 {
        Message m = new Message();

        Mailbox mailbox1 = Mailbox.parse("john.doe@example.net");
        Mailbox mailbox2 = Mailbox.parse("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 {
        Message m = new Message();

        Mailbox mailbox1 = Mailbox.parse("john.doe@example.net");
        Mailbox mailbox2 = Mailbox.parse("jane.doe@example.net");
        Group group = new Group("Does", mailbox1, mailbox2);
        Mailbox mailbox3 = Mailbox.parse("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 {
        Message m = new Message();

        Mailbox mailbox1 = Mailbox.parse("john.doe@example.net");
        Mailbox mailbox2 = Mailbox.parse("jane.doe@example.net");
        Group group = new Group("Does", mailbox1, mailbox2);
        Mailbox mailbox3 = Mailbox.parse("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 {
        Message m = new Message();

        Mailbox mailbox1 = Mailbox.parse("john.doe@example.net");
        Mailbox mailbox2 = Mailbox.parse("jane.doe@example.net");
        Group group = new Group("Does", mailbox1, mailbox2);
        Mailbox mailbox3 = Mailbox.parse("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

    }

    public void testSetReplyTo() throws Exception {
        Message m = new Message();

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

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

TOP

Related Classes of org.apache.james.mime4j.field.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.