示例#1
0
        private void SendEmailToContact(Job job, Contact contact, MessageItem messageItem)
        {
            if (contact == null || !contact.Id.HasValue)
            {
                return;
            }

            var dispatchArgs = new DispatchNewsletterArgs(messageItem, new SendingProcessData(messageItem.MessageId.ToID()));

            _dispatchManager.AddRecipientToDispatchQueue(dispatchArgs, contact.Identifiers.FirstOrDefault(x => x.Source.Equals("ExperienceGenerator")));

            GenerateEventService.GenerateSent(messageItem.ManagerRoot.Settings.BaseURL, contact.Id.Value, messageItem, messageItem.StartTime);
            job.CompletedEmails++;
        }
        private void SendEmailToContact(Job job, ContactData contact, MessageItem messageItem)
        {
            var customValues = new ExmCustomValues
            {
                DispatchType    = DispatchType.Normal,
                Email           = contact.PreferredEmail,
                MessageLanguage = messageItem.TargetLanguage.ToString(),
                ManagerRootId   = messageItem.ManagerRoot.InnerItem.ID.ToGuid(),
                MessageId       = messageItem.InnerItem.ID.ToGuid()
            };

            EcmFactory.GetDefaultFactory().Bl.DispatchManager.EnrollOrUpdateContact(contact.ContactId, new DispatchQueueItem(), messageItem.PlanId.ToGuid(), Constants.SendCompletedStateName, customValues);

            GenerateEventService.GenerateSent(messageItem.ManagerRoot.Settings.BaseURL, contact.ContactId, messageItem, messageItem.StartTime);
            job.CompletedEmails++;
        }