Пример #1
0
 public Handler(IDbContext db, UserManager <User> userManager, IEmailProvider provider, IOptions <DomainOptions> options)
 {
     _db          = db;
     _userManager = userManager;
     _provider    = provider;
     _options     = options;
 }
Пример #2
0
        public EmailSender(
            IEnumerable <IEmailProviderType> emailProviderTypes,
            IOptions <EmailOptions> options,
            IStorageFactory storageFactory,
            ITemplateLoaderFactory templateLoaderFactory)
        {
            this.options = options.Value;

            var providerType = emailProviderTypes
                               .FirstOrDefault(x => x.Name == this.options.Provider.Type);

            if (providerType == null)
            {
                throw new ArgumentNullException("ProviderType", $"The provider type {this.options.Provider.Type} does not exist. Maybe you are missing a reference or an Add method call in your Startup class.");
            }

            this.provider = providerType.BuildProvider(this.options.Provider);

            if (!string.IsNullOrWhiteSpace(this.options.TemplateStorage))
            {
                var store = storageFactory.GetStore(this.options.TemplateStorage);
                if (store == null)
                {
                    throw new ArgumentNullException("TemplateStorage", $"There is no file store configured with name {this.options.TemplateStorage}. Unable to initialize email templating.");
                }

                this.templateLoader = templateLoaderFactory.Create(store);
            }
        }
Пример #3
0
        private IEmailMessage CreateMessage(IEmailProvider provider)
        {
            var message = provider.CreateMessage();

            if (!string.IsNullOrEmpty(to.Text))
            {
                message.To.Add(to.Text);
            }
            if (!string.IsNullOrEmpty(cc.Text))
            {
                message.Cc.Add(cc.Text);
            }
            if (!string.IsNullOrEmpty(bcc.Text))
            {
                message.Bcc.Add(bcc.Text);
            }
            if (!string.IsNullOrEmpty(subject.Text))
            {
                message.Subject = subject.Text;
            }
            if (!string.IsNullOrEmpty(body.Text))
            {
                message.Body = body.Text;
            }
            if (!string.IsNullOrEmpty(files.Text))
            {
                message.AttachmentFilePath.Add(files.Text);
            }
            return(message);
        }
Пример #4
0
 public TestController(ILogger <TestController> logger, IMediator mediator, IEmailProvider emailProvider,
                       SalaryCalculatorDelegate salaryCalculatorDelegate) : base(mediator)
 {
     _logger                   = logger;
     _emailProvider            = emailProvider;
     _salaryCalculatorDelegate = salaryCalculatorDelegate;
 }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TesterController" /> class.
 /// </summary>
 public TesterController(INotificationService service, IDiscordNotification notification, IEmailNotification emailN,
                         IPushbulletNotification pushbullet, ISlackNotification slack, IPushoverNotification po, IMattermostNotification mm,
                         IPlexApi plex, IEmbyApiFactory emby, IRadarrApi radarr, ISonarrApi sonarr, ILogger <TesterController> log, IEmailProvider provider,
                         ICouchPotatoApi cpApi, ITelegramNotification telegram, ISickRageApi srApi, INewsletterJob newsletter, ILegacyMobileNotification mobileNotification,
                         ILidarrApi lidarrApi, IGotifyNotification gotifyNotification, IWhatsAppApi whatsAppApi, OmbiUserManager um, IWebhookNotification webhookNotification,
                         IJellyfinApi jellyfinApi)
 {
     Service                = service;
     DiscordNotification    = notification;
     EmailNotification      = emailN;
     PushbulletNotification = pushbullet;
     SlackNotification      = slack;
     PushoverNotification   = po;
     MattermostNotification = mm;
     PlexApi                = plex;
     RadarrApi              = radarr;
     EmbyApi                = emby;
     SonarrApi              = sonarr;
     Log                  = log;
     EmailProvider        = provider;
     CouchPotatoApi       = cpApi;
     TelegramNotification = telegram;
     SickRageApi          = srApi;
     Newsletter           = newsletter;
     MobileNotification   = mobileNotification;
     LidarrApi            = lidarrApi;
     GotifyNotification   = gotifyNotification;
     WhatsAppApi          = whatsAppApi;
     UserManager          = um;
     WebhookNotification  = webhookNotification;
     _jellyfinApi         = jellyfinApi;
 }
