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

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


        return domains != null ? new DomainList(domains, true) : null;
    }

    private Mailbox createMailbox(
            final String name, final DomainList route, final String localPart, final String domain) {
        return new Mailbox(
                name != null ? DecoderUtil.decodeEncodedWords(name, this.monitor) : null,
                        route, localPart, domain);
    }
View Full Code Here


        return createMailbox(openingText, domainList, localPart, domain);
    }

    private Mailbox createMailbox(final String localPart) {
        if (localPart != null && localPart.length() > 0) {
            return new Mailbox(null, null, localPart, null);
        } else {
            return null;
        }
    }
View Full Code Here

        } else if (current == AT) {
            // localPart @ domain form
            cursor.updatePos(pos + 1);
            String localPart = openingText;
            String domain = parseDomain(buf, cursor, delimiters);
            return new Mailbox(null, null, localPart, domain);
        } else {
            return createMailbox(openingText);
        }
    }
View Full Code Here

            if (delimiters != null && delimiters.get(current)) {
                break;
            } else if (current == COMMA) {
                cursor.updatePos(pos + 1);
            } else {
                Mailbox mbox = parseMailbox(buf, cursor, bitset);
                if (mbox != null) {
                    mboxes.add(mbox);
                }
            }
        }
View Full Code Here

        } else if (current == AT) {
            // localPart @ domain form
            cursor.updatePos(pos + 1);
            String localPart = openingText;
            String domain = parseDomain(buf, cursor, delimiters);
            return new Mailbox(null, null, localPart, domain);
        } else if (current == COLON) {
            // group-name: localPart @ domain, name <localPart @ domain>; form
            cursor.updatePos(pos + 1);
            String name = openingText;
            List<Mailbox> mboxes = parseMailboxes(buf, cursor, SEMICOLON_ONLY);
View Full Code Here

                try {
                    name = DecoderUtil.decodeEncodedWords(name, monitor);
                } catch (IllegalArgumentException e) {
                    throw new ParseException(e.getMessage());
                }
                Mailbox mb = buildAngleAddr((ASTangle_addr) n2);
                return new Mailbox(name, mb.getRoute(), mb.getLocalPart(),
                        mb.getDomain());
            } else {
                throw new ParseException();
            }
        } else {
            throw new ParseException();
View Full Code Here

            try {
                name = DecoderUtil.decodeEncodedWords(name, monitor);
            } catch (IllegalArgumentException e) {
                throw new ParseException(e.getMessage());
            }
            Mailbox mb = buildAngleAddr((ASTangle_addr) n);
            return new Mailbox(name, mb.getRoute(), mb.getLocalPart(),
                    mb.getDomain());
        } else {
            throw new ParseException();
        }
    }
View Full Code Here

    private Mailbox buildAddrSpec(DomainList route, ASTaddr_spec node) {
        ChildNodeIterator it = new ChildNodeIterator(node);
        String localPart = buildString((ASTlocal_part) it.next(), true);
        String domain = buildString((ASTdomain) it.next(), true);
        return new Mailbox(route, localPart, domain);
    }
View Full Code Here

                 */
                AddressListField field = (AddressListField) o;
                MailboxList list = field.getAddressList().flatten();
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < list.size(); i++) {
                    Mailbox mb = list.get(i);
                    sb.append(AddressFormatter.DEFAULT.format(mb, false) + "\n");
                }
                textView.setText(sb.toString());

            } else if (o instanceof DateTimeField) {
View Full Code Here

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

    public void testFrom() 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.from(mailbox1);
        assertEquals("From: JD <john.doe@acme.org>", decode(field));

        field = Fields.from(mailbox1, mailbox2);
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.