本文整理汇总了C#中MessageFlags.ToMimeFormat方法的典型用法代码示例。如果您正苦于以下问题:C# MessageFlags.ToMimeFormat方法的具体用法?C# MessageFlags.ToMimeFormat怎么用?C# MessageFlags.ToMimeFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageFlags
的用法示例。
在下文中一共展示了MessageFlags.ToMimeFormat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StoreSilent
/// <summary>
/// The STORE command alters data associated with a message in the mailbox.
/// http://tools.ietf.org/html/rfc2060#section-6.4.6
/// </summary>
/// <param name = "set">The sequence set representing the targeted messages, e.g. "1"; "1,2"; "2:4".</param>
/// <param name = "flags">The flags to add or remove.</param>
/// <param name = "procedure">The procedure, whether to add or remove the flags.</param>
public ImapResponse StoreSilent(SequenceSet set, MessageFlags flags, StoreProcedures procedure)
{
var value = flags.ToMimeFormat();
return StoreSilent(set, value, procedure);
}
示例2: Append
/// <summary>
/// The APPEND command appends the literal argument as a new message
/// to the end of the specified destination mailbox.
/// http://tools.ietf.org/html/rfc3501#section-6.3.11
/// </summary>
/// <param name = "mailboxName">The name of the malbox to insert the message.</param>
/// <param name = "message">The message to append.</param>
/// <param name = "flags">Sets the flags of the message. This is optional.</param>
public ImapResponse Append(string mailboxName, Message message, MessageFlags flags = (MessageFlags) 0x0000)
{
// we need to convert non ASCII names according to IMAP specs.
// http://tools.ietf.org/html/rfc2060#section-5.1.3
var name = MailboxNameEncoder.Encode(mailboxName);
var mime = message.ToMime();
var size = mime.Length;
var flagString = flags == 0x0000 ? string.Empty : string.Format(" ({0})", flags.ToMimeFormat());
var text = string.Format("APPEND {0}{1} {{{2}}}", name, flagString, size);
var reader = SendAndReceive(new ImapCommand(text));
if (reader.IsContinuation) {
var finalReader = SendAndReceive(new BlankImapCommand(mime));
var validResponse = new ImapResponse();
validResponse.Parse(finalReader);
return validResponse;
}
var invalidResponse = new ImapResponse();
invalidResponse.Parse(reader);
return invalidResponse;
}