Пример #6
0
        public EmailService(IUserProfileService userProfileService, IUsersService usersService, IGeoLocationProvider geoLocationProvider, IEmailProvider emailProvider,
                            IDepartmentsService departmentsService, ICallEmailProvider callEmailProvider, IEmailSender emailSender, IAmazonEmailSender amazonEmailSender)
        {
            _userProfileService  = userProfileService;
            _usersService        = usersService;
            _geoLocationProvider = geoLocationProvider;
            _emailProvider       = emailProvider;
            _departmentsService  = departmentsService;
            _callEmailProvider   = callEmailProvider;
            _emailSender         = emailSender;
            _amazonEmailSender   = amazonEmailSender;

            _smtpClient = new SmtpClient
            {
                DeliveryMethod = SmtpDeliveryMethod.Network,
                Host           = Config.OutboundEmailServerConfig.Host
            };
            _smtpClient.Credentials = new System.Net.NetworkCredential(Config.OutboundEmailServerConfig.UserName, Config.OutboundEmailServerConfig.Password);

            IEmailSender sender = new EmailSender
            {
                CreateClientFactory = () => new SmtpClientWrapper(_smtpClient)
            };

            _emailProvider.Configure(emailSender, "*****@*****.**");
        }
Пример #7
0
        /// <summary>
        /// Sets the controls.
        /// </summary>
        private void SetControls()
        {
            IEmailProvider provider = EmailProviders.GetByKey((string)cbbEMailServerProvider.SelectedItem);

            if (provider != null && provider != m_defaultProvider)
            {
                tbEmailServerAddress.Text       = provider.ServerAddress;
                tbEmailPort.Text                = provider.ServerPort.ToString(CultureConstants.DefaultCulture);
                cbEmailServerRequireSsl.Checked = provider.RequiresSsl;
                cbEmailAuthRequired.Checked     = provider.RequiresAuthentication;
                tlpEmailServerSettings.Enabled  = false;
            }
            else
            {
                tlpEmailServerSettings.Enabled = true;
                tbEmailServerAddress.Text      = m_settings.EmailSmtpServerAddress;
                tbEmailPort.Text = m_settings.EmailPortNumber.ToString(CultureConstants.DefaultCulture);
                cbEmailServerRequireSsl.Checked = m_settings.EmailServerRequiresSsl;
                cbEmailAuthRequired.Checked     = m_settings.EmailAuthenticationRequired;
            }

            tbEmailUsername.Text = m_settings.EmailAuthenticationUserName;
            tbEmailPassword.Text = Util.Decrypt(m_settings.EmailAuthenticationPassword, m_settings.EmailAuthenticationUserName);
            tbFromAddress.Text   = m_settings.EmailFromAddress;
            tbToAddress.Text     = m_settings.EmailToAddress;
        }
Пример #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TesterController" /> class.
 /// </summary>
 public TesterController(INotificationService service, IDiscordNotification notification, IEmailNotification emailN,
                         IPushbulletNotification pushbullet, ISlackNotification slack, IPushoverNotification po, IMattermostNotification mm,
                         IPlexApi plex, IEmbyApi emby, IRadarrApi radarr, ISonarrApi sonarr, ILogger <TesterController> log, IEmailProvider provider,
                         ICouchPotatoApi cpApi, ITelegramNotification telegram, ISickRageApi srApi, INewsletterJob newsletter, IMobileNotification mobileNotification,
                         ILidarrApi lidarrApi, IGotifyNotification gotifyNotification)
 {
     Service                = service;
     DiscordNotification    = notification;
     EmailNotification      = emailN;
     PushbulletNotification = pushbullet;
     SlackNotification      = slack;
     PushoverNotification   = po;
     MattermostNotification = mm;
     PlexApi                = plex;
     RadarrApi              = radarr;
     EmbyApi                = emby;
     SonarrApi              = sonarr;
     Log                  = log;
     EmailProvider        = provider;
     CouchPotatoApi       = cpApi;
     TelegramNotification = telegram;
     SickRageApi          = srApi;
     Newsletter           = newsletter;
     MobileNotification   = mobileNotification;
     LidarrApi            = lidarrApi;
     GotifyNotification   = gotifyNotification;
 }
Пример #9
0
 public EmailNotification(ISettingsService <EmailNotificationSettings> settings, INotificationTemplatesRepository r, IMovieRequestRepository m, ITvRequestRepository t, IEmailProvider prov, ISettingsService <CustomizationSettings> c,
                          ILogger <EmailNotification> log, UserManager <OmbiUser> um) : base(settings, r, m, t, c, log)
 {
     EmailProvider = prov;
     Logger        = log;
     _userManager  = um;
 }
        void SendSystemEmail(VLSystemEmail pendingEmail)
        {
            IEmailProvider provider = GetProvider();

            InfoFormat("TheSystemMailer({0})::SendSystemEmail(), called for EmailId={1} & Subject={2} & ToAddress={3}", this.Name, pendingEmail.EmailId, pendingEmail.Subject, pendingEmail.ToAddress);

            var         subject = pendingEmail.Subject;
            var         body    = pendingEmail.Body;
            MailAddress from    = new MailAddress(pendingEmail.FromAddress, pendingEmail.FromDisplayName, Encoding.UTF8);
            MailAddress to      = new MailAddress(pendingEmail.ToAddress);
            MailAddress replyTo = new MailAddress(pendingEmail.FromAddress);

            bool emailed = provider.SendEmail(from, to, replyTo, subject, Encoding.UTF8, body, Encoding.UTF8, false);

            if (emailed == false)
            {
                DebugFormat("Sending email to {0} (EmailId = {1}, subject = {2})-> FAILED", pendingEmail.ToAddress, pendingEmail.EmailId, pendingEmail.Subject);
                pendingEmail.Status = EmailStatus.Failed;
                pendingEmail.Error  = "provider.SendEmail() returned false!";
                pendingEmail.SendDT = Utility.UtcNow();
                return;
            }

            DebugFormat("Sending email to {0} (EmailId = {1}, subject = {2})-> SUCCESS", pendingEmail.ToAddress, pendingEmail.EmailId, pendingEmail.Subject);
            pendingEmail.Status = EmailStatus.Sent;
            pendingEmail.SendDT = Utility.UtcNow();
        }
