internal static EmailMessage GenerateDecisionNotTakenNotification(RoutingAddress from, RoutingAddress recipient, string subject, string threadIndex, string threadTopic, string decisionMaker, bool?decision, ExDateTime?decisionTime, Header acceptLanguageHeader, Header contentLanguageHeader, CultureInfo fallbackCulture) { if (from.Equals(RoutingAddress.NullReversePath) || recipient.Equals(RoutingAddress.NullReversePath) || !from.IsValid || !recipient.IsValid) { return(null); } DsnHumanReadableWriter dsnHumanReadableWriter = Components.DsnGenerator.DsnHumanReadableWriter; ApprovalInformation decisionConflictInformation = dsnHumanReadableWriter.GetDecisionConflictInformation(subject, decisionMaker, decision, decisionTime, acceptLanguageHeader, contentLanguageHeader, fallbackCulture); EmailMessage emailMessage = EmailMessage.Create(BodyFormat.Html, false, decisionConflictInformation.MessageCharset.Name); emailMessage.From = new EmailRecipient(string.Empty, from.ToString()); emailMessage.To.Add(new EmailRecipient(string.Empty, recipient.ToString())); emailMessage.Subject = decisionConflictInformation.Subject; using (Stream contentWriteStream = emailMessage.Body.GetContentWriteStream()) { dsnHumanReadableWriter.WriteHtmlModerationBody(contentWriteStream, decisionConflictInformation); contentWriteStream.Flush(); } Header header = Header.Create("X-MS-Exchange-Organization-SCL"); header.Value = "-1"; emailMessage.RootPart.Headers.AppendChild(header); Header header2 = (TextHeader)Header.Create("Thread-Index"); header2.Value = threadIndex; emailMessage.RootPart.Headers.AppendChild(header2); Header header3 = (TextHeader)Header.Create("Thread-Topic"); header3.Value = threadTopic; emailMessage.RootPart.Headers.AppendChild(header3); return(emailMessage); }
private bool TryWriteApprovalRequestBodyWithPreview(Body destiniationBody, DsnHumanReadableWriter approvalRequestWriter, ApprovalInformation info, Charset outputCharset) { if (this.originalEmailMessage == null) { return(false); } TextConverter textConverter; if (this.originalMesssageBodyFormat == Microsoft.Exchange.Data.Transport.Email.BodyFormat.Rtf) { textConverter = new RtfToHtml { Header = approvalRequestWriter.GetHtmlModerationBody(info), HeaderFooterFormat = HeaderFooterFormat.Html, OutputEncoding = outputCharset.GetEncoding() }; } else if (this.originalMesssageBodyFormat == Microsoft.Exchange.Data.Transport.Email.BodyFormat.Text) { textConverter = new TextToHtml { Header = approvalRequestWriter.GetHtmlModerationBody(info), HeaderFooterFormat = HeaderFooterFormat.Html, InputEncoding = this.originalMessageBodyCharset.GetEncoding(), OutputEncoding = outputCharset.GetEncoding() }; } else { if (this.originalMesssageBodyFormat != Microsoft.Exchange.Data.Transport.Email.BodyFormat.Html) { return(false); } textConverter = new HtmlToHtml { Header = approvalRequestWriter.GetHtmlModerationBody(info), HeaderFooterFormat = HeaderFooterFormat.Html, InputEncoding = this.originalMessageBodyCharset.GetEncoding(), OutputEncoding = outputCharset.GetEncoding() }; } BodyWriteConfiguration configuration = new BodyWriteConfiguration(Microsoft.Exchange.Data.Storage.BodyFormat.TextHtml, outputCharset); using (Stream stream = destiniationBody.OpenWriteStream(configuration)) { using (Stream contentReadStream = this.originalEmailMessage.Body.GetContentReadStream()) { try { textConverter.Convert(contentReadStream, stream); } catch (ExchangeDataException arg) { ModerationApprovalRequestWriter.diag.TraceDebug <ExchangeDataException>(0L, "Approval request with inline preview failed {0}", arg); return(false); } } } return(true); }
internal static Stream GenerateReportBody(MessageItem message, DsnHumanReadableWriter dsnWriter, HeaderList headerList, out CultureInfo cultureInfo, out Charset charset) { MemoryStream memoryStream = new MemoryStream(ReportMessage.EstimateGeneratedBodySize(message)); if (ObjectClass.IsDsn(message.ClassName)) { ReportMessage.GenerateDsnBody(message, memoryStream, dsnWriter, headerList, out cultureInfo, out charset); } else { ReportMessage.GenerateReportBody(message, memoryStream, out cultureInfo, out charset); } return(memoryStream); }
// Token: 0x06000037 RID: 55 RVA: 0x00003A78 File Offset: 0x00001C78 private void SendExpiryNdrOofNotification(MessageItem messageItem, ApprovalInformation.ApprovalNotificationType notificationType) { ModeratedDLApplication.diag.TraceDebug((long)this.GetHashCode(), "Entering SendExpiryNdrOofNotification"); if (!this.ShouldSendNotification(messageItem)) { return; } RoutingAddress routingAddress; if (!this.TryGetOriginalSender(messageItem, out routingAddress)) { return; } MailboxSession mailboxSession = (MailboxSession)messageItem.Session; messageItem.Load(ModeratedDLApplication.NotificationPropertiesFromInitMessage); string valueOrDefault = messageItem.GetValueOrDefault <string>(MessageItemSchema.AcceptLanguage, string.Empty); ICollection <string> moderatedRecipients = this.GetModeratedRecipients(messageItem, false); string valueOrDefault2 = messageItem.GetValueOrDefault <string>(ItemSchema.InternetReferences, string.Empty); DsnHumanReadableWriter defaultDsnHumanReadableWriter = DsnHumanReadableWriter.DefaultDsnHumanReadableWriter; StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Outbox); using (MessageItem messageItem2 = MessageItem.Create(mailboxSession, defaultFolderId)) { ApprovalInformation approvalInformation = null; approvalInformation = defaultDsnHumanReadableWriter.GetMessageInModerationExpiredNdrOofInformation(notificationType, messageItem.Subject, moderatedRecipients, valueOrDefault2, valueOrDefault); messageItem2.Subject = approvalInformation.Subject; BodyWriteConfiguration configuration = new BodyWriteConfiguration(BodyFormat.TextHtml, approvalInformation.MessageCharset.Name); using (Stream stream = messageItem2.Body.OpenWriteStream(configuration)) { defaultDsnHumanReadableWriter.WriteHtmlModerationBody(stream, approvalInformation); } this.StampCommonNotificationProperties(messageItem2, messageItem, new RoutingAddress[] { routingAddress }, valueOrDefault2, approvalInformation.Culture); string text; this.AttachOriginalMessageToNotification(messageItem, messageItem2, out text); messageItem2.ClassName = "IPM.Note.Microsoft.Approval.Reply"; messageItem2.SendWithoutSavingMessage(); ModeratedDLApplication.diag.TraceDebug((long)this.GetHashCode(), "Notification sent."); } }
// Token: 0x0600003F RID: 63 RVA: 0x00004608 File Offset: 0x00002808 private bool TryWriteNotificationWithAppendedComments(DsnHumanReadableWriter notificationWriter, MessageItem rejectItem, StreamAttachment commentAttachment, ApprovalInformation info) { bool result = true; string htmlModerationBody = notificationWriter.GetHtmlModerationBody(info); Charset textCharset = commentAttachment.TextCharset; Encoding inputEncoding = null; if (textCharset == null || !textCharset.TryGetEncoding(out inputEncoding)) { return(false); } Charset charset = textCharset; if (!ModeratedDLApplication.IsEncodingMatch(info.Codepages, textCharset.CodePage)) { charset = Charset.UTF8; } BodyWriteConfiguration configuration = new BodyWriteConfiguration(BodyFormat.TextHtml, charset.Name); using (Stream stream = rejectItem.Body.OpenWriteStream(configuration)) { HtmlToHtml htmlToHtml = new HtmlToHtml(); htmlToHtml.Header = htmlModerationBody; htmlToHtml.HeaderFooterFormat = HeaderFooterFormat.Html; htmlToHtml.InputEncoding = inputEncoding; htmlToHtml.OutputEncoding = charset.GetEncoding(); try { using (Stream contentStream = commentAttachment.GetContentStream(PropertyOpenMode.ReadOnly)) { htmlToHtml.Convert(contentStream, stream); stream.Flush(); } } catch (ExchangeDataException arg) { ModeratedDLApplication.diag.TraceDebug <ExchangeDataException>(0L, "Attaching comments failed with {0}", arg); result = false; } } return(result); }
private void WriteApprovalRequestBody(Body destiniationBody, DsnHumanReadableWriter writer, ApprovalInformation info, bool writePreview) { if (writePreview) { Charset outputCharset; bool flag = !ModerationApprovalRequestWriter.CheckInputOutputCharsetMatch(info.Codepages, this.originalMessageBodyCharset, out outputCharset); if (!flag && this.TryWriteApprovalRequestBodyWithPreview(destiniationBody, writer, info, outputCharset)) { return; } ModerationApprovalRequestWriter.diag.TraceError <bool, string>((long)this.GetHashCode(), "Failed to write preview for message. Falling back to no preview. Charset mismatch:{0}. Approval data:{1}.", flag, this.initiationMessage.ApprovalData); info = writer.GetApprovalRequestMessageInformation(this.initiationMessage.Subject, this.originalSenderDisplayName, this.originalToFormattedLine, this.originalCcFormattedLine, this.moderatedRecipients, false, info.Culture); } BodyWriteConfiguration configuration = new BodyWriteConfiguration(Microsoft.Exchange.Data.Storage.BodyFormat.TextHtml, info.MessageCharset.Name); using (Stream stream = destiniationBody.OpenWriteStream(configuration)) { writer.WriteHtmlModerationBody(stream, info); } }
protected static MapiMessage GetDeliveryReceipt(MapiFolder folder, string subject, bool dsnOnly) { string value = DsnHumanReadableWriter.GetLocalizedSubjectPrefix(DsnFlags.Relay).ToString(); MapiTable contentsTable; MapiTable mapiTable = contentsTable = folder.GetContentsTable(); try { mapiTable.SetColumns(new PropTag[] { PropTag.EntryId, PropTag.Subject, PropTag.MessageClass }); PropValue[][] array = mapiTable.QueryRows(1000, QueryRowsFlags.None); for (int i = 0; i <= array.GetUpperBound(0); i++) { if (!dsnOnly || ObjectClass.IsDsnPositive(array[i][2].Value.ToString())) { string text = array[i][1].Value.ToString(); if ((!text.StartsWith(value, StringComparison.OrdinalIgnoreCase) || subject.StartsWith(value, StringComparison.OrdinalIgnoreCase)) && text.EndsWith(subject, StringComparison.OrdinalIgnoreCase)) { byte[] bytes = array[i][0].GetBytes(); return((MapiMessage)folder.OpenEntry(bytes)); } } } } finally { if (contentsTable != null) { ((IDisposable)contentsTable).Dispose(); } } return(null); }
public override bool WriteSubjectAndBody(MessageItemApprovalRequest approvalRequest, CultureInfo cultureInfo, out CultureInfo cultureInfoWritten) { cultureInfoWritten = cultureInfo; ModerationApprovalRequestWriter.diag.TraceDebug <CultureInfo>((long)this.GetHashCode(), "Generating approval request. cultureInfo={0}", cultureInfo); DsnHumanReadableWriter defaultDsnHumanReadableWriter = DsnHumanReadableWriter.DefaultDsnHumanReadableWriter; this.CacheDataFromOriginalMessage(); if (this.originalMessageStream == null) { ModerationApprovalRequestWriter.diag.TraceError <string>((long)this.GetHashCode(), "No original message to write approval request body. Approval data: {0}", this.initiationMessage.ApprovalData); return(false); } bool flag = !this.hasInlineAttachment && !this.isOpaqueMessage; if (this.hasInlineAttachment) { ModerationApprovalRequestWriter.diag.TraceDebug <string>((long)this.GetHashCode(), "Not writing preview for message with approval data: {0}, because it has inline attachment", this.initiationMessage.ApprovalData); } ApprovalInformation approvalRequestMessageInformation = defaultDsnHumanReadableWriter.GetApprovalRequestMessageInformation(this.initiationMessage.Subject, this.originalSenderDisplayName, this.originalToFormattedLine, this.originalCcFormattedLine, this.moderatedRecipients, flag, cultureInfo); approvalRequest.MessageItem.Subject = approvalRequestMessageInformation.Subject; this.WriteApprovalRequestBody(approvalRequest.MessageItem.Body, defaultDsnHumanReadableWriter, approvalRequestMessageInformation, flag); return(true); }
// Token: 0x06000C14 RID: 3092 RVA: 0x0004EBBC File Offset: 0x0004CDBC private void SendExpiryOrUpdateMessage(MessageItem initiationMessage, MailboxSession session, string decisionMakerAddress, ApprovalStatus status, ExDateTime handledTime) { if (status != ApprovalStatus.Expired && status != ApprovalStatus.Approved && status != ApprovalStatus.Rejected) { throw new ArgumentException("Unexpected status"); } StoreObjectId defaultFolderId = session.GetDefaultFolderId(DefaultFolderType.Outbox); using (MessageItem messageItem = MessageItem.Create(session, defaultFolderId)) { messageItem.ClassName = "IPM.Note.Microsoft.Approval.Request.Recall"; string valueOrDefault = initiationMessage.GetValueOrDefault <string>(MessageItemSchema.ApprovalAllowedDecisionMakers); if (string.IsNullOrEmpty(valueOrDefault)) { ApprovalAssistant.GeneralTracer.TraceError((long)this.GetHashCode(), "No list of decisionmakers. No updates"); } else { string valueOrDefault2 = initiationMessage.GetValueOrDefault <string>(MessageItemSchema.ApprovalRequestMessageId); if (string.IsNullOrEmpty(valueOrDefault2)) { ApprovalAssistant.GeneralTracer.TraceError((long)this.GetHashCode(), "The approval request message id is not found."); } else { Participant valueOrDefault3 = initiationMessage.GetValueOrDefault <Participant>(MessageItemSchema.ReceivedBy); if (valueOrDefault3 == null) { ApprovalAssistant.GeneralTracer.TraceError((long)this.GetHashCode(), "Cannot get the arbitration mailbox information."); } else { messageItem.Sender = valueOrDefault3; RoutingAddress[] routingAddresses; if (!ApprovalUtils.TryGetDecisionMakers(valueOrDefault, out routingAddresses)) { ApprovalAssistant.GeneralTracer.TraceError((long)this.GetHashCode(), "initiation message has invalid decision makers."); } else { IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(true, ConsistencyMode.IgnoreInvalid, session.GetADSessionSettings(), 555, "SendExpiryOrUpdateMessage", "f:\\15.00.1497\\sources\\dev\\MailboxAssistants\\src\\assistants\\Approval\\ApprovalAssistant.cs"); string text; RoutingAddress[] array = this.FilterByServerVersionAndLookupDisplayName(routingAddresses, tenantOrRootOrgRecipientSession, decisionMakerAddress, out text); if (array.Length == 0) { ApprovalAssistant.GeneralTracer.TraceDebug((long)this.GetHashCode(), "There is no E14 or later moderator in the list."); } else { foreach (RoutingAddress address in array) { Participant participant = new Participant(string.Empty, (string)address, "SMTP"); messageItem.Recipients.Add(participant, RecipientItemType.To); } messageItem[MessageItemSchema.ApprovalDecisionTime] = handledTime; messageItem[MessageItemSchema.ApprovalRequestMessageId] = valueOrDefault2; messageItem[MessageItemSchema.IsNonDeliveryReceiptRequested] = false; messageItem[MessageItemSchema.IsDeliveryReceiptRequested] = false; byte[] conversationIndex = initiationMessage.ConversationIndex; messageItem.ConversationIndex = ConversationIndex.CreateFromParent(conversationIndex).ToByteArray(); messageItem[ItemSchema.NormalizedSubject] = initiationMessage.ConversationTopic; DsnHumanReadableWriter defaultDsnHumanReadableWriter = DsnHumanReadableWriter.DefaultDsnHumanReadableWriter; ApprovalInformation approvalInformation; if (status != ApprovalStatus.Expired) { if (string.IsNullOrEmpty(text)) { text = decisionMakerAddress; } messageItem[MessageItemSchema.ApprovalDecision] = ((status == ApprovalStatus.Approved) ? 1 : 2); messageItem[MessageItemSchema.ApprovalDecisionMaker] = text; bool?decision = new bool?(status == ApprovalStatus.Approved); approvalInformation = defaultDsnHumanReadableWriter.GetDecisionUpdateInformation(initiationMessage.Subject, text, decision, new ExDateTime?(handledTime)); } else { messageItem[MessageItemSchema.ApprovalDecision] = 0; approvalInformation = defaultDsnHumanReadableWriter.GetApprovalRequestExpiryInformation(initiationMessage.Subject); } messageItem.Subject = approvalInformation.Subject; BodyWriteConfiguration configuration = new BodyWriteConfiguration(BodyFormat.TextHtml, approvalInformation.MessageCharset.Name); using (Stream stream = messageItem.Body.OpenWriteStream(configuration)) { defaultDsnHumanReadableWriter.WriteHtmlModerationBody(stream, approvalInformation); stream.Flush(); } messageItem.SendWithoutSavingMessage(); } } } } } } }
// Token: 0x06000039 RID: 57 RVA: 0x00003EA4 File Offset: 0x000020A4 private void SendRejectNotification(MessageItem messageItem) { ModeratedDLApplication.diag.TraceDebug((long)this.GetHashCode(), "Entering SendRejectNotification"); if (!this.ShouldSendNotification(messageItem)) { return; } RoutingAddress routingAddress; if (!this.TryGetOriginalSender(messageItem, out routingAddress)) { return; } MailboxSession mailboxSession = (MailboxSession)messageItem.Session; messageItem.Load(ModeratedDLApplication.NotificationPropertiesFromInitMessage); string valueOrDefault = messageItem.GetValueOrDefault <string>(MessageItemSchema.AcceptLanguage, string.Empty); DsnHumanReadableWriter defaultDsnHumanReadableWriter = DsnHumanReadableWriter.DefaultDsnHumanReadableWriter; ICollection <string> moderatedRecipients = this.GetModeratedRecipients(messageItem, false); string valueOrDefault2 = messageItem.GetValueOrDefault <string>(ItemSchema.InternetReferences, string.Empty); StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Outbox); using (MessageItem messageItem2 = MessageItem.Create(mailboxSession, defaultFolderId)) { StreamAttachment streamAttachment = null; try { bool flag = ModeratedDLApplication.TryGetCommentAttachment(messageItem, out streamAttachment) && streamAttachment.Size > 0L; messageItem2.ClassName = "IPM.Note.Microsoft.Approval.Reply.Reject"; bool flag2 = true; ApprovalInformation approvalInformation = null; if (flag) { approvalInformation = defaultDsnHumanReadableWriter.GetModerateRejectInformation(messageItem.Subject, moderatedRecipients, flag, valueOrDefault2, valueOrDefault); messageItem2.Subject = approvalInformation.Subject; flag2 = this.TryWriteNotificationWithAppendedComments(defaultDsnHumanReadableWriter, messageItem2, streamAttachment, approvalInformation); } if (!flag || !flag2) { approvalInformation = defaultDsnHumanReadableWriter.GetModerateRejectInformation(messageItem.Subject, moderatedRecipients, false, valueOrDefault2, valueOrDefault); messageItem2.Subject = approvalInformation.Subject; BodyWriteConfiguration configuration = new BodyWriteConfiguration(BodyFormat.TextHtml, approvalInformation.MessageCharset.Name); using (Stream stream = messageItem2.Body.OpenWriteStream(configuration)) { defaultDsnHumanReadableWriter.WriteHtmlModerationBody(stream, approvalInformation); stream.Flush(); } } if (flag && !flag2) { using (StreamAttachment streamAttachment2 = messageItem2.AttachmentCollection.Create(AttachmentType.Stream) as StreamAttachment) { streamAttachment2.FileName = defaultDsnHumanReadableWriter.GetModeratorsCommentFileName(approvalInformation.Culture); using (Stream contentStream = streamAttachment2.GetContentStream()) { using (Stream contentStream2 = streamAttachment.GetContentStream(PropertyOpenMode.ReadOnly)) { byte[] buffer = new byte[8192]; ApprovalProcessor.CopyStream(contentStream2, contentStream, buffer); } contentStream.Flush(); } streamAttachment2.Save(); } } this.StampCommonNotificationProperties(messageItem2, messageItem, new RoutingAddress[] { routingAddress }, valueOrDefault2, approvalInformation.Culture); messageItem2.SendWithoutSavingMessage(); } finally { if (streamAttachment != null) { streamAttachment.Dispose(); } } } }
// Token: 0x06000038 RID: 56 RVA: 0x00003BFC File Offset: 0x00001DFC private void SendModeratorExpiryNotification(MessageItem messageItem, ApprovalInformation.ApprovalNotificationType notificationType) { ModeratedDLApplication.diag.TraceDebug((long)this.GetHashCode(), "Entering SendModeratorExpiryNotification"); if (!this.ShouldSendNotification(messageItem)) { return; } string valueOrDefault = messageItem.GetValueOrDefault <string>(MessageItemSchema.ApprovalAllowedDecisionMakers); RoutingAddress[] collection; if (!ApprovalUtils.TryGetDecisionMakers(valueOrDefault, out collection)) { return; } MailboxSession mailboxSession = (MailboxSession)messageItem.Session; messageItem.Load(ModeratedDLApplication.NotificationPropertiesFromInitMessage); ICollection <string> moderatedRecipients = this.GetModeratedRecipients(messageItem, false); string valueOrDefault2 = messageItem.GetValueOrDefault <string>(ItemSchema.InternetReferences, string.Empty); int value = messageItem.GetValueAsNullable <int>(StoreObjectSchema.RetentionPeriod) ?? 2; Dictionary <CultureInfo, List <RoutingAddress> > dictionary = null; IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(false, ConsistencyMode.FullyConsistent, mailboxSession.GetADSessionSettings(), 587, "SendModeratorExpiryNotification", "f:\\15.00.1497\\sources\\dev\\Approval\\src\\Applications\\ModeratedDLApplication\\ModeratedDLApplication.cs"); DsnHumanReadableWriter defaultDsnHumanReadableWriter = DsnHumanReadableWriter.DefaultDsnHumanReadableWriter; StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Outbox); if (ClientCultures.IsCultureSupportedForDsn(CultureInfo.CurrentCulture)) { this.defaultFallBackCulture = CultureInfo.CurrentCulture; } else { this.defaultFallBackCulture = CultureInfo.GetCultureInfo("en-US"); } if (ApprovalProcessor.TryGetCulturesForDecisionMakers(new List <RoutingAddress>(collection), tenantOrRootOrgRecipientSession, this.defaultFallBackCulture, out dictionary)) { foreach (CultureInfo cultureInfo in dictionary.Keys) { IList <RoutingAddress> list = dictionary[cultureInfo]; using (MessageItem messageItem2 = MessageItem.Create(mailboxSession, defaultFolderId)) { ApprovalInformation approvalInformation = null; string text; this.AttachOriginalMessageToNotification(messageItem, messageItem2, out text); if (string.IsNullOrEmpty(text)) { RoutingAddress routingAddress; if (!this.TryGetOriginalSender(messageItem, out routingAddress)) { break; } text = routingAddress.ToString(); } approvalInformation = defaultDsnHumanReadableWriter.GetMessageInModerationModeratorExpiredInformation(notificationType, messageItem.Subject, moderatedRecipients, text, new int?(value), cultureInfo.Name, this.defaultFallBackCulture); messageItem2.Subject = approvalInformation.Subject; BodyWriteConfiguration configuration = new BodyWriteConfiguration(BodyFormat.TextHtml, approvalInformation.MessageCharset.Name); using (Stream stream = messageItem2.Body.OpenWriteStream(configuration)) { defaultDsnHumanReadableWriter.WriteHtmlModerationBody(stream, approvalInformation); } this.StampCommonNotificationProperties(messageItem2, messageItem, list, valueOrDefault2, approvalInformation.Culture); messageItem2.ClassName = "IPM.Note.Microsoft.Approval.Reply.Reject"; messageItem2.SendWithoutSavingMessage(); ModeratedDLApplication.diag.TraceDebug <int, string>((long)this.GetHashCode(), "Expiry Notification sent for {0} decision makers, original message id '{1}'", list.Count, valueOrDefault2); } } } }
private static void GenerateDsnBody(MessageItem message, Stream outputStream, DsnHumanReadableWriter dsnWriter, HeaderList headerList, out CultureInfo cultureInfo, out Charset charset) { message.Load(ReportMessageSchema.Instance.AutoloadProperties); MailboxSession mailboxSession = message.Session as MailboxSession; List <DsnRecipientInfo> list = new List <DsnRecipientInfo>(message.Recipients.Count); HashSet <string> hashSet = new HashSet <string>(); foreach (Recipient recipient in message.Recipients) { list.Add(new DsnRecipientInfo(recipient.Participant.DisplayName, recipient.Participant.EmailAddress, recipient.Participant.RoutingType, DsnMdnUtil.GetMimeDsnRecipientStatusCode(recipient).Value, recipient.GetValueOrDefault <string>(InternalSchema.SupplementaryInfo))); string valueOrDefault = recipient.GetValueOrDefault <string>(InternalSchema.RemoteMta); if (!string.IsNullOrEmpty(valueOrDefault)) { hashSet.TryAdd(valueOrDefault); } } StringBuilder stringBuilder = new StringBuilder(hashSet.Count * 20); foreach (string value in hashSet) { stringBuilder.Append(value); stringBuilder.Append(", "); } dsnWriter.CreateDsnHumanReadableBody(outputStream, ReportMessage.GetDsnCultures(mailboxSession, headerList, dsnWriter), message.GetValueOrDefault <string>(InternalSchema.OriginalSubject), list, ReportMessage.GetDsnFlags(message.ClassName), message.GetValueOrDefault <string>(InternalSchema.ReportingMta, string.Empty), (stringBuilder.Length > 0) ? stringBuilder.ToString(0, stringBuilder.Length - ", ".Length) : null, null, headerList, out cultureInfo, out charset); }
internal static IEnumerable <CultureInfo> GetDsnCultures(MailboxSession mailboxSession, HeaderList headerList, DsnHumanReadableWriter dsnWriter) { if (mailboxSession != null) { return(mailboxSession.InternalGetMailboxCultures()); } CultureInfo cultureInfo = null; if (headerList != null) { Header acceptLanguageHeader = null; Header contentLanguageHeader = headerList.FindFirst(HeaderId.ContentLanguage); cultureInfo = dsnWriter.GetDsnCulture(acceptLanguageHeader, contentLanguageHeader, true, null); } if (cultureInfo != null) { return(new CultureInfo[] { cultureInfo }); } return(Array <CultureInfo> .Empty); }