当前位置: 首页>>代码示例>>Java>>正文


Java GreenMailUtil.newMimeMessage方法代码示例

本文整理汇总了Java中com.icegreen.greenmail.util.GreenMailUtil.newMimeMessage方法的典型用法代码示例。如果您正苦于以下问题:Java GreenMailUtil.newMimeMessage方法的具体用法?Java GreenMailUtil.newMimeMessage怎么用?Java GreenMailUtil.newMimeMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.icegreen.greenmail.util.GreenMailUtil的用法示例。


在下文中一共展示了GreenMailUtil.newMimeMessage方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readDotTerminatedContent

import com.icegreen.greenmail.util.GreenMailUtil; //导入方法依赖的package包/类
/**
 * Reads the contents of the stream until
 * <CRLF>.<CRLF> is encountered.
 * <p/>
 * <p/>
 * It would be possible and prehaps desirable to prevent the
 * adding of an unnecessary CRLF at the end of the message, but
 * it hardly seems worth 30 seconds of effort.
 * </p>
 */
public void readDotTerminatedContent(BufferedReader in)
        throws IOException {
    _content = _workspace.getTmpFile();
    Writer data = _content.getWriter();
    PrintWriter dataWriter = new InternetPrintWriter(data);

    while (true) {
        String line = in.readLine();
        if (line == null)
            throw new EOFException("Did not receive <CRLF>.<CRLF>");

        if (".".equals(line)) {
            dataWriter.close();

            break;
        } else {
            dataWriter.println(line);
        }
    }
    try {
        message = GreenMailUtil.newMimeMessage(_content.getAsString());
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-greenmail,代码行数:36,代码来源:MovingMessage.java

示例2: mimeMessage

import com.icegreen.greenmail.util.GreenMailUtil; //导入方法依赖的package包/类
/**
 * Reads a MimeMessage encoded as a string literal from the request.
 * TODO shouldn't need to read as a string and write out bytes
 * use FixedLengthInputStream instead. Hopefully it can then be dynamic.
 *
 * @param request The Imap APPEND request
 * @return A MimeMessage read off the request.
 */
public MimeMessage mimeMessage(ImapRequestLineReader request)
        throws ProtocolException {
    request.nextWordChar();
    String mailString = consumeLiteral(request);

    try {
        return GreenMailUtil.newMimeMessage(mailString);
    } catch (Exception e) {
        throw new ProtocolException("UnexpectedException: " + e.getMessage());
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-greenmail,代码行数:20,代码来源:AppendCommand.java

示例3: readDotTerminatedContent

import com.icegreen.greenmail.util.GreenMailUtil; //导入方法依赖的package包/类
/**
 * Reads the contents of the stream until
 * &lt;CRLF&gt;.&lt;CRLF&gt; is encountered.
 * <p/>
 * <p/>
 * It would be possible and perhaps desirable to prevent the
 * adding of an unnecessary CRLF at the end of the message, but
 * it hardly seems worth 30 seconds of effort.
 * </p>
 */
public void readDotTerminatedContent(BufferedReader in)
        throws IOException {
    _content = _workspace.getTmpFile();
    Writer data = _content.getWriter();
    PrintWriter dataWriter = new InternetPrintWriter(data);

    while (true) {
        String line = in.readLine();
        if (line == null)
            throw new EOFException("Did not receive <CRLF>.<CRLF>");

        if (".".equals(line)) {
            dataWriter.close();

            break;
        } else if (line.startsWith(".")) {
            dataWriter.println(line.substring(1));
        } else {
            dataWriter.println(line);
        }
    }
    try {
        message = GreenMailUtil.newMimeMessage(_content.getAsString());
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:greenmail-mail-test,项目名称:greenmail,代码行数:38,代码来源:MovingMessage.java

示例4: mimeMessage

import com.icegreen.greenmail.util.GreenMailUtil; //导入方法依赖的package包/类
/**
 * Reads a MimeMessage encoded as a string literal from the request.
 * TODO shouldn't need to read as a string and write out bytes
 * use FixedLengthInputStream instead. Hopefully it can then be dynamic.
 *
 * @param request The Imap APPEND request
 * @return A MimeMessage read off the request.
 */
public MimeMessage mimeMessage(ImapRequestLineReader request)
        throws ProtocolException {
    request.nextWordChar();
    byte[] mail = consumeLiteralAsBytes(request);

    try {
        return GreenMailUtil.newMimeMessage(new ByteArrayInputStream(mail));
    } catch (Exception e) {
        throw new ProtocolException("Can not create new mime message", e);
    }
}
 
开发者ID:greenmail-mail-test,项目名称:greenmail,代码行数:20,代码来源:AppendCommand.java

示例5: testMimeMessageLoading

import com.icegreen.greenmail.util.GreenMailUtil; //导入方法依赖的package包/类
@Test
public void testMimeMessageLoading() throws MessagingException {
    MimeMessage message = GreenMailUtil.newMimeMessage(SAMPLE_EMAIL);
    assertEquals("wassup", message.getSubject());
}
 
开发者ID:greenmail-mail-test,项目名称:greenmail,代码行数:6,代码来源:GreenMailUtilTest.java

示例6: testGetBody

import com.icegreen.greenmail.util.GreenMailUtil; //导入方法依赖的package包/类
@Test
public void testGetBody() throws MessagingException, IOException {
    MimeMessage message = GreenMailUtil.newMimeMessage(SAMPLE_EMAIL);
    String body = GreenMailUtil.getBody(message);
    assertEquals("Yo wassup Bertil", body.trim());
}
 
开发者ID:greenmail-mail-test,项目名称:greenmail,代码行数:7,代码来源:GreenMailUtilTest.java

示例7: newMimeMessage

import com.icegreen.greenmail.util.GreenMailUtil; //导入方法依赖的package包/类
@Override
public MimeMessage newMimeMessage(final InputStream inputStream) {
	return GreenMailUtil.newMimeMessage(inputStream);
}
 
开发者ID:rbattenfeld,项目名称:arquillian-extension-mail-master,代码行数:5,代码来源:DefaultMailTestUtil.java

示例8: createMailMessage

import com.icegreen.greenmail.util.GreenMailUtil; //导入方法依赖的package包/类
/**
 * create mime message with given content
 * @param mailString
 * @return
 * @throws MessagingException
 */

public MimeMessage createMailMessage(String mailString ) throws MessagingException {
    return GreenMailUtil.newMimeMessage(mailString);
}
 
开发者ID:wso2,项目名称:carbon-platform-integration,代码行数:11,代码来源:EmailServerUtil.java


注:本文中的com.icegreen.greenmail.util.GreenMailUtil.newMimeMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。