Package org.apache.mailet

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


public class PostmasterAlias extends GenericMailet {

    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

* @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().toLowerCase())
            && mailetContext.isLocalUser(recipient.getUser());
    }
View Full Code Here

* @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

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

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

* @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

    }

    private void setupMatcher() throws MessagingException {

        MailetContext FakeMailContext = new MailetContext() {

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

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

                "a", "a.com") }));
        MimeMessage mimeMessage = new MimeMessage(Session
                .getDefaultInstance(new Properties()));
        mimeMessage.setText("TEST");
        aMail.setMessage(mimeMessage);
        MailetContext aMailetContext = new MockMailetContext();
        Action action = new ActionKeep();
        try {
            ActionDispatcher.getInstance().execute(action, aMail,
                    aMailetContext);
            isTestPassed = true;
View Full Code Here

     * Test execute of ActionAbsent. Should throw a NoSuchMethodException.
     */
    public void testExecuteActionAbsent() {
        boolean isTestPassed = false;
        Mail aMail = new MailImpl();
        MailetContext aMailetContext = new MockMailetContext();
        Action action = new ActionAbsent();
        try {
            ActionDispatcher.getInstance().execute(action, aMail,
                    aMailetContext);
        } catch (NoSuchMethodException e) {
View Full Code Here

            String recipient;
            PersonContactVO pc;
            List<PersonContactVO> pcs = new ArrayList<PersonContactVO>();

            MimeMessage message = mail.getMessage();
            MailetContext mailetContext = getMailetContext();
            contact = new ContactVO();

            contact.setBoundType(ContactVO.BoundType.IN);
            contact.setContactType(ContactVO.ContactType.EMAIL);
            contact.setContactTimestamp(new Date());
            contact.setImportType(ContactVO.ImportType.NEW);

            // Subject setzen
            if (message.getSubject() != null)
                contact.setSubject(message.getSubject());
            else
                contact.setSubject("Kein Betreff angegeben");

            // Content Setzen
            insertContent(message);
            if (contentTypetext)
                contact.setContentType(ContactVO.ContentType.PLAINTEXT);
            else
                contact.setContentType(ContactVO.ContentType.HTML);

            // Absender
            List<PersonVO> senders = new PersonDAO().getByMail(mail.getSender().toString());
            if (!senders.isEmpty())
                for (PersonVO person : senders)
                {
                    pc = new PersonContactVO(person, contact);
                    pc.setRelationType(PersonContactVO.Type.SENDER);
                    pcs.add(pc);
                    if ((mailetContext.isLocalUser(mail.getSender().getUser())) && mailetContext.isLocalServer(mail.getSender().getHost()))
                    {
                        contact.setBoundType(ContactVO.BoundType.OUT);
                    }
                }
            else
View Full Code Here

TOP

Related Classes of org.apache.mailet.MailetContext

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.