Пример #1
0
        public AccountController(
            UserManager <ApplicationUser> userManager,
            IJwtService jwtService,
            SignInManager <ApplicationUser> signInManager,
            IUserService userService,
            ISmtpService smtpService,
            IEmailSenderService emailService,
            RoleManager <ApplicationRole> roleManager,
            IIdentityService identityService,
            IOptions <FacebookAuthSettings> fbAuthSettingsAccessor
            )
        {
            _serializerSettings = new JsonSerializerSettings
            {
                Formatting = Formatting.Indented
            };

            this._userManager     = userManager;
            this._jwtService      = jwtService;
            this._userService     = userService;
            this._signInManager   = signInManager;
            this._smtpService     = smtpService;
            this._emailService    = emailService;
            this._identityService = identityService;
            this._fbAuthSettings  = fbAuthSettingsAccessor.Value;
            _roleManager          = roleManager;
        }
Пример #2
0
 public NotificationController(NotificationContext context, ILogger <NotificationController> logger, ISmtpService smtpService, IRepository <Notification.Model.Notification> repositoryNotification)
 {
     _context                = context;
     _logger                 = logger;
     _smtpService            = smtpService;
     _repositoryNotification = repositoryNotification;
 }
Пример #3
0
 public SendEmail(ISmtpService smtpService, IOptions <SmtpOptions> options, IHttpClientFactory httpClientFactory, IContentSerializer contentSerializer)
 {
     _smtpService       = smtpService;
     _httpClientFactory = httpClientFactory;
     _contentSerializer = contentSerializer;
     _options           = options.Value;
 }
Пример #4
0
 public DemoGangUserLinkEventHandler(
     AppSettings app,
     ISmtpService smtp)
 {
     _app  = app;
     _smtp = smtp;
 }
Пример #5
0
        public RegistrationController(
            IUserService userService,
            UserManager <IUser> userManager,
            SignInManager <IUser> signInManager,
            IAuthorizationService authorizationService,
            ISiteService siteService,
            INotifier notifier,
            ISmtpService smtpService,
            IShapeFactory shapeFactory,
            IHtmlDisplay displayManager,
            ILogger <RegistrationController> logger,
            IHtmlLocalizer <RegistrationController> htmlLocalizer,
            IStringLocalizer <RegistrationController> stringLocalizer,
            IEnumerable <IRegistrationFormEvents> registrationEvents) : base(smtpService, shapeFactory, displayManager)
        {
            _userService          = userService;
            _userManager          = userManager;
            _signInManager        = signInManager;
            _authorizationService = authorizationService;
            _siteService          = siteService;
            _notifier             = notifier;
            _registrationEvents   = registrationEvents;

            _logger = logger;
            TH      = htmlLocalizer;
            T       = stringLocalizer;
        }
