Examples of MailAddress


Examples of org.apache.mailet.MailAddress

    // ip not on blacklist
    public void testNotBlackListed() throws ParseException {
        DNSRBLHandler rbl = new DNSRBLHandler();

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

        rbl.setDNSService(mockedDnsServer);

        rbl.setBlacklist(new String[] { "bl.spamcop.net." });
        rbl.setGetDetail(true);
        rbl.doRcpt(mockedSMTPSession, null, new MailAddress("test@localhost"));
        assertNull("No details",mockedSMTPSession.getConnectionState().get(RBL_DETAIL_MAIL_ATTRIBUTE_NAME));
        assertNull("Not blocked",mockedSMTPSession.getConnectionState().get(RBL_BLOCKLISTED_MAIL_ATTRIBUTE_NAME));
    }
View Full Code Here

Examples of org.apache.mailet.MailAddress

    // ip on blacklist without txt details
    public void testBlackListedNoTxt() throws ParseException {
        DNSRBLHandler rbl = new DNSRBLHandler();

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

        rbl.setDNSService(mockedDnsServer);

        rbl.setBlacklist(new String[] { "bl.spamcop.net." });
        rbl.setGetDetail(true);
        rbl.doRcpt(mockedSMTPSession, null, new MailAddress("test@localhost"));
        assertNull(mockedSMTPSession.getConnectionState().get(RBL_DETAIL_MAIL_ATTRIBUTE_NAME));
        assertNotNull("Blocked",mockedSMTPSession.getConnectionState().get(RBL_BLOCKLISTED_MAIL_ATTRIBUTE_NAME));
    }
View Full Code Here

Examples of org.apache.mailet.MailAddress

    // ip on whitelist
    public void testWhiteListed() throws ParseException {
        DNSRBLHandler rbl = new DNSRBLHandler();

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

        rbl.setDNSService(mockedDnsServer);

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

Examples of org.apache.mailet.MailAddress

     * @param argument
     *            the argument passed in with the command by the SMTP client
     */
    private SMTPResponse doMAIL(SMTPSession session, String argument) {
        StringBuilder responseBuffer = new StringBuilder();
        MailAddress sender = (MailAddress) session.getState().get(
                SMTPSession.SENDER);
        responseBuffer.append(
                DSNStatus.getStatus(DSNStatus.SUCCESS, DSNStatus.ADDRESS_OTHER))
                .append(" Sender <");
        if (sender != null) {
View Full Code Here

Examples of org.apache.mailet.MailAddress

                return new SMTPResponse(SMTPRetCode.SYNTAX_ERROR_ARGUMENTS,
                        DSNStatus.getStatus(DSNStatus.PERMANENT,
                                DSNStatus.ADDRESS_SYNTAX_SENDER)
                                + " Syntax error in MAIL command");
            }
            MailAddress senderAddress = null;

            if (session.useAddressBracketsEnforcement()
                    || (sender.startsWith("<") && sender.endsWith(">"))) {
                // Remove < and >
                sender = sender.substring(1, sender.length() - 1);
            }

            if (sender.length() == 0) {
                // This is the <> case. Let senderAddress == null
            } else {

                if (sender.indexOf("@") < 0) {
                    sender = sender
                            + "@"
                            + getDefaultDomain();
                }

                try {
                    senderAddress = new MailAddress(sender);
                } catch (Exception pe) {
                    if (session.getLogger().isInfoEnabled()) {
                        StringBuilder errorBuffer = new StringBuilder(256)
                                .append("Error parsing sender address: ")
                                .append(sender).append(": ").append(
View Full Code Here

Examples of org.apache.mailet.MailAddress

        boolean useForwarding = rsUsers.getBoolean(4);
        String forwardingDestination = rsUsers.getString(5);
        boolean useAlias = rsUsers.getBoolean(6);
        String alias = rsUsers.getString(7);

        MailAddress forwardAddress = null;
        if ( forwardingDestination != null ) {
            try {
                forwardAddress = new MailAddress(forwardingDestination);
            }
            catch (javax.mail.internet.ParseException pe) {
                StringBuffer exceptionBuffer =
                    new StringBuffer(256)
                        .append("Invalid mail address in database: ")
View Full Code Here

Examples of org.apache.mailet.MailAddress

        stmt.setString(nameIndex, jamesUser.getUserName());
        stmt.setString(1 + colOffset, jamesUser.getHashedPassword());
        stmt.setString(2 + colOffset, jamesUser.getHashAlgorithm());
        stmt.setInt(3 + colOffset, (jamesUser.getForwarding() ? 1 : 0));

        MailAddress forwardAddress = jamesUser.getForwardingDestination();
        String forwardDestination = null;
        if ( forwardAddress != null ) {
            forwardDestination = forwardAddress.toString();
        }
        stmt.setString(4 + colOffset, forwardDestination);
        stmt.setInt(5 + colOffset, (jamesUser.getAliasing() ? 1 : 0));
        stmt.setString(6 + colOffset, jamesUser.getAlias());
    }
View Full Code Here

Examples of org.apache.mailet.MailAddress

     *
     * @return String
     */
    public String getEnvelopeFrom()
    {
        MailAddress sender = getMail().getSender();
        return (null == sender ? "" : sender.toString());
    }
View Full Code Here

Examples of org.apache.mailet.MailAddress

        if (null != originalRecipients && originalRecipients.length > 0)
        {
            original_recipient = originalRecipients[0];
        }

        MailAddress soleRecipient = ActionUtils.getSoleRecipient(aMail);
        String final_recipient = soleRecipient.toString();

        String original_message_id = aMail.getMessage().getMessageID();

        DispositionModifier modifiers[] = {new ModifierError()};
        Disposition disposition = new Disposition(new ActionModeAutomatic(),
                new SendingModeAutomatic(), new TypeDeleted(), modifiers);

        MimeMultipart multiPart = MDNFactory.create(humanText.toString(),
                reporting_UA_name, reporting_UA_product, original_recipient,
                final_recipient, original_message_id, disposition);

        // Send the message
        MimeMessage reply = (MimeMessage) aMail.getMessage().reply(false);
        reply.setFrom(soleRecipient.toInternetAddress());
        reply.setContent(multiPart);
        reply.saveChanges();
        Address[] recipientAddresses = reply.getAllRecipients();
        if (null != recipientAddresses)
        {
            Collection recipients = new ArrayList(recipientAddresses.length);
            for (int i = 0; i < recipientAddresses.length; i++)
            {
                recipients.add(new MailAddress(
                        (InternetAddress) recipientAddresses[i]));
            }
            context.post(null, recipients, reply);
        }
        else
View Full Code Here

Examples of org.apache.mailet.MailAddress

    public void execute(ActionRedirect anAction, Mail aMail, ActionContext context) throws MessagingException
    {
        ActionUtils.detectAndHandleLocalLooping(aMail, context, "redirect");
        Collection recipients = new ArrayList(1);
        recipients.add(new InternetAddress(anAction.getAddress()));
        MailAddress sender = aMail.getSender();
        context.post(sender, recipients, aMail.getMessage());
        aMail.setState(Mail.GHOST);
        Log log = context.getLog();
        if (log.isDebugEnabled()) {
            log.debug("Redirected Message ID: "
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.