Inheritance: RecipientBase, IRecipient
コード例 #1
0
 public void AddRecipient(MailRecipient recipient)
 {
     if (!Recipients.Exists(r => r.Equals(recipient)))
     {
         Recipients.Add(recipient);
     }
 }
コード例 #2
0
        public void SelectMessage(long idRecipientMessage)
        {
            if (UserContext.isAnonymous)
            {
                SessionTimeout(View.CurrentIdCommunity, View.PreloadSelectedTab);
            }
            else
            {
                MailRecipient recipient = CurrentManager.Get <MailRecipient>(idRecipientMessage);
                lm.Comol.Core.DomainModel.Languages.ItemObjectTranslation translation = new lm.Comol.Core.DomainModel.Languages.ItemObjectTranslation();
                if (recipient != null)
                {
                    if (recipient.Item != null)
                    {
                        translation.Body    = recipient.Item.Body;
                        translation.Subject = recipient.Item.Subject;
                    }
                    View.DisplayMessagePreview(false, recipient.LanguageCode, translation, new List <String>(), recipient.Message.MailSettings, View.SelectedFilter.IdCommunity, View.CurrentModuleObject);
                }
                else
                {
                    switch (View.CurrentDisplayBy)
                    {
                    case DisplayItems.ByRecipient:
                        LoadRecipients(View.SelectedFilter, View.Pager.PageIndex, View.PageSize, false);
                        break;

                    case DisplayItems.ByMessage:
                        break;
                    }
                }
            }
        }
コード例 #3
0
 public void AddUser(User user, MailRecipient recipient)
 {
     if (!Users.Keys.Any(u => u.Id == user.Id))
     {
         Users.Add(user, recipient);
     }
 }
コード例 #4
0
        public override void SubmitMailItem(TransportMailItem mailItem, bool suppressDSNs)
        {
            StoreDriverDeliveryEventArgs storeDriverDeliveryEventArgs = null;

            if (base.AssociatedAgent != null && base.AssociatedAgent.Session != null && base.AssociatedAgent.Session.CurrentEventArgs != null)
            {
                storeDriverDeliveryEventArgs = (base.AssociatedAgent.Session.CurrentEventArgs as StoreDriverDeliveryEventArgs);
            }
            bool flag  = this.agentLoopChecker.IsEnabledInSubmission();
            bool flag2 = false;

            if (storeDriverDeliveryEventArgs != null && !string.IsNullOrEmpty(base.AssociatedAgent.Name))
            {
                flag2 = this.agentLoopChecker.CheckAndStampInSubmission(storeDriverDeliveryEventArgs.MailItem.Message.RootPart.Headers, mailItem.RootPart.Headers, base.AssociatedAgent.Name);
                if (flag2)
                {
                    MessageTrackingLog.TrackAgentGeneratedMessageRejected(MessageTrackingSource.STOREDRIVER, flag, mailItem);
                }
            }
            if (flag2 && flag)
            {
                using (IEnumerator <MailRecipient> enumerator = mailItem.Recipients.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        MailRecipient mailRecipient = enumerator.Current;
                        mailRecipient.Ack(AckStatus.Fail, SmtpResponse.AgentGeneratedMessageDepthExceeded);
                    }
                    return;
                }
            }
            Utils.SubmitMailItem(mailItem, suppressDSNs);
        }
コード例 #5
0
        public void InitView()
        {
            dtoModuleMessagesContext context = GetContext();

            View.ContainerContext = context;
            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                if (HasPermission(context))
                {
                    lm.Comol.Core.Mail.dtoRecipient recipient = new lm.Comol.Core.Mail.dtoRecipient();
                    if (context.IdPerson > 0)
                    {
                        Person p = CurrentManager.GetPerson(context.IdPerson);
                        recipient.DisplayName = (p == null) ? View.UnknownUserName: p.SurnameAndName;
                        recipient.MailAddress = (p == null) ? "" : p.Mail;
                    }
                    else if (context.IdUserModule > 0)
                    {
                        recipient = View.GetRecipient(context.ModuleCode, context.IdUserModule);
                        if (recipient == null)
                        {
                            recipient = new lm.Comol.Core.Mail.dtoRecipient()
                            {
                                DisplayName = View.RemovedUserName
                            }
                        }
                        ;
                    }
                    else if (!String.IsNullOrEmpty(context.MailAddress))
                    {
                        MailRecipient r = Service.GetRecipient(context.MailAddress, context);
                        if (r == null)
                        {
                            recipient = new lm.Comol.Core.Mail.dtoRecipient()
                            {
                                DisplayName = View.UnknownUserName
                            }
                        }
                        ;
                        else
                        {
                            recipient = new lm.Comol.Core.Mail.dtoRecipient()
                            {
                                DisplayName = r.MailAddress
                            }
                        };
                    }
                    View.LoadRecipientName(recipient);
                    LoadUserMessages(context, 0, View.CurrentPageSize);
                }
                else
                {
                    View.DisplayNoPermission(context.IdCommunity, context.IdModule, context.ModuleCode);
                }
            }
        }
