Beispiel #1
0
 public bool SendTestCampaign(int campaignId, string recepient)
 {
     CampaignService campaignService = new CampaignService();
     var campaign = campaignService.GetCampaign(campaignId);
     var user = new UserService().GetUser(campaign.CreatedBy);
     bool response = false;
     if (campaign.TypeId == (int)CampaignType.SMS)
     {
         SmsModule smsModule = new SmsModule(user.SmsUsername, user.SmsPassword);
         response = smsModule.SendSMS(recepient, campaign.ContentTemplate);
     }
     else
     {
         EmailModule emailModule = new EmailModule(user.EmailUsername, user.EmailPassword);
         response = emailModule.SendEmail(user.Name, recepient, "", "", campaign.SubjectTemplate, campaign.ContentTemplate);
     }
     return response;
 }
Beispiel #2
0
        private void SendEmails(EPUser user, IEnumerable<Email> emailList)
        {
            if (emailList.Count() > 0)
            {
                EmailModule emailModule = new EmailModule(user.EmailUsername, user.EmailPassword);
                foreach (var email in emailList)
                {
                    bool emailSuccess = emailModule.SendEmail(user.Name, email.ToAddress, "", "", email.Subject, email.Body);
                    email.StatusId = emailSuccess ? (int)MessageStatus.Send : (int)MessageStatus.Failed;
                    email.StatusDate = DateTime.Now;
                    emailCount += 1;
                }
                campaignService.UpdateCampaignEmails(emailList);

            }
        }