Пример #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OrganizationInvitesController"/> class.
 /// </summary>
 /// <param name="service">
 /// Organizations service
 /// </param>
 public OrganizationInvitesController(IOrganizationInvitesService service, IEmailProvider emailProvider, IUsersService usersService, IOrganizationService organizationService)
 {
     _service             = service;
     _emailProvider       = emailProvider;
     _usersService        = usersService;
     _organizationService = organizationService;
 }
Пример #12
0
 public NewsletterJob(IPlexContentRepository plex, IEmbyContentRepository emby, IRepository <RecentlyAddedLog> addedLog,
                      IMovieDbApi movieApi, ITvMazeApi tvApi, IEmailProvider email, ISettingsService <CustomizationSettings> custom,
                      ISettingsService <EmailNotificationSettings> emailSettings, INotificationTemplatesRepository templateRepo,
                      UserManager <OmbiUser> um, ISettingsService <NewsletterSettings> newsletter, ILogger <NewsletterJob> log,
                      ILidarrApi lidarrApi, IRepository <LidarrAlbumCache> albumCache, ISettingsService <LidarrSettings> lidarrSettings,
                      ISettingsService <OmbiSettings> ombiSettings, ISettingsService <PlexSettings> plexSettings, ISettingsService <EmbySettings> embySettings)
 {
     _plex                  = plex;
     _emby                  = emby;
     _recentlyAddedLog      = addedLog;
     _movieApi              = movieApi;
     _tvApi                 = tvApi;
     _email                 = email;
     _customizationSettings = custom;
     _templateRepo          = templateRepo;
     _emailSettings         = emailSettings;
     _newsletterSettings    = newsletter;
     _userManager           = um;
     _log                   = log;
     _lidarrApi             = lidarrApi;
     _lidarrAlbumRepository = albumCache;
     _lidarrSettings        = lidarrSettings;
     _ombiSettings          = ombiSettings;
     _plexSettings          = plexSettings;
     _embySettings          = embySettings;
 }
Пример #13
0
 public MessageService()
 {
     _configurationProvider = new ConfigurationProvider();
     _resourceProvider      = new ResourceProvider(Fit2WorkDb);
     _smsProvider           = new SmsProvider(_configurationProvider);
     _emailProvider         = new EmailProvider();
 }
Пример #14
0
 public IdentityController(OmbiUserManager user,
                           RoleManager <IdentityRole> rm,
                           IEmailProvider prov,
                           ISettingsService <EmailNotificationSettings> s,
                           ISettingsService <CustomizationSettings> c,
                           ISettingsService <OmbiSettings> ombiSettings,
                           IWelcomeEmail welcome,
                           ILogger <IdentityController> l,
                           IPlexApi plexApi,
                           ISettingsService <PlexSettings> settings,
                           ISettingsService <UserManagementSettings> umSettings,
                           IRepository <UserNotificationPreferences> notificationPreferences,
                           IRepository <UserQualityProfiles> userProfiles,
                           IUserDeletionEngine deletionEngine,
                           IRequestLimitService requestLimitService,
                           ICacheService cacheService)
 {
     UserManager           = user;
     RoleManager           = rm;
     EmailProvider         = prov;
     EmailSettings         = s;
     CustomizationSettings = c;
     WelcomeEmail          = welcome;
     _log                         = l;
     _plexApi                     = plexApi;
     _plexSettings                = settings;
     OmbiSettings                 = ombiSettings;
     _userManagementSettings      = umSettings;
     _userNotificationPreferences = notificationPreferences;
     _userQualityProfiles         = userProfiles;
     _deletionEngine              = deletionEngine;
     _requestLimitService         = requestLimitService;
     _cacheService                = cacheService;
 }