コード例 #6
0
        private void Entity_Navigate(object sender, MouseButtonEventArgs e)
        {
            FrameworkElement el        = (FrameworkElement)sender;
            MailRecipient    recipient = (MailRecipient)el.Tag;

            AddItem(recipient);
        }
コード例 #7
0
        public IActionResult ForgotPassword(User model)
        {
            var usermodel = _context.Users.FirstOrDefault <User>(u => u.Email == model.Email);

            if (usermodel != null)
            {
                MailRecipient mailRecipient = new MailRecipient();
                mailRecipient.Name  = usermodel.Name;
                mailRecipient.Email = usermodel.Email;
                Dictionary <string, string> templatePlaceholder = new Dictionary <string, string>();
                templatePlaceholder.Add("UserName", usermodel.Name);
                templatePlaceholder.Add("Senderid", usermodel.ID.ToString());
                templatePlaceholder.Add("Password", usermodel.Password);
                //templatePlaceholder.Add("", );
                emailManager.SendEmail(mailRecipient, EmailTemplate.ForgotPass, templatePlaceholder);
                ViewBag.Message = "Password Sent Successfully ";

                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                ViewBag.Message = "Invalid Email ID";
            }
            return(View(model));
        }
コード例 #8
0
ファイル: UserRepository.cs プロジェクト: teebot/manbox
        /// <summary>
        /// sends an expiring login link
        /// </summary>
        /// <param name="email"></param>
        /// <returns>success</returns>
        public bool SendPasswordReset(string email)
        {
            using (ManBoxEntities ent = new ManBoxEntities())
            {
                var user = ent.Users.FirstOrDefault(u => u.Email == email);

                if (user == null)
                {
                    this.logger.Log(LogType.Warn, "Password reset attempt without valid email. Too many attempts is fishy.");
                    return(false);
                }

                var encryptedToken = HttpUtility.UrlEncode(TokenEncrypt.EncryptTokenAsExpiring(user.Subscriptions.First().Token, DateTime.Now.AddDays(1)));

                var fromRecipient = new MailRecipient("*****@*****.**", "Support ManBox");
                var toRecipient   = new MailRecipient(email, user.FirstName);

                var domain    = Utilities.GetCountryDomain(user.Country.IsoCode);
                var linkToken = string.Format("http://{0}/{1}/Account/TokenLogin?token={2}", domain, user.Language.IsoCode, encryptedToken);

                mailService.SendMail <PasswordResetMail>(toRecipient,
                                                         fromRecipient,
                                                         new PasswordResetMail()
                {
                    RootUrl     = "http://" + domain,
                    LanguageIso = user.Language.IsoCode,
                    Date        = DateTime.Now,
                    Name        = user.FirstName,
                    Subject     = "Password Reset",
                    LinkToken   = linkToken
                });

                return(true);
            }
        }
コード例 #9
0
        public override void AckRecipient(AckStatus ackStatus, SmtpResponse smtpResponse)
        {
            TraceHelper.SmtpSendTracer.TracePass <string, string>(TraceHelper.MessageProbeActivityId, (long)this.GetHashCode(), "InboundProxyNextHopConnection.AckRecipient. Ackstatus  = {0}. SmtpResponse = {1}", ackStatus.ToString(), smtpResponse.ToString());
            if (!this.recipientEnumeratorAck.MoveNext() || this.recipientsPending <= 0)
            {
                throw new InvalidOperationException("AckRecipient called but no recipients left to ack");
            }
            this.recipientsPending--;
            MailRecipient recipient = this.recipientEnumeratorAck.Current;

            switch (ackStatus)
            {
            case AckStatus.Pending:
            case AckStatus.Success:
            case AckStatus.Retry:
            case AckStatus.Fail:
                if (this.result == null)
                {
                    this.result = new SmtpMailItemResult();
                }
                if (this.result.RecipientResponses == null)
                {
                    this.result.RecipientResponses = new Dictionary <MailRecipient, AckStatusAndResponse>();
                }
                this.result.RecipientResponses.Add(recipient, new AckStatusAndResponse(ackStatus, smtpResponse));
                if (this.notificationHandler != null)
                {
                    this.notificationHandler.AckRecipient(ackStatus, smtpResponse, recipient);
                }
                return;

            default:
                throw new InvalidOperationException(string.Format("AckRecipient with status: {0} is invalid", ackStatus));
            }
        }
