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

Examples of com.alibaba.citrus.service.mail.builder.content.TextContent


    @Test
    public void mail_textContent() throws Exception {
        // no text
        getAndAssertMail("textContent_empty", "GBK", null);

        TextContent content = (TextContent) builder.getContent();
        assertEquals("text/plain", content.getContentType());
        assertEquals("", content.getText());

        String eml = getMessageAsText();

        assertThat(eml, containsRegex("Subject: " + REGEX_EOL));
        assertThat(eml, containsRegex("Content-Type: text/plain; charset=GBK" + REGEX_EOL));
        assertThat(eml, containsRegex("Content-Transfer-Encoding: 8bit" + REGEX_EOL));
        assertThat(eml, containsRegex(REGEX_EOL + REGEX_EOL + "$"));

        // with text
        getAndAssertMail("textContent_withText", "GBK", null);

        content = (TextContent) builder.getContent();
        assertEquals("text/html", content.getContentType());
        assertEquals("hello, 中国", content.getText());

        eml = getMessageAsText();

        assertThat(eml, containsRegex("Subject: " + REGEX_EOL));
        assertThat(eml, containsRegex("Content-Type: text/html; charset=GBK" + REGEX_EOL));
View Full Code Here


        attachable.setId("attachable");

        MultipartContent alternative = new AlternativeMultipartContent();
        alternative.setId("alternative");

        TextContent plainText = new TextContent("我爱北京敏感词", "text/plain");
        plainText.setId("plainText");

        TextContent htmlText = new TextContent("<爱北京敏感词>", "text/html");
        htmlText.setId("htmlText");

        TextTemplateContent plainTextTemplate = new TextTemplateContent("mail/mytemplate.vm", "text/plain");
        plainTextTemplate.setId("plainTextTemplate");

        AttachmentContent textAttachment = new AttachmentContent("testfile.txt");
View Full Code Here

TOP

Related Classes of com.alibaba.citrus.service.mail.builder.content.TextContent

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.