public void AddRecipient(MailRecipient recipient) { if (!Recipients.Exists(r => r.Equals(recipient))) { Recipients.Add(recipient); } }
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; } } } }
public void AddUser(User user, MailRecipient recipient) { if (!Users.Keys.Any(u => u.Id == user.Id)) { Users.Add(user, recipient); } }
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); }
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); } } }
private void Entity_Navigate(object sender, MouseButtonEventArgs e) { FrameworkElement el = (FrameworkElement)sender; MailRecipient recipient = (MailRecipient)el.Tag; AddItem(recipient); }
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)); }
/// <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); } }
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)); } }
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 })); }
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)); }
public ActionResult DeleteConfirmed(int id) { MailRecipient mailRecipient = db.MailRecipients.Find(id); db.MailRecipients.Remove(mailRecipient); db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task <ActionResult> DeleteConfirmed(int id) { MailRecipient mailRecipient = await db.MailRecipients.FindAsync(id); db.MailRecipients.Remove(mailRecipient); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
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)); }
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)); }
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); }
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)); }
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); } }
private static string DisplayAddress(MailRecipient recipient) { if (recipient == null) { return(string.Empty); } else { return($"{recipient.Name} <{recipient.Email}>"); } }
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)); }
public ActionResult Create([Bind(Include = "Email")] MailRecipient mailRecipient) { if (ModelState.IsValid) { db.MailRecipients.Add(mailRecipient); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(mailRecipient)); }
public void AddItem(MailRecipient subject) { mVirtualIndex++; mVirtualSize = mVirtualIndex + 1; bool is_new; EntityData data = GetClient().InfoCache.GetData(subject, out is_new); SetItem(data); }
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)); }
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); } }
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); }
public override MailRecipient GetNextRecipient() { while (this.recipientEnumerator.MoveNext()) { MailRecipient mailRecipient = this.recipientEnumerator.Current; if (mailRecipient.Status == Status.Ready) { return(mailRecipient); } } return(null); }
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)); }
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); }
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); } } }
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); }