Пример #15
0
 public IdentityController(OmbiUserManager user, IMapper mapper, RoleManager <IdentityRole> rm, IEmailProvider prov,
                           ISettingsService <EmailNotificationSettings> s,
                           ISettingsService <CustomizationSettings> c,
                           ISettingsService <OmbiSettings> ombiSettings,
                           IWelcomeEmail welcome,
                           IMovieRequestRepository m,
                           ITvRequestRepository t,
                           ILogger <IdentityController> l,
                           IPlexApi plexApi,
                           ISettingsService <PlexSettings> settings,
                           IRepository <RequestLog> requestLog,
                           IRepository <Issues> issues,
                           IRepository <IssueComments> issueComments)
 {
     UserManager           = user;
     Mapper                = mapper;
     RoleManager           = rm;
     EmailProvider         = prov;
     EmailSettings         = s;
     CustomizationSettings = c;
     WelcomeEmail          = welcome;
     MovieRepo             = m;
     TvRepo                = t;
     _log                     = l;
     _plexApi                 = plexApi;
     _plexSettings            = settings;
     _issuesRepository        = issues;
     _requestLogRepository    = requestLog;
     _issueCommentsRepository = issueComments;
     OmbiSettings             = ombiSettings;
 }
Пример #16
0
        public bool ResetMyPassword(string emailAddress, IEmailProvider emailProvider)
        {
            var user = DataContext.UserIdentitySet.Where(h => h.EmailAddress == emailAddress).SingleOrDefault();

            var isReset           = false;
            var resetPassword     = "******";
            var encryptedPassword = Cipher.Encrypt(resetPassword);

            if (user == null)
            {
                throw new SecurityException("This email account " + emailAddress + " does not exist in our system.");
            }


            if (user.Deactivated != null || user.LockedOut != null)
            {
                throw new SecurityException("You account is not active, please contact the administrator.");
            }

            user.PasswordHash = encryptedPassword;

            emailProvider.SendPasswordResetEmail(user, resetPassword);

            DataContextSaveChanges();

            isReset = true;

            return(isReset);
        }
Пример #17
0
        public MakeMoneyService(
            ILogger logger,
            IEmailProvider emailProvider,
            bool isSendEmails,
            string userSecretsFile,
            string commonSecretsFile,
            IMmStoreService storeService,
            IAds30Service ads30Service,
            IEvents3Service events3Service)
        {
            this.logger            = logger;
            this.emailProvider     = emailProvider;
            this.isSendEmails      = isSendEmails;
            this.userSecretsFile   = userSecretsFile;
            this.commonSecretsFile = commonSecretsFile;
            this.storeService      = storeService;
            this.ads30Service      = ads30Service;
            this.events3Service    = events3Service;

            this.makeMoney = new MakeMoneyProvider(new BaseClientService.Initializer
            {
                Serializer = new NoRootXmlSerializer()
            });

            this.userSettings = JsonConvert.DeserializeObject <UserSettings>(File.ReadAllText(this.userSecretsFile));
        }
Пример #18
0
        public AdminService(
            ICompanyRepository cathedraRepository,
            ISubjectRepository subjectRepository,
            ITeacherRepository teacherRepository,
            IStudentRepository studentRepository,
            ICompanyMapper cathedraMapper,
            ISubjectMapper subjectMapper,
            ITeacherMapper teacherMapper,
            IStudentMapper studentMapper,
            IAccountMapper accountMapper,
            IDateParseHelper dateParseHelper,
            IEmailProvider emailProvider,
            UserManager <ApplicationUser> userManager,
            SignInManager <ApplicationUser> signInManager)
        {
            _companyRepository = cathedraRepository;
            _subjectRepository = subjectRepository;
            _teacherRepository = teacherRepository;
            _studentRepository = studentRepository;

            _cathedraMapper = cathedraMapper;
            _subjectMapper  = subjectMapper;
            _teacherMapper  = teacherMapper;
            _studentMapper  = studentMapper;
            _accountMapper  = accountMapper;

            _dateParseHelper = dateParseHelper;

            _emailProvider = emailProvider;

            _userManager   = userManager;
            _signInManager = signInManager;
        }
Пример #19
0
 public NewsletterJob(IPlexContentRepository plex, IEmbyContentRepository emby, IJellyfinContentRepository jellyfin, IRepository <RecentlyAddedLog> addedLog,
                      IMovieDbApi movieApi, IEmailProvider email, ISettingsService <CustomizationSettings> custom,
                      ISettingsService <EmailNotificationSettings> emailSettings, INotificationTemplatesRepository templateRepo,
                      UserManager <OmbiUser> um, ISettingsService <NewsletterSettings> newsletter, ILogger <NewsletterJob> log,
                      ILidarrApi lidarrApi, IExternalRepository <LidarrAlbumCache> albumCache, ISettingsService <LidarrSettings> lidarrSettings,
                      ISettingsService <OmbiSettings> ombiSettings, ISettingsService <PlexSettings> plexSettings, ISettingsService <EmbySettings> embySettings, ISettingsService <JellyfinSettings> jellyfinSettings,
                      IHubContext <NotificationHub> notification, IRefreshMetadata refreshMetadata)
 {
     _plex                  = plex;
     _emby                  = emby;
     _jellyfin              = jellyfin;
     _recentlyAddedLog      = addedLog;
     _movieApi              = movieApi;
     _email                 = email;
     _customizationSettings = custom;
     _templateRepo          = templateRepo;
     _emailSettings         = emailSettings;
     _newsletterSettings    = newsletter;
     _userManager           = um;
     _log                   = log;
     _lidarrApi             = lidarrApi;
     _lidarrAlbumRepository = albumCache;
     _lidarrSettings        = lidarrSettings;
     _ombiSettings          = ombiSettings;
     _plexSettings          = plexSettings;
     _embySettings          = embySettings;
     _jellyfinSettings      = jellyfinSettings;
     _notification          = notification;
     _ombiSettings.ClearCache();
     _plexSettings.ClearCache();
     _emailSettings.ClearCache();
     _customizationSettings.ClearCache();
     _refreshMetadata = refreshMetadata;
 }
