public static Result <MimeMessage> ProcessEmail(MimeMessage originalEmail, string from, ISettingsStore settingsStore, TelemetryClient telemetry) { var userId = originalEmail.From.Mailboxes.First().HashedEmail(); var settings = settingsStore.GetCurrentSettings(userId); var customSheets = settingsStore.GetCustomSheets(userId).ToList(); var attachments = originalEmail.LoadAttachments().ToList(); var handlers = new IMailProcessor[] { new AppleHealthAttachmentMailProcessor(from, settings, customSheets), new AppleHealthGoogleDriveMailProcessor(from, settings, customSheets), new SettingsUpdateMailProcessor(from, settingsStore), new HelpMailProcessor(from), // <-- catch all }; try { var processor = handlers.First(h => h.CanHandle(originalEmail, attachments)); var result = Benchmark.Benchmark.Time(() => processor.Process(originalEmail, attachments)); telemetry.TrackEvent( processor.GetType().Name, metrics: Events.Metrics.Init() .Then(Events.Metrics.Duration, result.Elapsed.TotalMinutes)); return(result.Value); } catch (Exception e) { return(Result.Failure(MailUtility.ConstructErrorMessage(originalEmail, from, e), e)); } }
public UnProcessedFolders(string title, IMailProcessor mailprocessor, ILogger logger) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _mailprocessor = mailprocessor ?? throw new ArgumentNullException(nameof(mailprocessor)); _progress = new ProgressForm(title); }
public ActionResult Contact(ContactFormModel model) { if (!ModelState.IsValid) { return(CurrentUmbracoPage()); } mailProcessor = new MailProcessor(); string result = mailProcessor.Send(model).ToString().ToLowerInvariant(); var queryString = new NameValueCollection(); queryString.Add("succes", result); return(RedirectToCurrentUmbracoPage(queryString)); }
private void SendConfirmationEmail(ApplicationUser appUser, IMailProcessor sender) { string message = "Hi " + appUser.Name + "!"; message += "\n\rYour profile with " + myBusinessName + " has been successfully created."; message += "\n\rYour username is " + appUser.UserName; message += "\n\rYou can log into your account using the following link http://stesha.com.au/Account/Login"; InquiryInfo inq = new InquiryInfo { RecepientName = appUser.Name, RecepientAddress = appUser.Email, Subject = "new account at " + myBusinessName, FullMessage = message }; sender.SendMail(inq); }
public ProcessUserMail(IPipelineApp app, IMailProcessor mail, string userName) : base(userName, mail) { this.mail = mail; CustomContext customContext = new Work.CustomContext(); customContext.Init(app.Properties); app.Use<LongRunningTask>(customContext); app.AddProperty("DataStore", new DataStore()); app.AddProperty("appKey", "ssimon"); app.AddProperty("appValue", "RRt77l09ggf=="); app.UseParallel<MailTask>(); app.UseParallel<SampleTask>(); app.Use<LongRunningTask>(customContext); app.UseParallel<SampleTask>(); app.Start(); }
/// <summary> /// The constructor. /// </summary> /// <param name="categories"></param> /// <param name="mailProcessor">The mail processor</param> /// <param name="options"></param> /// <param name="logger"></param> public ItemMove(ICategories categories, IMailProcessor mailProcessor, IOptions options, ILogger logger) { if (categories == null) { throw new ArgumentNullException(nameof(categories)); } if (mailProcessor == null) { throw new ArgumentNullException(nameof(mailProcessor)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } _mailProcessor = mailProcessor; _logger = logger; _categories = categories; _options = options; }
public async Task AddPluginAsync(IMailProcessor mailProcessorPlugin) { this.Logger.LogInfo("Initializes MailProcessorPlugin \"" + mailProcessorPlugin.GetType().FullName + "\"."); if (mailProcessorPlugin is IInitializable initializable) { await initializable.InitializeAsync(); } MailProcessorCollection collection; if (this.plugins.ContainsKey(typeof(IMailProcessor))) { collection = (MailProcessorCollection)this.plugins[typeof(IMailProcessor)]; } else { this.plugins.Add(typeof(IMailProcessor), collection = new MailProcessorCollection()); } collection.Add(mailProcessorPlugin); this.Logger.LogInfo("Plugin \"" + mailProcessorPlugin.GetType().FullName + "\" ready to use."); }
public QueueReceiver(IQueueFactory queueFactory, IMailProcessor mailProcessor) { _factory = queueFactory; _mailProcessor = mailProcessor; }
public MailController(IMailProcessor mailProcessor) { _mailProcessor = mailProcessor ?? throw new ArgumentNullException($"{GetType().Name}.Ctor - parameter {nameof(mailProcessor)} cannot be null."); }
public ExpressCheckoutController(IRepository repo, IMailProcessor mp) { this.repo = repo; this.mp = mp; }
public CartController(IRepository repo, IPaymentProcessor paymentProcessor, IMailProcessor mailSender) { this.repo = repo; this.paymentProcessor = paymentProcessor; this.mailSender = mailSender; }
public HomeController(IRepository repository, IMailProcessor processor) { this.repository = repository; this.mailProcessor = processor; }
public void Add(IMailProcessor plugin) { this.allPlugins.Add(plugin); }
public UserMailAbstract(string userName, IMailProcessor mail) { System.Diagnostics.Trace.WriteLine("Two"); System.Diagnostics.Trace.WriteLine(userName); }
public AccountController(IRepository repository, IMailProcessor mailProcessor) { this.repository = repository; this.mailProcessor = mailProcessor; //SetupRoles(Roles); }