Examples of MailetContext


Examples of org.apache.mailet.MailetContext

     * @throws MessagingException if an error is encountered while modifying the message
     */
    public void service(Mail mail) throws MessagingException {
        Collection recipients = mail.getRecipients();
        Collection recipientsToRemove = null;
        MailetContext mailetContext = getMailetContext();
        boolean postmasterAddressed = false;

        for (Iterator i = recipients.iterator(); i.hasNext(); ) {
            MailAddress addr = (MailAddress)i.next();
            if (addr.getLocalPart().equalsIgnoreCase("postmaster") &&
                mailetContext.isLocalServer(addr.getDomain())) {
                //Should remove this address... we want to replace it with
                //  the server's postmaster address
                if (recipientsToRemove == null) {
                    recipientsToRemove = new Vector();
                }
View Full Code Here

Examples of org.apache.mailet.MailetContext

* @version 1.0.0, 24/04/1999
*/
public class RecipientIsLocal extends GenericRecipientMatcher {

    public boolean matchRecipient(MailAddress recipient) {
        MailetContext mailetContext = getMailetContext();
        //This might change after startup
        return mailetContext.isLocalEmail(recipient);
    }
View Full Code Here

Examples of org.apache.mailet.MailetContext

    }

    private void setupMatcher() throws MessagingException {

        MailetContext FakeMailContext = new MailetContext() {

            Collection localServer = new ArrayList(Arrays.asList(LOCALSERVER));

            public void bounce(Mail mail, String message)
                    throws MessagingException {
View Full Code Here

Examples of org.apache.mailet.MailetContext

* @author Serge Knystautas <sergek@lokitech.com>
*/
public class RecipientIsLocal extends GenericRecipientMatcher {

    public boolean matchRecipient(MailAddress recipient) {
        MailetContext mailetContext = getMailetContext();
        //This might change after startup
        return mailetContext.isLocalServer(recipient.getHost())
            && mailetContext.isLocalUser(recipient.getUser());
    }
View Full Code Here

Examples of org.apache.mailet.MailetContext

     * @throws MessagingException if an error is encountered while modifying the message
     */
    public void service(Mail mail) throws MessagingException {
        Collection recipients = mail.getRecipients();
        Collection recipientsToRemove = null;
        MailetContext mailetContext = getMailetContext();
        boolean postmasterAddressed = false;

        for (Iterator i = recipients.iterator(); i.hasNext(); ) {
            MailAddress addr = (MailAddress)i.next();
            if (addr.getUser().equalsIgnoreCase("postmaster") &&
                mailetContext.isLocalServer(addr.getHost())) {
                //Should remove this address... we want to replace it with
                //  the server's postmaster address
                if (recipientsToRemove == null) {
                    recipientsToRemove = new Vector();
                }
View Full Code Here

Examples of org.apache.mailet.MailetContext

     * to its check.
     *
     * @param recipient the recipient to check
     */   
    protected boolean isRecipientChecked(MailAddress recipient) throws MessagingException {
        MailetContext mailetContext = getMailetContext();
        return super.isRecipientChecked(recipient) && (mailetContext.isLocalServer(recipient.getHost()) && mailetContext.isLocalUser(recipient.getUser()));
    }
View Full Code Here

Examples of org.apache.mailet.MailetContext

            // do the new DSN bounce
            // setting attributes for DSN mailet
            mail.setAttribute("delivery-error", ex);
            mail.setState(bounceProcessor);
            // re-insert the mail into the spool for getting it passed to the dsn-processor
            MailetContext mc = getMailetContext();
            try {
                mc.sendMail(mail);
            } catch (MessagingException e) {
                // we shouldn't get an exception, because the mail was already processed
                log("Exception re-inserting failed mail: ", e);
            }
        } else {
View Full Code Here

Examples of org.apache.mailet.MailetContext

     * to its check.
     *
     * @param recipient the recipient to check
     */   
    protected boolean isRecipientChecked(MailAddress recipient) throws MessagingException {
        MailetContext mailetContext = getMailetContext();
        return super.isRecipientChecked(recipient) && (mailetContext.isLocalEmail(recipient));
    }
View Full Code Here

Examples of org.apache.mailet.MailetContext

                cause = ex.getMessage();
            }
            mail.setAttribute("delivery-error", cause);
            mail.setState(bounceProcessor);
            // re-insert the mail into the spool for getting it passed to the dsn-processor
            MailetContext mc = getMailetContext();
            try {
                mc.sendMail(mail);
            } catch (MessagingException e) {
                // we shouldn't get an exception, because the mail was already processed
                log("Exception re-inserting failed mail: ", e);
            }
        } else {
View Full Code Here

Examples of org.apache.mailet.MailetContext

    public void init(MailetConfig config) throws MessagingException {
        this.config = config;
    }

    public void service(Mail mail) throws MessagingException {
        MailetContext context = config.getMailetContext();
        context.log("Hello, World!");
        context.log("You have mail from " + mail.getSender().getLocalPart());
    }
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.