public static EmailMessage Create(BodyFormat bodyFormat, bool createAlternative, string charsetName) { if (bodyFormat != BodyFormat.Text && bodyFormat != BodyFormat.Html) { throw new ArgumentException(EmailMessageStrings.CannotCreateSpecifiedBodyFormat(bodyFormat.ToString())); } if (bodyFormat == BodyFormat.Text && createAlternative) { throw new ArgumentException(EmailMessageStrings.CannotCreateAlternativeBody); } Charset.GetCharset(charsetName); MimeTnefMessage mimeTnefMessage = new MimeTnefMessage(bodyFormat, createAlternative, charsetName); return(new EmailMessage(mimeTnefMessage)); }
protected static void CheckRtf(BodyFormat sourceFormat, BodyFormat targetFormat) { if (targetFormat == BodyFormat.ApplicationRtf && sourceFormat == BodyFormat.TextPlain) { throw new InvalidOperationException(ServerStrings.ExBodyFormatConversionNotSupported(sourceFormat.ToString() + "->" + targetFormat.ToString())); } }