Пример #20
0
 public EmailService(ISessionHelper sessionHelper, IDistributedCacheWrapper distributedCache, IEnumerable <IEmailProvider> emailProviders, IActionHelper actionHelper)
 {
     _sessionHelper    = sessionHelper;
     _distributedCache = distributedCache;
     _emailProvider    = emailProviders.First();
     _actionHelper     = actionHelper;
 }
Пример #21
0
        public IEmailProvider GetProvider(EmailMessage email)
        {
            IEmailProvider retVal = null;


            EmailConnection connection = email.GetConnection();

            if (connection != null)
            {
                if (this.Providers.ContainsKey(connection.Name))
                {
                    //get cached data command provider
                    retVal = this.Providers[connection.Name];
                }
                else
                {
                    EmailConnectionType connectionType = connection.GetConnectionType();

                    if (connectionType != null)
                    {
                        string assemblyName = connectionType.Assembly;
                        string className    = connectionType.Class;

                        if (!String.IsNullOrEmpty(assemblyName) && !String.IsNullOrEmpty(className))
                        {
                            try
                            {
                                Assembly providerAssembly = Assembly.Load(assemblyName);
                                if (providerAssembly != null)
                                {
                                    Type type = providerAssembly.GetType(className, true, true);

                                    if (type != null)
                                    {
                                        ConstructorInfo constructor = type.GetConstructor(Type.EmptyTypes);
                                        retVal = constructor.Invoke(null) as IEmailProvider;

                                        retVal.Initialize(connectionType.Settings);

                                        this.Providers.Add(connection.Name, retVal);
                                    }
                                }
                            }
                            catch
                            {
                                //silent error
                            }
                        }
                    }
                }
            }

            if (retVal == null)
            {
                throw new Exception(String.Format("No valid email provider was found"));
            }

            return(retVal);
        }
Пример #22
0
 public WelcomeEmail(ISettingsService <EmailNotificationSettings> email, INotificationTemplatesRepository template, ISettingsService <CustomizationSettings> c,
                     IEmailProvider provider)
 {
     _emailSettings         = email;
     _email                 = provider;
     _templates             = template;
     _customizationSettings = c;
 }
Пример #23
0
 public AccountProvider(IAuthenticationProvider authenticationProvider, ICaptchaProvider captchaProvider,
                        IEmailProvider emailProvider, IMobileProvider mobileProvider)
 {
     _authenticationProvider = authenticationProvider;
     _captchaProvider = captchaProvider;
     _emailProvider = emailProvider;
     _mobileProvider = mobileProvider;
 }
Пример #24
0
 static EmailManager()
 {
     EmailProvider = ContainerManager.Resolve <IEmailProvider>();
     if (EmailProvider == null)
     {
         EmailProvider = new NetEmailProvider();
     }
 }
Пример #25
0
 public BulkEmailProcessor(IEmailProvider emailProvider)
 {
     if (emailProvider == null)
     {
         throw new ArgumentNullException("emailProvider");
     }
     this.emailProvider = emailProvider;
 }
 public SeatsController(ISeatList seatList, ISeatAdd seatAdd, ISeatRemove seatRemove, IEmailProvider emailProvider, ILogger <SeatsController> logger)
 {
     _seatList      = seatList;
     _seatAdd       = seatAdd;
     _seatRemove    = seatRemove;
     _emailProvider = emailProvider;
     _logger        = logger;
 }
Пример #27
0
 public UserService(UserManager <User> userManager, IEmailProvider emailService,
                    IRandomPasswordGeneratorProvider randomPasswordGenerator, IMapper mapper)
 {
     _userManager             = userManager;
     _emailService            = emailService;
     _randomPasswordGenerator = randomPasswordGenerator;
     _mapper = mapper;
 }
Пример #28
0
 public CommentManager(ICommentDal commentDal, IEmailProvider emailProvider,
                       IDataSheetService dataSheetService, IUserService userService)
 {
     _commentDal       = commentDal;
     _emailProvider    = emailProvider;
     _dataSheetService = dataSheetService;
     _userService      = userService;
 }
