Package com.alibaba.citrus.service.mail.builder

Examples of com.alibaba.citrus.service.mail.builder.MailBuilderException


        String resourceName = inlineResource.getResourceName();
        Resource resource = resourceLoader.getResource(resourceName);

        if (!resource.exists()) {
            throw new MailBuilderException("Could not find resource \"" + resourceName + "\"");
        }

        DataSource ds;

        try {
View Full Code Here


     */
    protected final String renderTemplate() throws MailBuilderException {
        try {
            return getTemplateService().getText(templateName, getTemplateContext());
        } catch (TemplateException e) {
            throw new MailBuilderException("Failed to render template: " + templateName, e);
        } catch (IOException e) {
            throw new MailBuilderException("Failed to render template: " + templateName, e);
        }
    }
View Full Code Here

        protected final void render(Part mailPart, String fileName, DataSource source) throws MailBuilderException {
            try {
                mailPart.setDataHandler(new DataHandler(source));

                if (isEmpty(fileName)) {
                    throw new MailBuilderException("No fileName was specified with " + this);
                }

                // ȷ��fileName�в�����/��\
                fileName = fileName.replace('\\', '/');
                fileName = StringUtil.defaultIfEmpty(StringUtil.substringAfterLast(fileName, "/"), fileName);

                mailPart.setFileName(MailUtil.encodeHeader(fileName, getMailBuilder().getCharacterEncoding()));
            } catch (MessagingException e) {
                throw new MailBuilderException("Failed to add attachment to the mail", e);
            } catch (UnsupportedEncodingException e) {
                throw new MailBuilderException("Failed to add attachment to the mail", e);
            }
        }
View Full Code Here

                if (!StringUtil.isEmpty(subject)) {
                    mailPart.setDescription(MailUtil.encodeHeader(subject, getMailBuilder().getCharacterEncoding()));
                }
            } catch (MessagingException e) {
                throw new MailBuilderException("Failed to add attachment to the mail", e);
            } catch (UnsupportedEncodingException e) {
                throw new MailBuilderException("Failed to add attachment to the mail", e);
            }
        }
View Full Code Here

        @Override
        protected void render(Part mailPart, String fileName) {
            ResourceLoader resourceLoader = containingContent.getResourceLoader();

            if (resourceLoader == null) {
                throw new MailBuilderException("Could not find resource \"" + resourceName
                        + "\": no resourceLoader specified");
            }

            Resource resource = resourceLoader.getResource(resourceName);

            if (!resource.exists()) {
                throw new MailBuilderException("Could not find resource \"" + resourceName + "\"");
            }

            DataSource ds;

            try {
View Full Code Here

        @Override
        protected void render(Part mailPart, String fileName) {
            MailService mailService = getMailBuilder().getMailService();

            if (mailService == null) {
                throw new MailBuilderException("Could not find mail \"" + mailRef + "\": no MailService");
            }

            MailBuilder mailBuilder;

            try {
                mailBuilder = mailService.getMailBuilder(mailRef);
            } catch (MailNotFoundException e) {
                throw new MailBuilderException("Could not find mail \"" + mailRef + "\"", e);
            }

            Message mail = mailBuilder.getMessage(getMailBuilder().getSession());

            render(mailPart, mail);
View Full Code Here

        @Override
        protected void render(Part mailPart, String fileName) {
            MailService mailService = getMailBuilder().getMailService();

            if (mailService == null) {
                throw new MailBuilderException("Could not find mail \"" + mailRef + "\": no MailService");
            }

            MailBuilder mailBuilder;

            try {
                mailBuilder = mailService.getMailBuilder(mailRef);
            } catch (MailNotFoundException e) {
                throw new MailBuilderException("Could not find mail \"" + mailRef + "\"", e);
            }

            Message mail = mailBuilder.getMessage(getMailBuilder().getSession());

            render(mailPart, mail);
View Full Code Here

        String resourceName = inlineResource.getResourceName();
        Resource resource = resourceLoader.getResource(resourceName);

        if (!resource.exists()) {
            throw new MailBuilderException("Could not find resource \"" + resourceName + "\"");
        }

        DataSource ds;

        try {
View Full Code Here

    /** 渲染模板。 */
    protected final String renderTemplate() throws MailBuilderException {
        try {
            return getTemplateService().getText(templateName, getTemplateContext());
        } catch (TemplateException e) {
            throw new MailBuilderException("Failed to render template: " + templateName, e);
        } catch (IOException e) {
            throw new MailBuilderException("Failed to render template: " + templateName, e);
        }
    }
View Full Code Here

        protected final void render(Part mailPart, String fileName, DataSource source) throws MailBuilderException {
            try {
                mailPart.setDataHandler(new DataHandler(source));

                if (isEmpty(fileName)) {
                    throw new MailBuilderException("No fileName was specified with " + this);
                }

                // 确保fileName中不包含/和\
                fileName = fileName.replace('\\', '/');
                fileName = StringUtil.defaultIfEmpty(StringUtil.substringAfterLast(fileName, "/"), fileName);

                mailPart.setFileName(MailUtil.encodeHeader(fileName, getMailBuilder().getCharacterEncoding()));
            } catch (MessagingException e) {
                throw new MailBuilderException("Failed to add attachment to the mail", e);
            } catch (UnsupportedEncodingException e) {
                throw new MailBuilderException("Failed to add attachment to the mail", e);
            }
        }
View Full Code Here

TOP

Related Classes of com.alibaba.citrus.service.mail.builder.MailBuilderException

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.