public AccountController(IEmailComposer emailComposer, IEmailer emailer, IDiObjectMapper mapper, IApplicationLogService applicationLogService) { _emailComposer = emailComposer; _emailer = emailer; _mapper = mapper; _applicationLogService = applicationLogService; }
public static SendGridMessage Run([QueueTrigger("tosendemail", Connection = "AzureWebJobsStorage")] Alert alert, [Inject] IEmailComposer emailComposer, ILogger log) { log.LogInformation($"Sending alert to: {alert.Addressee}"); return(emailComposer.CreateAlertEmail(alert)); }
public bool SendEmail(IEmailComposer emailComposer) { ValidateComposer(emailComposer); using (var smtpClient = new SmtpClient { Host = _settings.SmtpServer, Port = int.Parse(_settings.SmtpPort), EnableSsl = _settings.SmtpEnableSsl, Credentials = new NetworkCredential(_settings.SmtpUser, _settings.SmtpUserPassword) }) { try { using (var mail = new MailMessage()) { foreach (var recipient in emailComposer.Recipients) { mail.To.Add(recipient); } foreach (var ccRecipient in emailComposer.CcRecipients) { mail.CC.Add(ccRecipient); } foreach (var bccRecipient in emailComposer.BccRecipients) { mail.Bcc.Add(bccRecipient); } // NB! From/Sender must be the same as Username for NetworkCredential, or else send will be denied by smtp mail.From = new MailAddress(_settings.SmtpUser, "No Reply D60"); mail.Sender = new MailAddress(_settings.SmtpUser, "No Reply D60"); foreach (var attachment in emailComposer.Attachments) { mail.Attachments.Add(attachment); } mail.Subject = emailComposer.Title; mail.IsBodyHtml = emailComposer.IsHtml; mail.Body = emailComposer.ComposeContent(); smtpClient.Send(mail); // IVA: Try send Async return(true); } } catch (FormatException ex) { throw new MailServiceException("One or more email addresses are invalid", ex); } catch (Exception ex) { throw new Exception("Email was not sent", ex); } } }
public ITService( IGenericUnitOfWork genericUnitOfWork, IDiObjectMapper mapper, ISetUpService setupService, IEmailComposer emailComposer ) { _genericUnitOfWork = genericUnitOfWork; _mapper = mapper; _setupService = setupService; _emailComposer = emailComposer; }
public AuthenticationService(IClientRepository clientRepository, IUserManagementService userManagementService, IUserRepository userRepository, IEmailComposer emailComposer, IMembershipProvider membershipProvider) { _clientRepository = clientRepository; _userManagementService = userManagementService; _userRepository = userRepository; _emailComposer = emailComposer; _membershipProvider = membershipProvider; }
public CITService( IGenericUnitOfWork genericUnitOfWork, IDiObjectMapper mapper, IEmailComposer emailComposer, ISharedService sharedService ) { _genericUnitOfWork = genericUnitOfWork; _emailComposer = emailComposer; _mapper = mapper; _sharedService = sharedService; }
public PettyCashService( ISetUpService setupService, ISharedService sharedService, IEmailComposer emailComposer, IDiObjectMapper objectMapper, IGenericUnitOfWork genericUnitOfWork) { _setupService = setupService; _sharedService = sharedService; _emailComposer = emailComposer; _objectMapper = objectMapper; _genericUnitOfWork = genericUnitOfWork; }
private void ValidateComposer(IEmailComposer composer) { if (composer.Recipients.Count == 0 && composer.CcRecipients.Count == 0 && composer.BccRecipients.Count == 0) { throw new MailServiceException("No recipients has been added in the email composer"); } if (string.IsNullOrWhiteSpace(composer.Sender)) { throw new MailServiceException("No sender has been added in the email composer"); } }
public AocaService(IGenericUnitOfWork genericUnitOfWork, ISharedService sharedService, IListService listService, ISetUpService setupService, IEmailComposer emailComposer, IDiObjectMapper mapper) { _listService = listService; _sharedService = sharedService; _emailComposer = emailComposer; _setupService = setupService; _mapper = mapper; _genericUnitOfWork = genericUnitOfWork; }
public BOCAService(IGenericUnitOfWork genericUnitOfWork, ISharedService sharedService, IListService listService, ISetUpService setupService, IEmailComposer emailComposer, ApplicationLogService applicationLogService, IDiObjectMapper mapper) { _genericUnitOfWork = genericUnitOfWork; _sharedService = sharedService; _listService = listService; _setupService = setupService; _emailComposer = emailComposer; _applicationLogService = applicationLogService; _mapper = mapper; }
public static async Task <SendGridMessage> SendConfirmationEmail( [ActivityTrigger] UpdaterOrchestratorData orchestratorData, [Table("Subscribers")] CloudTable subscribersTable, [Inject] IEmailComposer emailComposer, ILogger log) { log.LogInformation($"SendConfirmationEmail to: {orchestratorData.SubmitInfo.Email}"); string[] emailSplited = orchestratorData.SubmitInfo.Email.Split("@"); if (emailSplited.Length != 2) { return(null); } SubscriberInfo subscriberInfo = await subscribersTable.GetTableEntity <SubscriberInfo>(emailSplited[1], emailSplited[0]); return(subscriberInfo == null?emailComposer.CreateActivationMessage(orchestratorData) : emailComposer.CreateUpdateMessage(orchestratorData)); }
public async void Show(Page callingPage) { RateFeedbackResult result = RateFeedbackResult.None; await Task.Delay(1); // var rateAnswer = await callingPage.DisplayAlert(RateMessageTitle, RateMessage, RateButtonLabel, RateCancelLabel); callingPage.DisplayAlert(RateMessageTitle, RateMessage, RateButtonLabel, RateCancelLabel).ContinueWith(r => { if (r.Result) { IAppRater rater = DependencyService.Get <IAppRater>(); rater.RateApp(this.AppId); result = RateFeedbackResult.Rate; this.RateFeedbackCompleted(callingPage, new RateFeedbackEventArgs(result)); } else { // var feedbackAnswer = await callingPage.DisplayAlert(FeebackMessageTitle, FeebackMessage, FeebackButtonLabel, FeebackCancelLabel); callingPage.DisplayAlert(FeebackMessageTitle, FeebackMessage, FeebackButtonLabel, FeebackCancelLabel).ContinueWith(f => { if (f.Result) { IEmailComposer emailer = DependencyService.Get <IEmailComposer>(); emailer.SendEmail(FeedbackEmail, FeedbackSubject, FeedbackBody); result = RateFeedbackResult.Feedback; this.RateFeedbackCompleted(callingPage, new RateFeedbackEventArgs(result)); } else { this.RateFeedbackCompleted(callingPage, new RateFeedbackEventArgs(result)); } }, TaskScheduler.FromCurrentSynchronizationContext() ); } }, TaskScheduler.FromCurrentSynchronizationContext() ); }
public void StartUp() { var config = new BBWTConfig { App = new AppConfig { Name = "Test Application" } }; var user = new User { Name = "*****@*****.**", FirstName = "John", Surname = "Green" }; var mockConfigService = new Mock <IConfigService>(); mockConfigService.Setup(s => s.Settings).Returns(config); var mockMembershipService = new Mock <IMembershipService>(); mockMembershipService.Setup(s => s.GetCurrentUser()).Returns(user); var mockEmailTemplateService = new Mock <IEmailTemplateService>(); this.emailComposer = new EmailComposer(mockEmailTemplateService.Object, mockConfigService.Object, mockMembershipService.Object); this.emailSender = new EmailSender(mockConfigService.Object, this.emailComposer); System.Configuration.Configuration cfg = ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None); SmtpSection smtpSection = cfg.GetSection("system.net.mailSettings.smtp") as SmtpSection; if (smtpSection != null) { try { smtpSection.DeliveryFormat = SmtpDeliveryFormat.International; smtpSection.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory; } finally { cfg.Save(); } } }
/// <summary> /// Initializes email sender. /// </summary> /// <param name="configService">The config service.</param> /// <param name="emailComposer">The email composer.</param> public EmailSender(IConfigService configService, IEmailComposer emailComposer) { this.configService = configService; this.emailComposer = emailComposer; }
public EmailService(IEmailComposer composer, IEmailClient client) { _composer = composer; _client = client; }
public ParttimerService(IDiObjectMapper objectMapper, IGenericUnitOfWork genericUnitOfWork, IEmailComposer emailComposer) { _objectMapper = objectMapper; _genericUnitOfWork = genericUnitOfWork; _emailComposer = emailComposer; }
public SetUpController(IEmailComposer emailComposer, IEmailer emailer, ISetUpService setUpService) { _emailComposer = emailComposer; _emailer = emailer; SetUpService = setUpService; }