Пример #29
0
 public Handler(IDbContext db, IEmailProvider provider, IConfiguration configuration, UserManager <User> userManager, ITokenGenerator tokenGenerator) : base(db)
 {
     _db             = db;
     _provider       = provider;
     _configuration  = configuration;
     _userManager    = userManager;
     _tokenGenerator = tokenGenerator;
 }
Пример #30
0
 public EmailService(IEmailProvider emailProvider, ILogger <EmailService> logger, IServiceProvider serviceProvider, IOptions <ConfigOptions> configOptions)
 {
     _emailProvider = emailProvider;
     _logger        = logger;
     _configOptions = configOptions;
     _mylist        = serviceProvider.GetServices <IEmailProvider>().ToList();
     _mylist.ForEach(provider => _emailProviders.Add(provider.ProviderName, provider));
 }
Пример #31
0
 public EmailNotification(ISettingsService <EmailNotificationSettings> settings, INotificationTemplatesRepository r, IMovieRequestRepository m, ITvRequestRepository t, IEmailProvider prov, ISettingsService <CustomizationSettings> c,
                          ILogger <EmailNotification> log, UserManager <OmbiUser> um, IRepository <RequestSubscription> sub, IMusicRequestRepository music,
                          IRepository <UserNotificationPreferences> userPref) : base(settings, r, m, t, c, log, sub, music, userPref)
 {
     EmailProvider = prov;
     Logger        = log;
     _userManager  = um;
 }
 public AlertSender(
     ILoggerFactory loggerFactory,
     IAzureApplicationResourceFactory applicationResourceFactory,
     IEmailProvider emailProvider)
 {
     _emailProvider = emailProvider;
     _table = applicationResourceFactory.GetTableStorageRepository<AlertSubscriber>(ComponentIdentity);
     _logger = loggerFactory.CreateShortLivedLogger(ComponentIdentity);
     _sourceEmailAddress = applicationResourceFactory.Setting(ComponentIdentity, "alert-from");
 }
 public NotificationManager(IUserNotificationRepository userNotificationRepository
     ,IEmailProvider emailProvider
     ,IBoardUserShareRepository boardUserShareRepository
     ,IUserManager userManager)
 {
     _userNotificationRepository = userNotificationRepository;
     _userNotificationRepository.EnsureExist();
     _emailProvider = emailProvider;
     _boardUserShareRepository = boardUserShareRepository;
     _userManager = userManager;
 }
Пример #34
0
        public DraftService(
            IPlayersService playersService,
            IEmailProvider emailProvider)
        {
            _playersService = playersService;
            _emailProvider = emailProvider;

            _availablePlayers = _playersService.GetPlayersModel(true).Players;

            ResetDraft();
        }
Пример #35
0
		internal UsageEmailDialog()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();
			richTextBox2.Text = "May we ask you a favor? We would like to send a tiny e-mail back to the software developers telling us of your progress.\nYou will be able to view the e-mail before it goes out. You do not need to be connected to the Internet right now...the e-mail will just open and you can save it in your outbox.";
			m_topLineText.Text = string.Format(this.m_topLineText.Text, UsageReporter.AppNameToUseInDialogs);
			_emailProvider = EmailProviderFactory.PreferredEmailProvider();
			_emailMessage = _emailProvider.CreateMessage();

		}
Пример #36
0
        public EmailService(IMailboxConfiguration mailboxConfiguration, IEmailProvider emailProvider, ISmsService smsService, IMobileNumberValidator mobileNumberValidator, IBusinessHoursService businessHoursService)
        {
            Check.If(mailboxConfiguration).IsNotNull();
            Check.If(emailProvider).IsNotNull();
            Check.If(smsService).IsNotNull();
            Check.If(mobileNumberValidator).IsNotNull();
            Check.If(businessHoursService).IsNotNull();

            _mailboxConfiguration = mailboxConfiguration;
            _emailProvider = emailProvider;
            _smsService = smsService;
            _mobileNumberValidator = mobileNumberValidator;
            _businessHoursService = businessHoursService;
        }
Пример #37
0
		/// <summary>
		/// Constructor.
		/// </summary>
		public SubmissionService(
			ILogger<SubmissionService> logger,
			DatabaseContext dbContext,
			ISubmissionCreator submissionCreator,
			ISubmissionDownloader submissionDownloader,
			ISubmissionArchiveBuilder submissionArchiveBuilder,
			ITimeProvider timeProvider,
			IEmailProvider emailProvider)
		{
			_logger = logger;
			_dbContext = dbContext;
			_submissionCreator = submissionCreator;
			_submissionDownloader = submissionDownloader;
			_submissionArchiveBuilder = submissionArchiveBuilder;
			_timeProvider = timeProvider;
			_emailProvider = emailProvider;
		}