Пример #6
0
        public async Task ExecuteAsync(ISmtpService smtpService, AttachmentCollection attachments, EmailModel emailModel)
        {
            Email.DefaultSender   = smtpService.GetSmtpSender();
            Email.DefaultRenderer = new RazorRenderer();

            var maxMailSize = 25;

            if ((attachments.AttachmentSize / (1024 * 1024)) < maxMailSize)
            {
                try
                {
                    var email = await Email
                                .From(smtpService.SmtpSettings.FromAddress, "swatincadmin")
                                .To(emailModel.ToAddress, emailModel.ToDisplayName)
                                .Subject(emailModel.Subject)
                                .Attach(attachments.Attachments)
                                .UsingTemplate(emailModel.Template, emailModel.TemplateModel)
                                .SendAsync();

                    //close all filestreams
                    foreach (var item in attachments.Attachments)
                    {
                        item.Data.Close();
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
            else
            {
                throw new Exception($"Cannot mail since the mail size exceeds maximum allowed {maxMailSize} MB");
            }
        }
Пример #7
0
 public EmailController(
     ILogger <EmailController> logger,
     ISmtpService smtpService)
 {
     _logger      = logger;
     _smtpService = smtpService;
 }
Пример #8
0
 public AuthenticationService(IUserRepository userRepository, ISmtpService smtpService, IConfiguration configuration, IClockService clock)
 {
     this.userRepository = userRepository;
     this.smtpService    = smtpService;
     this.configuration  = configuration;
     this.clock          = clock;
 }
Пример #9
0
 public BusinessesModel(ILogger <BusinessesModel> logger, IAuthService authService, ITextMapService textMapService,
                        ISettings settings, ISmtpService smtpService)
     : base(logger, authService, textMapService)
 {
     _settings    = settings;
     _smtpService = smtpService;
 }
Пример #10
0
 public BackgroundWorker(ICsvService csvService, ISmtpService smtpService,
                         IWritableOptions <SchedulerConfig> schedulerConfig)
 {
     _csvService      = csvService;
     _smtpService     = smtpService;
     _schedulerConfig = schedulerConfig;
 }
Пример #11
0
        /*==========================================================================================================================
        | CONSTRUCTOR
        \-------------------------------------------------------------------------------------------------------------------------*/
        /// <summary>
        ///   Establishes a new instance of the <see cref="GoldSimActivator"/>, including any shared dependencies to be used
        ///   across instances of controllers.
        /// </summary>
        /// <remarks>
        ///   The constructor is responsible for establishing dependencies with the singleton lifestyle so that they are available
        ///   to all requests.
        /// </remarks>
        public GoldSimActivator(IConfiguration configuration, IWebHostEnvironment webHostEnvironment)
        {
            /*------------------------------------------------------------------------------------------------------------------------
              | Verify dependencies
              \-----------------------------------------------------------------------------------------------------------------------*/
              Contract.Requires(configuration, nameof(configuration));
              Contract.Requires(webHostEnvironment, nameof(webHostEnvironment));

              /*------------------------------------------------------------------------------------------------------------------------
              | SAVE STANDARD DEPENDENCIES
              \-----------------------------------------------------------------------------------------------------------------------*/
              _configuration        = configuration;
              _webHostEnvironment   = webHostEnvironment;
              var connectionString      = configuration.GetConnectionString("OnTopic");
              var sqlTopicRepository    = new SqlTopicRepository(connectionString);
              var cachedTopicRepository = new CachedTopicRepository(sqlTopicRepository);

              /*------------------------------------------------------------------------------------------------------------------------
              | PRELOAD REPOSITORY
              \-----------------------------------------------------------------------------------------------------------------------*/
              _topicRepository          = cachedTopicRepository;
              _typeLookupService        = new CompositeTypeLookupService(
                                    new GoldSimTopicViewModelLookupService(),
                                    new TopicViewModelLookupService(),
                                    new EditorViewModelLookupService()
                                  );
              _topicMappingService      = new TopicMappingService(_topicRepository, _typeLookupService);

              _topicRepository.Load();

              /*------------------------------------------------------------------------------------------------------------------------
              | INITIALIZE EDITOR COMPOSER
              \-----------------------------------------------------------------------------------------------------------------------*/
              _standardEditorComposer   = new(_topicRepository, _webHostEnvironment);

              /*------------------------------------------------------------------------------------------------------------------------
              | CONSTRUCT SMTP CLIENT
              \-----------------------------------------------------------------------------------------------------------------------*/
              var postmarkApiKey        = _configuration.GetValue<string>("Postmark:ApiKey");
              var postmarkClient        = new PostmarkClient(postmarkApiKey);

              _smtpService              = new PostmarkSmtpService(postmarkClient);

              /*------------------------------------------------------------------------------------------------------------------------
              | CONSTRUCT HIERARCHICAL TOPIC MAPPING SERVICES
              \-----------------------------------------------------------------------------------------------------------------------*/
              _hierarchicalTopicMappingService = new CachedHierarchicalTopicMappingService<Models.NavigationTopicViewModel>(
            new HierarchicalTopicMappingService<Models.NavigationTopicViewModel>(
              _topicRepository,
              _topicMappingService
            )
              );

              _coursewareTopicMappingService = new CachedHierarchicalTopicMappingService<TrackedNavigationTopicViewModel>(
            new HierarchicalTopicMappingService<TrackedNavigationTopicViewModel>(
              _topicRepository,
              _topicMappingService
            )
              );
        }
Пример #12
0
 public EmailTemplateController(
     IAuthorizationService authorizationService,
     EmailTemplatesManager templatesManager,
     IShapeFactory shapeFactory,
     ISiteService siteService,
     IStringLocalizer <EmailTemplateController> stringLocalizer,
     IHtmlLocalizer <EmailTemplateController> htmlLocalizer,
     INotifier notifier,
     ISmtpService smtpService,
     ILiquidTemplateManager liquidTemplateManager,
     HtmlEncoder htmlEncoder,
     IContentManager contentManager,
     IEmailTemplatesService emailTemplatesService
     )
 {
     _authorizationService = authorizationService;
     _templatesManager     = templatesManager;
     New                    = shapeFactory;
     _siteService           = siteService;
     _notifier              = notifier;
     _smtpService           = smtpService;
     S                      = stringLocalizer;
     H                      = htmlLocalizer;
     _liquidTemplateManager = liquidTemplateManager;
     _htmlEncoder           = htmlEncoder;
     _contentManager        = contentManager;
     _emailTemplatesService = emailTemplatesService;
 }
Пример #13
0
 public SmtpServiceTests()
 {
     _mimeKitServiceMock     = new Mock <IMimeKitService>();
     _mimeMessageFactoryMock = new Mock <IMimeMessageFactory>();
     _service = new SmtpService(new OptionsWrapper <SmtpServiceOptions>(_options), _mimeMessageFactoryMock.Object,
                                _mimeKitServiceMock.Object);
 }
Пример #14
0
 public BaseEmailController(
     ISmtpService smtpService,
     IDisplayHelper displayHelper)
 {
     _smtpService   = smtpService;
     _displayHelper = displayHelper;
 }
Пример #15
0
        public ResourceModule(ISmtpService smtpService) : base("/products")
        {
            this.smtpService = smtpService;

            // would capture routes to /products/list sent as a synchronous GET request
            Get("/list", parameters => {
                return(Response.AsJson <Person>(new Person {
                    Age = 1, Name = "finbar"
                }));
            });


            Get("/listasync", async(paramaters) => {
                var person = await Task.FromResult <Person>(new Person {
                    Age = 1, Name = "finbar"
                });
                return(Response.AsJson <Person>(person));
            });

            Post("/postpersonasync", async(args, ct) => {
                Person postedPeron = this.Bind <Person>(); //model binding!

                return(Response.AsJson <Person>(postedPeron));
            });

            Post("/enumIn", async(args, ct) => {
                var body        = Request.Body.AsString();
                var memberState = Enum.Parse <MemberState>(body);

                return(Response.AsText(memberState.ToString()));
            });
        }
Пример #16
0
 public RegisterModel(SignInManager <ApplicationUser> signInManager, UserManager <ApplicationUser> userManager, ILogger <RegisterModel> logger, ISmtpService smtpService)
 {
     this.logger        = logger;
     this.smtpService   = smtpService;
     this.userManager   = userManager;
     this.signInManager = signInManager;
     AppUser            = new ApplicationUser();
 }
 public ContentsAvailabilityMonitor(ISmtpService smtpService, Logger logger, ISpecialReportManager specialReportManager, ISettingsRepository settingsRepository, SmsSubscriptionDataContext context)
 {
     _smtpService          = smtpService;
     _logger               = logger;
     _specialReportManager = specialReportManager;
     _settingsRepository   = settingsRepository;
     _context              = context;
 }
Пример #18
0
 public EmailManager(
     IUserSession session,
     ISmtpService smtpService
     )
 {
     _session     = session;
     _smtpService = smtpService;
 }
 public ContentsAvailabilityMonitor(ISmtpService smtpService, Logger logger, ISpecialReportManager specialReportManager, ISettingsRepository settingsRepository, SmsSubscriptionDataContext context)
 {
     _smtpService = smtpService;
     _logger = logger;
     _specialReportManager = specialReportManager;
     _settingsRepository = settingsRepository;
     _context = context;
 }
Пример #20
0
 public void Init(EntityApp app)
 {
     _smtpService = _app.GetService <ISmtpService>();
     Util.Check(_smtpService != null, "EmailNotificationProvider: failed to retrieve {0} instance.", typeof(ISmtpService));
     _templateService = _app.GetService <ITemplateTransformService>();
     Util.Check(_templateService != null,
                "EmailNotificationProvider: failed to retrieve {0} instance, add Template module to your app.", typeof(ITemplateTransformService));
 }
Пример #21
0
 public ReportDispatcherService(ILogger <ReportDispatcherService> logger,
                                IConfiguration configuration,
                                ISmtpService smtpService)
 {
     _logger        = logger;
     _configuration = configuration;
     _smtpService   = smtpService;
 }
Пример #22
0
 public DeploymentFinishedEmailHandler(
     [NotNull] ISmtpService smtpService,
     [NotNull] EmailNotificationConfiguration emailNotificationConfiguration)
 {
     _smtpService = smtpService ?? throw new ArgumentNullException(nameof(smtpService));
     _emailNotificationConfiguration = emailNotificationConfiguration ??
                                       throw new ArgumentNullException(nameof(emailNotificationConfiguration));
 }
Пример #23
0
 public MessagingService(ITemplateService templateService, ICalendarService calendarService, IConfigurationService configurationService, IAgencyService agencyService, ISmtpService smtpService)
 {
     this.templateService = templateService;
     this.calendarService = calendarService;
     this.configurationService = configurationService;
     this.agencyService = agencyService;
     this.smtpService = smtpService;
 }
Пример #24
0
 public SendItemCompletedEmail(ITvShowSubscriptionRepository tvShowSubscriptionRepository, ISmtpService smtpService, ILogger <SendItemCompletedEmail> logger, IDownloadItemRepository downloadItemRepository, IOptions <NetpipsSettings> options)
 {
     this.tvShowSubscriptionRepository = tvShowSubscriptionRepository;
     this.smtpService            = smtpService;
     this.logger                 = logger;
     this.downloadItemRepository = downloadItemRepository;
     settings = options.Value;
 }
Пример #25
0
 public BaseEmailController(
     ISmtpService smtpService,
     IShapeFactory shapeFactory,
     IHtmlDisplay displayManager)
 {
     _smtpService    = smtpService;
     _shapeFactory   = shapeFactory;
     _displayManager = displayManager;
 }
Пример #26
0
 public UserProcessor(IUserRepository userRepository, ITokenProvider tokenProvider, IMapper mapper, ISmtpService smtpService, IHashingService hashingService, IPasswordGeneratorService passwordGeneratorService)
 {
     _userRepository           = userRepository;
     _tokenProvider            = tokenProvider;
     _mapper                   = mapper;
     _smtpService              = smtpService;
     _hashingService           = hashingService;
     _passwordGeneratorService = passwordGeneratorService;
 }
Пример #27
0
 public EmailTask(
     ISmtpService smtpService,
     IWorkflowExpressionEvaluator expressionEvaluator,
     IStringLocalizer <EmailTask> localizer
     )
 {
     _smtpService         = smtpService;
     _expressionEvaluator = expressionEvaluator;
     S = localizer;
 }
Пример #28
0
 public ContactController(IContactFormSubmissionWriter contactFormSubmissionWriter, IContactFormSubmissionLoader contactFormSubmissionLoader, IContractLoader contractLoader, ICurriculumVitaeReader cvReader, ISmtpService smtpService, IContactFormFactory contactFormFactory, ICookieHandler cookieHandler)
 {
     _contactFormSubmissionWriter = contactFormSubmissionWriter;
     _contactFormSubmissionLoader = contactFormSubmissionLoader;
     _contractLoader     = contractLoader;
     _cvReader           = cvReader;
     _smtpService        = smtpService;
     _contactFormFactory = contactFormFactory;
     _cookieHandler      = cookieHandler;
 }
Пример #29
0
 public CustomEmailWorkflow(ISmtpService smtpService, ILogger logger)
 {
     _smtpService = smtpService;
     _logger      = logger;
     Id           = new Guid("1e106db8-685d-441f-9c19-c5e344163c2c");
     Name         = "Send Custom Email";
     Description  = "This workflow is is to be used to send a custom templated email";
     Icon         = "icon-message";
     Group        = "Services";
 }
Пример #30
0
 public ContactController(IContactFormSubmissionWriter contactFormSubmissionWriter, IContactFormSubmissionLoader contactFormSubmissionLoader, IContractLoader contractLoader, ICurriculumVitaeReader cvReader, ISmtpService smtpService, IContactFormFactory contactFormFactory, ICookieHandler cookieHandler)
 {
     _contactFormSubmissionWriter = contactFormSubmissionWriter;
     _contactFormSubmissionLoader = contactFormSubmissionLoader;
     _contractLoader = contractLoader;
     _cvReader = cvReader;
     _smtpService = smtpService;
     _contactFormFactory = contactFormFactory;
     _cookieHandler = cookieHandler;
 }
Пример #31
0
 private void InternalConfigure(IPropertyReaderFactory readerFactory, ISmtpService smtpService, string host, int port, string username, string password, string to, string from,
                                string subjectValueToken, string bodyValueToken)
 {
     SmtpService = smtpService;
     SmtpService.Initialize(host, port, username, password);
     From          = from;
     To            = to;
     SubjectReader = readerFactory.CreateCombinedReader(subjectValueToken);
     BodyReader    = readerFactory.CreateCombinedReader(bodyValueToken);
 }
Пример #32
0
 public SmtpIntegration(SmtpIntegrationConfiguration configuration)
 {
     if (configuration == null)
     {
         throw new ArgumentNullException(nameof(configuration),
                                         "SMTP Integration configuration has not been provided.");
     }
     _configuration = configuration;
     _smtpService   = _configuration.SmtpServiceProvider();
 }
Пример #33
0
 public EmailSubscriber(
     string connectionString,
     string exchangeName,
     string queueName,
     ISmtpService smtpService,
     ILogFactory logFactory)
     : base(connectionString, exchangeName, queueName, logFactory)
 {
     _smtpService = smtpService;
 }
        public void InitializeTest()
        {
            // Create fake dependencies
            this.notificationConfigurationService = A.Fake<INotificationConfigurationService>();
            this.bitcoinExchangeRatesService = A.Fake<IBitcoinExchangeRatesService>();
            this.smtpService = A.Fake<ISmtpService>();
            this.outputService = A.Fake<IOutputService>();

            // Create test subject
            this.bitcoinPriceNotificationRobot = new BitcoinPriceNotificationRobot(
                this.notificationConfigurationService,
                this.bitcoinExchangeRatesService,
                this.smtpService,
                this.outputService);
        }
Пример #35
0
 private void InternalConfigure(IPropertyReaderFactory readerFactory, ISmtpService smtpService, string host, int port, string username, string password, string to, string from,
                                string subjectValueToken, string bodyValueToken)
 {
     SmtpService = smtpService;
     SmtpService.Initialize(host, port, username, password);
     From = from;
     To = to;
     SubjectReader = readerFactory.CreateCombinedReader(subjectValueToken);
     BodyReader = readerFactory.CreateCombinedReader(bodyValueToken);
 }
Пример #36
0
 /// <summary>
 /// Construct the trace listener
 /// </summary>
 /// <param name="combinedFactory">A property reader factory</param>
 /// <param name="smtpService">The SMTP service</param>
 /// <param name="host">The host name</param>
 /// <param name="port">The host port number</param>
 /// <param name="username">The username used when sending an email</param>
 /// <param name="password">The password used when sending an email</param>
 /// <param name="to">The address of the user who will receive diagnostic traces</param>
 /// <param name="from">The senders address</param>
 /// <param name="subjectValueToken">A token defining the subject</param>
 /// <param name="bodyValueToken">A token defining the body</param>
 public SmtpTraceListener(IPropertyReaderFactory combinedFactory, ISmtpService smtpService, string host, int port, string username, string password, string to, string from,
                          string subjectValueToken, string bodyValueToken)
     : base("SmtpTraceListener")
 {
     InternalConfigure(combinedFactory, smtpService, host, port, username, password, to, from, subjectValueToken, bodyValueToken);
 }
 //https://github.com/sendgrid/sendgrid-csharp
 public EmailService(ISmtpService smtpService)
 {
     _smtpService = smtpService;
 }