コード例 #10
0
        private static string GenerateAdditionalContextForRecipient(MailRecipient recipient, bool retryOnDuplicateDelivery)
        {
            string text = "resubmit";
            bool   flag = false;

            if (recipient.AckStatus == AckStatus.Resubmit)
            {
                text = "resubmit";
                flag = true;
            }
            else if (retryOnDuplicateDelivery)
            {
                text = "retryonduplicatedelivery";
                flag = true;
            }
            else if (recipient.AckStatus == AckStatus.SuccessNoDsn)
            {
                text = "skipdsn";
                flag = true;
            }
            ExTraceGlobals.FaultInjectionTracer.TraceTest <string>(64608U, text);
            return(string.Format(CultureInfo.InvariantCulture, "[{0}={1}]", new object[]
            {
                text,
                flag
            }));
        }
コード例 #11
0
        public void CheckNonExistsRegion()
        {
            var recipient = MailRecipient.Parse("*****@*****.**");

            Assert.That(recipient, Is.Not.Null);
            Assert.That(recipient.Email, Is.EqualTo("*****@*****.**"));
            Assert.That(recipient.Status, Is.EqualTo(RecipientStatus.NotFound));
        }
コード例 #12
0
        public ActionResult DeleteConfirmed(int id)
        {
            MailRecipient mailRecipient = db.MailRecipients.Find(id);

            db.MailRecipients.Remove(mailRecipient);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #13
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            MailRecipient mailRecipient = await db.MailRecipients.FindAsync(id);

            db.MailRecipients.Remove(mailRecipient);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
コード例 #14
0
        public void CheckNonExistsAddress()
        {
            var address   = TestAddress.Queryable.OrderByDescending(a => a.Id).First();
            var recipient = MailRecipient.Parse((address.Id + 10) + "@docs.analit.net");

            Assert.That(recipient, Is.Not.Null);
            Assert.That(recipient.Email, Is.EqualTo((address.Id + 10) + "@docs.analit.net"));
            Assert.That(recipient.Status, Is.EqualTo(RecipientStatus.NotFound));
        }
コード例 #15
0
        public void CheckNonExistsClient()
        {
            var client    = session.Query <TestClient>().OrderByDescending(c => c.Id).First();
            var recipient = MailRecipient.Parse((client.Id + 10) + "@client.docs.analit.net");

            Assert.That(recipient, Is.Not.Null);
            Assert.That(recipient.Email, Is.EqualTo((client.Id + 10) + "@client.docs.analit.net"));
            Assert.That(recipient.Status, Is.EqualTo(RecipientStatus.NotFound));
        }
コード例 #16
0
        private ExchangePrincipal GetExchangePrincipalForRecipient(MailRecipient recipient, DeliverableItem item, ICollection <CultureInfo> recipientLanguages, bool useCompletePrincipal)
        {
            ADSessionSettings adsessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(recipient.MailItemScopeOrganizationId);
            Guid databaseGuid = this.context.MbxTransportMailItem.DatabaseGuid;
            ExchangePrincipal exchangePrincipal;

            if (this.IsPublicFolderRecipient(item))
            {
                ADObjectId    value         = recipient.ExtendedProperties.GetValue <ADObjectId>("Microsoft.Exchange.Transport.DirectoryData.ContentMailbox", null);
                StoreObjectId storeObjectId = null;
                if (value == null || !StoreObjectId.TryParseFromHexEntryId(recipient.ExtendedProperties.GetValue <string>("Microsoft.Exchange.Transport.DirectoryData.EntryId", null), out storeObjectId))
                {
                    throw new SmtpResponseException(AckReason.UnableToDetermineTargetPublicFolderMailbox, MessageAction.Reroute);
                }
                this.deliverToFolder = storeObjectId;
                try
                {
                    exchangePrincipal = ExchangePrincipal.FromDirectoryObjectId(DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(true, ConsistencyMode.IgnoreInvalid, adsessionSettings, 830, "GetExchangePrincipalForRecipient", "f:\\15.00.1497\\sources\\dev\\MailboxTransport\\src\\MailboxTransportDelivery\\StoreDriver\\DeliveryItem.cs"), value, RemotingOptions.LocalConnectionsOnly);
                    goto IL_14C;
                }
                catch (Microsoft.Exchange.Data.Storage.ObjectNotFoundException)
                {
                    throw new SmtpResponseException(AckReason.PublicFolderMailboxNotFound, MessageAction.Reroute);
                }
            }
            MailboxItem mailboxItem = item as MailboxItem;

            if (mailboxItem == null)
            {
                throw new InvalidOperationException("Delivery to PFDBs is not supported in E15");
            }
            if (!useCompletePrincipal)
            {
                string legacyExchangeDN;
                if (!recipient.ExtendedProperties.TryGetValue <string>("Microsoft.Exchange.Transport.MailRecipient.DisplayName", out legacyExchangeDN))
                {
                    legacyExchangeDN = mailboxItem.LegacyExchangeDN;
                }
                exchangePrincipal = ExchangePrincipal.FromMailboxData(legacyExchangeDN, adsessionSettings, databaseGuid, mailboxItem.MailboxGuid, mailboxItem.LegacyExchangeDN, recipient.Email.ToString(), recipientLanguages ?? new MultiValuedProperty <CultureInfo>(), true, mailboxItem.RecipientType, mailboxItem.RecipientTypeDetails.GetValueOrDefault());
            }
            else
            {
                ProxyAddress proxyAddress = new SmtpProxyAddress((string)recipient.Email, true);
                exchangePrincipal = ExchangePrincipal.FromProxyAddress(adsessionSettings, proxyAddress.ToString());
            }
IL_14C:
            if (exchangePrincipal.MailboxInfo.IsRemote)
            {
                throw new SmtpResponseException(AckReason.RecipientMailboxIsRemote, MessageAction.Reroute);
            }
            if (exchangePrincipal.MailboxInfo.Location == MailboxDatabaseLocation.Unknown)
            {
                throw new SmtpResponseException(AckReason.RecipientMailboxLocationInfoNotAvailable, MessageAction.Reroute);
            }
            return(exchangePrincipal);
        }
コード例 #17
0
 public ActionResult Edit([Bind(Include = "MailRecipientId,Email")] MailRecipient mailRecipient)
 {
     if (ModelState.IsValid)
     {
         db.Entry(mailRecipient).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(mailRecipient));
 }
コード例 #18
0
        public void CreatePublicFolderMessage(MailRecipient recipient, DeliverableItem item)
        {
            PublicFolderSession publicFolderSession = (PublicFolderSession)this.storeSession;
            bool flag = false;

            try
            {
                this.context.BeginTrackLatency(LatencyComponent.StoreDriverDeliveryRpc);
                using (Folder folder = Folder.Bind(publicFolderSession, this.deliverToFolder, new PropertyDefinition[]
                {
                    FolderSchema.SecurityDescriptor
                }))
                {
                    switch (MailPublicFolderPermissionHandler.CheckAccessForEmailDelivery(this.context, folder))
                    {
                    case AccessCheckResult.NotAllowedAnonymous:
                        DeliveryItem.Diag.TraceError(0L, "Anonymous users are not permitted to add contents to mail enabled public folder.");
                        throw new SmtpResponseException(AckReason.NotAuthenticated, MessageAction.NDR);

                    case AccessCheckResult.NotAllowedAuthenticated:
                        DeliveryItem.Diag.TraceError <RoutingAddress>(0L, "User {0} is not permitted to add contents to mail enabled public folder.", this.context.MbxTransportMailItem.From);
                        throw new SmtpResponseException(AckReason.RecipientPermissionRestricted, MessageAction.NDR);

                    case AccessCheckResult.NotAllowedInternalSystemError:
                        DeliveryItem.Diag.TraceError(0L, "Exception occured when determining permission for sender on public folder");
                        throw new SmtpResponseException(AckReason.PublicFolderSenderValidationFailed, MessageAction.NDR);

                    default:
                        if (folder.IsContentAvailable())
                        {
                            this.messageItem = MessageItem.CreateForDelivery(publicFolderSession, folder.Id, this.context.ReplayItem.InternetMessageId, this.context.ReplayItem.GetValueAsNullable <ExDateTime>(ItemSchema.SentTime));
                            if (this.messageItem != null && this.messageItem.DisposeTracker != null)
                            {
                                this.messageItem.DisposeTracker.AddExtraDataWithStackTrace("DeliveryItem owns messageItem at:{0}{1}");
                            }
                            flag = true;
                        }
                        else
                        {
                            this.ReroutePublicFolderRecipient(publicFolderSession, folder, recipient);
                        }
                        break;
                    }
                }
            }
            finally
            {
                TimeSpan additionalLatency = this.context.EndTrackLatency(LatencyComponent.StoreDriverDeliveryRpc);
                this.context.AddRpcLatency(additionalLatency, "Open message");
            }
            if (flag)
            {
                ItemConversion.ReplayInboundContent(this.context.ReplayItem, this.messageItem);
            }
        }
コード例 #19
0
 private static string DisplayAddress(MailRecipient recipient)
 {
     if (recipient == null)
     {
         return(string.Empty);
     }
     else
     {
         return($"{recipient.Name} <{recipient.Email}>");
     }
 }
コード例 #20
0
 string getMessageText(MailRecipient recipient, ApplicationUser user)
 {
     return(""
            + string.Format("Dear {0}, ", recipient.FullName) + Environment.NewLine
            + "Thank you for your interest in our latest product. Please feel free to contact me for more information!"
            + Environment.NewLine
            + Environment.NewLine
            + "Sincerely, "
            + Environment.NewLine
            + string.Format("{0} {1}", user.FirstName, user.LastName));
 }
コード例 #21
0
        public ActionResult Create([Bind(Include = "Email")] MailRecipient mailRecipient)
        {
            if (ModelState.IsValid)
            {
                db.MailRecipients.Add(mailRecipient);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(mailRecipient));
        }
コード例 #22
0
        public void AddItem(MailRecipient subject)
        {
            mVirtualIndex++;
            mVirtualSize = mVirtualIndex + 1;

            bool is_new;

            EntityData data = GetClient().InfoCache.GetData(subject, out is_new);

            SetItem(data);
        }
コード例 #23
0
        public async Task <ActionResult> Edit([Bind(Include = "MailRecipientId,LastName,FirstName,Email,Company")] MailRecipient mailRecipient)
        {
            if (ModelState.IsValid)
            {
                db.Entry(mailRecipient).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(mailRecipient));
        }
コード例 #24
0
 private void ValidateLegacyDN(MailRecipient recipient, string legacyDN)
 {
     if (string.IsNullOrEmpty(legacyDN))
     {
         string text = recipient.Email.ToString();
         StoreDriverDeliveryDiagnostics.LogEvent(MailboxTransportEventLogConstants.Tuple_DeliveryFailedNoLegacyDN, text, new object[]
         {
             text
         });
         throw new SmtpResponseException(AckReason.NoLegacyDN, MessageAction.Reroute);
     }
 }
コード例 #25
0
ファイル: UserRepository.cs プロジェクト: teebot/manbox
        public void SendSupportMail(ContactFormViewModel contactForm)
        {
            var manboxRecipient = new MailRecipient("*****@*****.**", "Support ManBox");

            var content = string.Format(
                @"From: {0}
                            <br />
                            Message: {1}",
                contactForm.Email, contactForm.Message);

            mailService.SendMail(manboxRecipient, manboxRecipient, contactForm.Subject, content);
        }
コード例 #26
0
 public override MailRecipient GetNextRecipient()
 {
     while (this.recipientEnumerator.MoveNext())
     {
         MailRecipient mailRecipient = this.recipientEnumerator.Current;
         if (mailRecipient.Status == Status.Ready)
         {
             return(mailRecipient);
         }
     }
     return(null);
 }
コード例 #27
0
        public async Task <ActionResult> Create([Bind(Include = "LastName,FirstName,Email,Company")] MailRecipient mailRecipient)
        {
            if (ModelState.IsValid)
            {
                db.MailRecipients.Add(mailRecipient);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(mailRecipient));
        }
コード例 #28
0
        private void CheckRegionMaskByRecipient(string address, RecipientType recipientType, TestRegion region, TestUser user, NullConstraint constraint, string causeMessage)
        {
            var recipient = MailRecipient.Parse(address);

            Assert.That(recipient, Is.Not.Null);
            Assert.That(recipient.Type, Is.EqualTo(recipientType));
            Assert.That(recipient.Status, Is.EqualTo(RecipientStatus.Verified));

            var recipientUsers = recipient.GetUsers(region.Id);
            var findedUser     = recipientUsers.FirstOrDefault(u => u.Id == user.Id);

            Assert.That(findedUser, constraint, causeMessage);
        }
コード例 #29
0
 private void ParseRecipientAddresses(string[] emails)
 {
     // Пробегаемся по всем адресам TO и ищем адрес вида
     // <\[email protected]> или <\[email protected]>
     foreach (var mail in emails)
     {
         var recipient = MailRecipient.Parse(mail);
         if (recipient != null)
         {
             AddRecipient(recipient);
         }
     }
 }
コード例 #30
0
        public void OnCreatedMessageHandler(StoreDriverEventSource source, StoreDriverDeliveryEventArgs args)
        {
            StoreDriverDeliveryEventArgsImpl storeDriverDeliveryEventArgsImpl = (StoreDriverDeliveryEventArgsImpl)args;
            MailRecipient        mailRecipient        = storeDriverDeliveryEventArgsImpl.MailRecipient;
            DeliverableMailItem  mailItem             = storeDriverDeliveryEventArgsImpl.MailItem;
            MbxTransportMailItem mbxTransportMailItem = storeDriverDeliveryEventArgsImpl.MailItemDeliver.MbxTransportMailItem;
            MessageItem          messageItem          = storeDriverDeliveryEventArgsImpl.MessageItem;
            bool flag  = false;
            bool flag2 = ApprovalInitiation.IsArbitrationMailbox(mbxTransportMailItem.ADRecipientCache, mailRecipient.Email);

            if (!flag2 && string.Equals(messageItem.ClassName, "IPM.Note.Microsoft.Approval.Request.Recall", StringComparison.OrdinalIgnoreCase))
            {
                flag = true;
            }
            EmailMessage      message           = mailItem.Message;
            TestMessageConfig testMessageConfig = new TestMessageConfig(message);

            if (testMessageConfig.IsTestMessage && (testMessageConfig.LogTypes & LogTypesEnum.Arbitration) != LogTypesEnum.None)
            {
                EmailMessage emailMessage = ArbitrationMailboxReport.GenerateContentReport(new SmtpAddress(mailRecipient.Email.ToString()), testMessageConfig.ReportToAddress, messageItem.Session, flag2);
                if (emailMessage != null)
                {
                    ApprovalProcessingAgent.diag.TraceDebug(0L, "Submit arbitration mailbox content report message");
                    this.server.SubmitMessage(mbxTransportMailItem, emailMessage, mbxTransportMailItem.OrganizationId, mbxTransportMailItem.ExternalOrganizationId, false);
                }
                else
                {
                    ApprovalProcessingAgent.diag.TraceDebug(0L, "Failed to generate arbitration mailbox content report");
                }
                throw new SmtpResponseException(AckReason.ApprovalUpdateSuccess, base.Name);
            }
            if (!flag)
            {
                if (flag2)
                {
                    ApprovalEngine approvalEngineInstance            = ApprovalEngine.GetApprovalEngineInstance(message, (RoutingAddress)message.From.SmtpAddress, mailRecipient.Email, messageItem, mbxTransportMailItem, ApprovalProcessingAgent.MessageItemCreationDelegate);
                    ApprovalEngine.ApprovalProcessResults resultInfo = approvalEngineInstance.ProcessMessage();
                    this.HandleResults(resultInfo, messageItem, mbxTransportMailItem, mailRecipient);
                }
                return;
            }
            if (!MultilevelAuth.IsInternalMail(message))
            {
                return;
            }
            if (ApprovalRequestUpdater.Result.InvalidUpdateMessage == ApprovalRequestUpdater.TryUpdateExistingApprovalRequest(messageItem))
            {
                throw new SmtpResponseException(AckReason.ApprovalInvalidMessage);
            }
            throw new SmtpResponseException(AckReason.ApprovalUpdateSuccess, base.Name);
        }