Пример #38
0
		/// <summary>
		/// Constructor.
		/// </summary>
		public UserService(
			DatabaseContext dbContext,
			IIdentityProvider identityProvider,
			IGitHubUserClient gitHubUserClient, 
			IGitHubOrganizationClient gitHubOrgClient,
			IGitHubTeamClient gitHubTeamClient,
			IEmailProvider emailProvider,
			ActivationToken activationToken)
		{
			_dbContext = dbContext;
			_identityProvider = identityProvider;
			_gitHubUserClient = gitHubUserClient;
			_gitHubOrgClient = gitHubOrgClient;
			_gitHubTeamClient = gitHubTeamClient;
			_emailProvider = emailProvider;
			_activationToken = activationToken;
		}
Пример #39
0
		private IEmailMessage CreateMessage(IEmailProvider provider)
		{
			var message = provider.CreateMessage();
			if (!string.IsNullOrEmpty(to.Text))
				message.To.Add(to.Text);
			if (!string.IsNullOrEmpty(cc.Text))
				message.Cc.Add(cc.Text);
			if (!string.IsNullOrEmpty(bcc.Text))
				message.Bcc.Add(bcc.Text);
			if (!string.IsNullOrEmpty(subject.Text))
				message.Subject = subject.Text;
			if (!string.IsNullOrEmpty(body.Text))
				message.Body = body.Text;
			if (!string.IsNullOrEmpty(files.Text))
				message.AttachmentFilePath.Add(files.Text);
			return message;
		}
Пример #40
0
 public static IEmailProvider GetEmailProvider()
 {
     Lock.EnterReadLock();
     try
     {
         {
             if (_provider == null)
             {
                 _provider = new EmailProvider();
             }
         }
     }
     finally
     {
         Lock.ExitReadLock();
     }
     return _provider;
 }
        public EmailService(IMailboxConfiguration mailboxConfiguration, 
                            IForwardService forwardService,
                            IEmailProvider emailProvider, 
                            IEmailRepository emailRepository, 
                            IReferenceGenerator referenceGenerator, 
                            IEmailServiceSettings emailServiceSettings)
        {
            Check.If(mailboxConfiguration).IsNotNull();
            Check.If(forwardService).IsNotNull();
            Check.If(emailProvider).IsNotNull();
            Check.If(emailRepository).IsNotNull();
            Check.If(referenceGenerator).IsNotNull();
            Check.If(emailServiceSettings).IsNotNull();

            _mailboxConfiguration = mailboxConfiguration;
            _forwardService = forwardService;
            _emailProvider = emailProvider;
            _emailRepository = emailRepository;
            _referenceGenerator = referenceGenerator;
            _emailServiceSettings = emailServiceSettings;
        }
        public AutoResponderService(IMailboxConfiguration mailboxConfiguration, 
                                    IEmailProvider emailProvider, 
                                    IResponseRepository responseRepository, 
                                    ITemplateRepository templateRepository, 
                                    IReferenceGenerator referenceGenerator, 
                                    IAutoResponseServiceSettings autoResponseServiceSettings)
        {
            Check.If(mailboxConfiguration).IsNotNull();
            Check.If(emailProvider).IsNotNull();
            Check.If(responseRepository).IsNotNull();
            Check.If(templateRepository).IsNotNull();
            Check.If(referenceGenerator).IsNotNull();
            Check.If(autoResponseServiceSettings).IsNotNull();

            _mailboxConfiguration = mailboxConfiguration;
            _emailProvider = emailProvider;
            _responseRepository = responseRepository;
            _templateRepository = templateRepository;
            _referenceGenerator = referenceGenerator;
            _autoResponseServiceSettings = autoResponseServiceSettings;
        }
