本文整理汇总了C#中OpenPop.Mime.Message.GetBodyAsText方法的典型用法代码示例。如果您正苦于以下问题:C# Message.GetBodyAsText方法的具体用法?C# Message.GetBodyAsText怎么用?C# Message.GetBodyAsText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenPop.Mime.Message
的用法示例。
在下文中一共展示了Message.GetBodyAsText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestContentTypeCharsetWithLargeFirstChar
public void TestContentTypeCharsetWithLargeFirstChar()
{
const string messagePartContent =
"Content-Type: TEXT/PLAIN; Charset=\"US-ASCII\"\r\n" +
"\r\n" + // End of message headers
"foo";
MessagePart messagePart = new Message(Encoding.ASCII.GetBytes(messagePartContent)).MessagePart;
Assert.AreEqual(Encoding.ASCII, messagePart.BodyEncoding);
Assert.AreEqual("foo", messagePart.GetBodyAsText());
}
示例2: TestQuotedPrintableDoesNotDecodeUnderscoresInBody
public void TestQuotedPrintableDoesNotDecodeUnderscoresInBody()
{
const string messagePartContent =
"Content-Transfer-Encoding: quoted-printable\r\n" +
"\r\n" + // End of message headers
"a_a";
MessagePart messagePart = new Message(Encoding.ASCII.GetBytes(messagePartContent)).MessagePart;
// QuotedPrintable, when used as Content-Transfer-Encoding does not decode _ to spaces
const string expectedBody = "a_a";
string actualBody = messagePart.GetBodyAsText();
Assert.AreEqual(expectedBody, actualBody);
}