Package org.apache.mailet

Examples of org.apache.mailet.MailetException


     */
    public void init() throws MailetException {
        attributeName = getInitParameter(ATTRIBUTE_PARAMETER_NAME);

        if (attributeName == null) {
            throw new MailetException(ATTRIBUTE_PARAMETER_NAME
                    + " is a mandatory parameter");
        }

        log("RecoverAttachment is initialised with attribute [" + attributeName
                + "]");
View Full Code Here


            MimeMessage message;
            try {
                message = mail.getMessage();
            } catch (MessagingException e) {
                throw new MailetException(
                        "Could not retrieve message from Mail object", e);
            }

            Iterator<byte[]> i = attachments.values().iterator();
            try {
View Full Code Here

                    mail.getMessage().saveChanges();
                }
            }
           
        } catch (MessagingException e) {
            throw new MailetException("Could not unwrap message", e);
           
        } catch (IOException e) {
            throw new MailetException("Could not unwrap message", e);
        }
       
    }
View Full Code Here

     */
    public void init() throws MailetException {
        isDebug = (getInitParameter("debug") == null) ? false : Boolean.valueOf(getInitParameter("debug"));
        processor = getInitParameter("processor");
        if (processor == null) {
            throw new MailetException("processor parameter is required");
        }
        noticeText = getInitParameter("notice");
    }
View Full Code Here

     * @param mail the mail to process
     *
     * @throws MailetException in all cases
     */
    public void service(Mail mail) throws MessagingException {
        throw new MailetException("General protection fault");
    }
View Full Code Here

            else if (mail.getMessage().isMimeType("text/html")) {
                setContentFromPart(mail.getMessage(), mail.getMessage(), html2Text((String) mail.getMessage().getContent()), true);
            }
           
        } catch (IOException e) {
            throw new MailetException("Failed fetching text part", e);
           
        } catch (MessagingException e) {
            throw new MailetException("Failed fetching text part", e);
        }
    }
View Full Code Here

            StringTokenizer st = new StringTokenizer(header, ",");
            while (st.hasMoreTokens()) {
                headers.add(st.nextToken());
            }
        } else {
            throw new MailetException(
                    "Invalid config. Please specify atleast one name");
        }
    }
View Full Code Here

            while (st.hasMoreTokens()) {
                String attribute_name = st.nextToken().trim() ;
                attributesToRemove.add(attribute_name);
            }
        } else {
            throw new MailetException("Please configure at least one attribute to remove");
        }
    }
View Full Code Here

     */
    public void init() throws MailetException {
        String patternString = getInitParameter(PATTERN_PARAMETER_NAME);
        String notpatternString = getInitParameter(NOTPATTERN_PARAMETER_NAME);
        if (patternString == null && notpatternString == null) {
            throw new MailetException("No value for " + PATTERN_PARAMETER_NAME
                    + " parameter was provided.");
        }

        directoryName = getInitParameter(DIRECTORY_PARAMETER_NAME);
        attributeName = getInitParameter(ATTRIBUTE_PARAMETER_NAME);

        removeAttachments = getInitParameter(REMOVE_ATTACHMENT_PARAMETER_NAME,
                REMOVE_NONE).toLowerCase();
        if (!REMOVE_MATCHED.equals(removeAttachments)
                && !REMOVE_ALL.equals(removeAttachments)) {
            removeAttachments = REMOVE_NONE;
        }

        try {
            // if (patternString != null) regExPattern = new
            // Perl5Compiler().compile(patternString);
            if (patternString != null)
                regExPattern = Pattern.compile(patternString);
        } catch (Exception e) {
            throw new MailetException("Could not compile regex ["
                    + patternString + "].");
        }
        try {
            // if (notpatternString != null) notregExPattern = new
            // Perl5Compiler().compile(notpatternString);
            if (notpatternString != null)
                notregExPattern = Pattern.compile(notpatternString);
        } catch (Exception e) {
            throw new MailetException("Could not compile regex ["
                    + notpatternString + "].");
        }

        if (directoryName != null) {
            try {
                File saveDirectory;
                saveDirectory = new File(directoryName);
                if (!saveDirectory.exists()) {
                    saveDirectory.mkdirs();
                }
            } catch (Exception e) {
                throw new MailetException("Could not create directory ["
                        + directoryName + "].", e);
            }
        }

        decodeFilename = getBooleanParameter(
View Full Code Here

    public void service(Mail mail) throws MailetException {
        MimeMessage message;
        try {
            message = mail.getMessage();
        } catch (MessagingException e) {
            throw new MailetException(
                    "Could not retrieve message from Mail object", e);
        }
        // All MIME messages with an attachment are multipart, so we do nothing
        // if it is not mutlipart
        try {
            if (message.isMimeType("multipart/*")) {
                analyseMultipartPartMessage(message, mail);
            }
        } catch (MessagingException e) {
            throw new MailetException("Could not retrieve contenttype of message.", e);
        } catch (Exception e) {
            throw new MailetException("Could not analyse message.", e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.mailet.MailetException

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.