Пример #43
0
        public DeliveryService(IEmailProvider provider, IDeliveryConfiguration config)
        {
            _provider = provider;
            _config = config;

            _outgoing = new BlockingCollection<EmailMessage>();
            _backlog = new ConcurrentQueue<EmailMessage>();
            _observer = new DeliveryObserver(this);
            _cancel = new CancellationTokenSource();

            _backlogFolder = _config.BacklogFolder ?? "backlog";
            _undeliverableFolder = config.UndeliverableFolder ?? "undeliverable";
            _serializer = new JsonSerializer<EmailMessage>();
            
            if (!Directory.Exists(_backlogFolder))
            {
                Directory.CreateDirectory(_backlogFolder);
            }
            if (!Directory.Exists(_undeliverableFolder))
            {
                Directory.CreateDirectory(_undeliverableFolder);
            }
        }
        /// <summary>
        /// Sends the help request.
        /// #6
        /// </summary>
        /// <param name="ticket">The ticket.</param>
        /// <param name="isPublicEmail">if set to <c>true</c> [is public email or if Kerb email].</param>
        /// <param name="emailProvider">The email provider.</param>
        public void SendHelpRequest(Ticket ticket, bool isPublicEmail, IEmailProvider emailProvider)
        {
            Check.Require(ticket != null, "Details are missing.");

            var supportEmail = GetHelpEmail(ticket);
            var fromEmail = "";
            if (isPublicEmail)
            {
                fromEmail = ticket.FromEmail;
            }
            else
            {
                Check.Require(ticket.User != null, "Login Details missing.");
                fromEmail = ticket.User.Email;
            }
            Check.Require(!string.IsNullOrEmpty(fromEmail), "Email details missing.");
            Check.Require(!string.IsNullOrEmpty(supportEmail), "Help Desk Email address not supplied.");

            MailMessage message = new MailMessage(fromEmail, supportEmail,
                                                   ticket.Subject,
                                                   BuildBody(ticket));

            foreach (var emailCC in ticket.EmailCCs)
            {
                if (!FilterCruEmail(emailCC))
                {
                    message.CC.Add(emailCC);
                }
            }
            foreach (var attachment in ticket.Attachments)
            {
                var messStream = new MemoryStream(attachment.Contents);
                var messAttach = new Attachment(messStream, attachment.FileName, attachment.ContentType);
                message.Attachments.Add(messAttach);
            }

            message.IsBodyHtml = false;

            emailProvider.SendEmail(message);
        }
		/// <summary>
		/// Returns a user service.
		/// </summary>
		private IUserService GetUserService(
			DatabaseContext dbContext = null,
			IIdentityProvider identityProvider = null,
			IGitHubUserClient gitHubUserClient = null,
			IGitHubOrganizationClient gitHubOrgClient = null,
			IGitHubTeamClient gitHubTeamClient = null,
			IEmailProvider emailProvider = null,
			ActivationToken activationToken = null)
		{
			return new UserService
			(
				dbContext,
				identityProvider,
				gitHubUserClient,
				gitHubOrgClient,
				gitHubTeamClient,
				emailProvider,
				activationToken
			);
		}
Пример #46
0
 public EmailService(IEmailTemplateEngine composer, IEmailProvider sender, IEmailRepository repository)
 {
     _composer = composer;
     _sender = sender;
     _repository = repository;
 }
        /// <summary>
        /// Initializes the controls.
        /// </summary>
        private void InitializeControls()
        {
            EmailProviders.Initialize();

            // Place default provider at the end
            List<IEmailProvider> providers = EmailProviders.Providers.ToList();
            m_defaultProvider = EmailProviders.Providers.First(provider => provider is DefaultProvider);
            int index = providers.IndexOf(m_defaultProvider);
            providers.RemoveAt(index);
            providers.Insert(providers.Count, m_defaultProvider);

            cbbEMailServerProvider.Items.AddRange(providers.Select(provider => provider.Name).ToArray<Object>());
            tlpEmailAuthTable.Enabled = false;

            IEmailProvider emailProvider;
            // Backwards compatibility condition
            if (String.IsNullOrEmpty(m_settings.EmailSmtpServerProvider) && EmailProviders.Providers.Any(
                provider => provider.ServerAddress == m_settings.EmailSmtpServerAddress))
            {
                emailProvider = EmailProviders.Providers.First(
                    provider => provider.ServerAddress == m_settings.EmailSmtpServerAddress);
                cbbEMailServerProvider.SelectedIndex = cbbEMailServerProvider.Items.IndexOf(emailProvider.Name);
            }
                // Backwards compatibility condition
            else if (String.IsNullOrEmpty(m_settings.EmailSmtpServerProvider))
                cbbEMailServerProvider.SelectedIndex = cbbEMailServerProvider.Items.IndexOf(m_defaultProvider.Name);
                // Regular condition
            else
            {
                emailProvider = EmailProviders.GetByKey(m_settings.EmailSmtpServerProvider);
                cbbEMailServerProvider.SelectedIndex = cbbEMailServerProvider.Items.IndexOf(emailProvider.Name);
            }
        }
Пример #48
0
 public TicketController(IEmailProvider emailProvider, ITicketControllerService ticketControllerService)
 {
     _emailProvider = emailProvider;
     _ticketControllerService = ticketControllerService;
 }
Пример #49
0
 public EmailSender(IEmailProvider provider)
 {
     _provider = provider;
 }
		/// <summary>
		/// Returns a new submission service.
		/// </summary>
		private ISubmissionService GetSubmissionService(
			DatabaseContext dbContext,
			ISubmissionCreator submissionCreator = null,
			ISubmissionDownloader submissionDownloader = null,
			ISubmissionArchiveBuilder submissionArchiveBuilder = null,
			ITimeProvider timeProvider = null,
			IEmailProvider emailProvider = null)
		{
			return new SubmissionService
			(
				new Mock<ILogger<SubmissionService>>().Object,
				dbContext,
				submissionCreator,
				submissionDownloader,
				submissionArchiveBuilder,
				timeProvider,
				emailProvider
			);
		}
Пример #51
0
		public bool Send(IEmailProvider provider)
		{
			return provider.SendMessage(this);
		}