Esempio n. 1
0
 internal void CheckAndSubmitMfn(TransportMailItem originalMailItem)
 {
     if (!this.ShouldGenerateMfn())
     {
         return;
     }
     using (MeetingRequest meetingRequest = MeetingRequest.Bind(this.item.Session, this.item.Item.Id))
     {
         using (MeetingForwardNotification meetingForwardNotification = meetingRequest.CreateNotification())
         {
             TransportMailItem transportMailItem = TransportMailItem.NewSideEffectMailItem(originalMailItem, this.submitter.OrganizationId, LatencyComponent.Agent, MailDirectionality.Originating, this.submitter.ExternalOrganizationId);
             transportMailItem.From = RoutingAddress.NullReversePath;
             if (this.TryCreateMfnSubjectAndBody(meetingForwardNotification))
             {
                 Stream stream = transportMailItem.OpenMimeWriteStream();
                 stream.Close();
                 this.CopyMfnRecipientsTo(meetingForwardNotification, transportMailItem);
                 this.CopyMfnContentTo(meetingForwardNotification, transportMailItem);
                 MailboxSession mailboxSession = this.item.Item.Session as MailboxSession;
                 Participant    participant    = Participant.TryConvertTo(this.item.Sender, "SMTP", mailboxSession);
                 if (participant == null)
                 {
                     participant = this.item.Sender;
                 }
                 if (mailboxSession != null)
                 {
                     MfnLog.LogEntry(mailboxSession, string.Format("Decorating MFN with the address - Name {0}, EmailAddress : {1}, RoutingType : {2}", participant.DisplayName, participant.EmailAddress, participant.RoutingType));
                 }
                 Components.DsnGenerator.DecorateMfn(transportMailItem, participant.DisplayName, participant.EmailAddress);
                 this.item.DecorateMessage(transportMailItem);
                 this.item.ApplySecurityAttributesTo(transportMailItem);
                 ClassificationUtils.PromoteStoreClassifications(transportMailItem.RootPart.Headers);
                 this.submitter.StoreDriverSubmission.ThrowIfStopped();
                 transportMailItem.UpdateCachedHeaders();
                 this.submitter.SendMailItem(new SubmissionReadOnlyMailItem(transportMailItem, MailItemType.OtherMessage), null);
             }
         }
     }
 }