Пример #1
0
		public DefaultEmailingProcessor(
			IMailSender sender,
			IMessageBuilder messageBuilder)
		{
			_sender = sender;
			_messageBuilder = messageBuilder;
		}
Пример #2
0
        /// <summary>
        /// Initializes MailerBase using the default SmtpMailSender and system Encoding.
        /// </summary>
        /// <param name="mailSender">The underlying mail sender to use for delivering mail.</param>
        /// <param name="defaultMessageEncoding">The default encoding to use when generating a mail message.</param>
        protected MailerBase(IMailSender mailSender = null, Encoding defaultMessageEncoding = null)
        {
            From = null;
            Subject = null;
            To = new List<string>();
            CC = new List<string>();
            BCC = new List<string>();
            ReplyTo = new List<string>();
            Headers = new Dictionary<string, string>();
            Attachments = new AttachmentCollection();
            MailSender = mailSender ?? new SmtpMailSender();
            MessageEncoding = defaultMessageEncoding ?? Encoding.UTF8;

            if (System.Web.HttpContext.Current != null)
            {
                HttpContextBase = new HttpContextWrapper(System.Web.HttpContext.Current);
                var routeData = RouteTable.Routes.GetRouteData(HttpContextBase) ?? new RouteData();
                var requestContext = new RequestContext(HttpContextBase, routeData);
                base.Initialize(requestContext);
            }
            else
            {
                //Проверить!!!!!
                HttpContextBase = new HttpContextWrapper(new HttpContext(
            new HttpRequest(null, "http://tempuri.org", null),
            new HttpResponse(null)));
                var routeData = RouteTable.Routes.GetRouteData(HttpContextBase) ?? new RouteData();
                var requestContext = new RequestContext(HttpContextBase, routeData);
                base.Initialize(requestContext);

            }
        }
Пример #3
0
        public TemplateModule(ITemplateBuilder builder, IMailSender sender)
            : base("/templates")
        {
            this.builder = builder;

            Get["/"] = parameters => {
                return View["templates", new {
                    Templates = builder.Templates
                        .OrderBy(t => t.Path)
                }];
            };
            //			Get["/{Name}"] = parameters => {
            //			    return Response.AsJson(new {parameters.Name});
            //			};
            Post["/{Name}/deliver"] = parameters => {
                var model = this.Bind<TemplateModel>();
                sender.Send(GetMailbag((string)parameters.Name, model));
                return HttpStatusCode.OK;
            };
            Post["/{Name}/mailbag"] = parameters => {
                var model = this.Bind<TemplateModel>();
                return Response.AsJson(GetMailbag((string)parameters.Name, model));
            };
            Post["/{Name}/display"] = parameters => {
                var model = this.Bind<TemplateModel>();
                return Template[parameters.Name, model];
            };
        }
Пример #4
0
        public static void NotifyRoom(IRoom room, IPost post, IMailSender mailSender)
        {
            var context = GlobalHost.ConnectionManager.GetHubContext<RoomHub>();

            context.Clients.Group(String.Concat("room-", post.RoomId))
                .post(post.Id, post.Type, post.AuthorAlias, post.AvatarUrl, post.Text, post.Timestamp.ToString("MMM dd yy @ hh:mm tt"));

            IEnumerable<string> emailAddresses;
            if (post.AuthorId == room.OwnerId)
                emailAddresses = room.Players.Select(x => x.MemberEmailAddress);
            else
                emailAddresses =
                    room.Players
                        .Where(x => x.MemberId != post.AuthorId)
                        .Select(x => x.MemberEmailAddress)
                        .Concat(new[] { room.OwnerEmailAddress });

            var subject = String.Concat("[", room.Slug, "] ", "New Post");
            const string bodyFormat = @"There's a new post to {0}:

            {1}

            Visit the room at {2}.";
            var body = String.Format(CultureInfo.CurrentUICulture, bodyFormat, room.Title, post.Text, MakeAbsoluteUri(Paths.Room(room.Slug)));

            emailAddresses.ForEach(x => SendMail(x, subject, body));
        }
Пример #5
0
		public CourseSourceFailPolicy(ICourseSource courseSource, IMailSender sender, string fromEmail, string supportEmail)
		{
			_supportEmail = supportEmail;
			_fromEmail = fromEmail;
			_courseSource = courseSource;
			_sender = sender;
		}
Пример #6
0
 public ConfigService(IKeyValueStore keyValueStore, IMailSender mailSender)
 {
     if (keyValueStore == null) throw new ArgumentNullException("keyValueStore");
     if (mailSender == null) throw new ArgumentNullException("mailSender");
     _keyValueStore = keyValueStore;
     _mailSender = mailSender;
 }
Пример #7
0
 public MessageService(IMailSender mailSender, IAppConfiguration config, AuthenticationService authService)
     : this()
 {
     MailSender = mailSender;
     Config = config;
     AuthService = authService;
 }
Пример #8
0
 public MailBuilder([NotNull] IMailSender mailSender,
                    [NotNull] IMailMessageFactory mailMessageFactory)
 {
     if (mailSender == null) throw new ArgumentNullException(nameof(mailSender));
     if (mailMessageFactory == null) throw new ArgumentNullException(nameof(mailMessageFactory));
     _mailSender = mailSender;
     _message = mailMessageFactory.Create();
 }
Пример #9
0
 public static void SendMail(
     IMailSender mailSender,
     string emailAddress,
     string subject,
     string markdownBody)
 {
     mailSender.Send("*****@*****.**", emailAddress, subject, markdownBody);
 }
Пример #10
0
 public AccountController(UserManager <User> userManager,
                          SignInManager <User> signInManager,
                          IMailSender mailSender)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _mailSender    = mailSender;
     _userMapper    = new UserMapper();
 }
Пример #11
0
 public AlertsEventProcessor(
     IMailSender mailSender,
     IReadModelRepositoryFor <DataOwner> dataOwnersRepository,
     IReadModelRepositoryFor <Case> casesRepository)
 {
     this._mailSender           = mailSender;
     this._dataOwnersRepository = dataOwnersRepository;
     this._casesRepository      = casesRepository;
 }
Пример #12
0
 public RunAutoqueriesJob(ISession session, IDatabase database, ILog log, IParametersResolver paramResolver, IMailSender mailSender, AutoProceduresJob proceduresJob)
 {
     m_session       = session;
     m_database      = database;
     m_log           = log;
     m_paramResolver = paramResolver;
     m_mailSender    = mailSender;
     m_proceduresJob = proceduresJob;
 }
Пример #13
0
        public CredentialService(ICredentialStore store, IMailSender mailSender,
			IContentTypeManager contentTypeManager,
			IPersister persister)
        {
            _store = store;
            _mailSender = mailSender;
            _contentTypeManager = contentTypeManager;
            _persister = persister;
        }
Пример #14
0
 public HomeController(IMailDemonDatabaseProvider dbProvider, IMailCreator mailCreator, IMailSender mailSender,
                       IBulkMailSender bulkMailSender, IAuthority authority)
 {
     this.dbProvider     = dbProvider;
     this.mailCreator    = mailCreator ?? throw new ArgumentNullException(nameof(mailCreator));
     this.mailSender     = mailSender ?? throw new ArgumentNullException(nameof(mailSender));
     this.bulkMailSender = bulkMailSender;
     this.authority      = authority;
 }
Пример #15
0
        public MailSheduler(MailConfiguration conf)
        {
            _messages   = new Queue <Message>();
            _mailSender = new MailSender(conf);

            _timer          = new Timer(30000);
            _timer.Elapsed += TimerElapsed;
            _timer.Start();
        }
Пример #16
0
        public ActionResult BounceEmail([FromServices] IMailSender mailSender, string email)
        {
            var msg = mailSender.AddRecipient(email);

            return(Ok(new
            {
                msg
            }));
        }
Пример #17
0
 public AbstractQueuedMailSender(QueueSenderConfiguration configuration, IMailSender realSender)
 {
     this.realSender = realSender;
     // defensive copy
     this.enabled     = configuration.Enabled;
     this.queueRate   = configuration.QueueRate;
     this.messageRate = configuration.MessageRate;
     this.maxRetries  = configuration.MaxRetries;
 }
Пример #18
0
        public EmployeePresenter(IEmployeeView view, IDataProvider provider, IMailSender mailSender)
            : base(view)
        {
            this.provider   = provider;
            this.mailSender = mailSender;

            this.View.MyInit   += this.View_Init;
            this.View.MailSend += this.View_MailSend;
        }
Пример #19
0
 public AccountsController(SignInManager <User> signInManager,
                           UserManager <User> userManager,
                           IConfiguration configuration, IMailSender mailSender)
 {
     this._signInManager = signInManager;
     this._userManager   = userManager;
     this._configuration = configuration;
     _mailSender         = mailSender;
 }
 public MarkdownMessageService(
     IMailSender mailSender,
     IAppConfiguration config,
     ITelemetryService telemetryService)
     : base(mailSender, config)
 {
     _telemetryService = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService));
     _smtpUri          = config.SmtpUri?.Host;
 }
Пример #21
0
        public AccountController(IYouConfDbContext youConfDbContext, IMailSender mailSender)
        {
            if (youConfDbContext == null)
            {
                throw new ArgumentNullException("youConfDbContext");
            }

            YouConfDbContext = youConfDbContext;
        }
Пример #22
0
 public UserManagementFacade(ISession session, IUserRepository userRepository, IMailSender mailSender, IDatabase database, ILog log, ICache cache)
 {
     m_session        = session;
     m_userRepository = userRepository;
     m_mailSender     = mailSender;
     m_database       = database;
     m_log            = log;
     m_cache          = cache;
 }
Пример #23
0
 public AccountsUseCase(
     IMailSender mailSender,
     IAuthorizationLinkRepository authorizationLinkRepository,
     ITeamRepository teamRepository)
 {
     this.mailSender = mailSender;
     this.authorizationLinkRepository = authorizationLinkRepository;
     this.teamRepository = teamRepository;
 }
Пример #24
0
        public PollingService(IOptions <CloudFtpBridgeOptions> optionsAccessor, IFileManager fileManager, IMailSender mailSender, IWorkflowRepository workflowRepository)
        {
            _log = NullLogger.Instance;

            FileManager        = fileManager;
            MailSender         = mailSender;
            Options            = optionsAccessor.Value;
            WorkflowRepository = workflowRepository;
        }
Пример #25
0
 public void PrepareTest()
 {
     _userRepository       = MockRepository.GenerateStub <IUserRepository>();
     _mailSender           = MockRepository.GenerateStub <IMailSender>();
     _log                  = MockRepository.GenerateStub <ILog>();
     _passwordGenerator    = MockRepository.GenerateStub <IPasswordGenerator>();
     _passwordCryptography = MockRepository.GenerateStub <IPasswordCryptography>();
     _userManager          = new UserManager(_userRepository, _mailSender, _log, _passwordCryptography, _passwordGenerator);
 }
Пример #26
0
        public AccountController(IYouConfDbContext youConfDbContext, IMailSender mailSender)
        {
            if (youConfDbContext == null)
            {
                throw new ArgumentNullException("youConfDbContext");
            }

            YouConfDbContext = youConfDbContext;
        }
Пример #27
0
        public AuthenticationService(IContext context, IMailSender sender)
        {
            _context             = context;
            _notificationService = new NotificationService(_context, sender);
            _crypt = new SymmetricCrypt(SymmetricCryptProvider.TripleDES);
            var parameterRepository = new ParameterRepository(_context);

            _crypt.Key = parameterRepository.GetValueByKey(Parameter.CRYPTO_KEY);
        }
Пример #28
0
        public HomeController(IJournalRepository journalRepository, IMailSender mailSender, ContactSettings contactSettings, IUserProfileRepository userProfileRepository, IAuthentication authentication)
            : base(userProfileRepository, authentication)
        {
            Requires.NotNull(mailSender, "mailSender");
            Requires.NotNull(contactSettings, "contactSettings");

            this.journalRepository = journalRepository;
            this.mailSender        = mailSender;
            this.contactSettings   = contactSettings;
        }
Пример #29
0
 public CrudOnUsers(ICrudOnProducts crudOnProducts, IMailSender mailSender, ICrudOnFriends crudOnFriends, ICrudOnAlerts crudOnAlerts, DonkeySellContext context)
 {
     this.context        = context;
     userManager         = new UserManager <DonkeySellUser>(new UserStore <DonkeySellUser>(context));
     roleManager         = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(context));
     this.crudOnProducts = crudOnProducts;
     this.mailSender     = mailSender;
     this.crudOnFriends  = crudOnFriends;
     this.crudOnAlerts   = crudOnAlerts;
 }
 public PenningController(IMcEditieRepository editieRepository,
                          IVerenigingRepository verenigingRepository,
                          IKonventRepository konventRepository,
                          IMailSender mailSender)
 {
     _editieRepository     = editieRepository;
     _verenigingRepository = verenigingRepository;
     _konventRepository    = konventRepository;
     _mailSender           = mailSender;
 }
Пример #31
0
        public HomeController(IJournalRepository journalRepository, IMailSender mailSender, ContactSettings contactSettings, IUserProfileRepository userProfileRepository, IAuthentication authentication)
            : base(userProfileRepository, authentication)
        {
            Requires.NotNull(mailSender, "mailSender");
            Requires.NotNull(contactSettings, "contactSettings");

            this.journalRepository = journalRepository;
            this.mailSender = mailSender;
            this.contactSettings = contactSettings;
        }
 public AttorneyController(IDepartmentRepository departmentsRepo, IAttorneyRepository attorneysRepo, IUserRepository usersRepo,
                           IGuidManager guidManager, ICryptoManager cryptoManager, IMailSender sender)
 {
     this._departmentsRepo = departmentsRepo;
     this._attorneysRepo   = attorneysRepo;
     this._usersRepo       = usersRepo;
     this._guidManager     = guidManager;
     this._cryptoManager   = cryptoManager;
     this._mailSender      = sender;
 }
 public EditieController(IMcEditieRepository editieRepository,
                         IVerenigingRepository verenigingRepo,
                         IConfiguration config,
                         IMailSender mailSender)
 {
     _editieRepository     = editieRepository;
     _verenigingRepository = verenigingRepo;
     _config     = config;
     _mailSender = mailSender;
 }
Пример #34
0
 public UserService(IGenericRepository <User> userRepository, IPasswordHelper passwordHelper, IMailSender mailSender, IViewRenderService renderView, IWebHostEnvironment webHostEnviroment, IGenericRepository <UserRole> userRoleRepository, IGenericRepository <Role> roleRepository)
 {
     this.userRepository     = userRepository;
     this.passwordHelper     = passwordHelper;
     this.mailSender         = mailSender;
     this.renderView         = renderView;
     this.webHostEnviroment  = webHostEnviroment;
     this.userRoleRepository = userRoleRepository;
     this.roleRepository     = roleRepository;
 }
Пример #35
0
 public UsersController(ILogger logger, ICrudOnUsers crudOnUsers, IAuthorization authorization, ICrudOnMessages crudOnMessages, IMyPasswordGenerator myPasswordGenerator, IMailSender mailSender, IThrowExceptionToUser throwExceptionToUser)
 {
     this.crudOnUsers          = crudOnUsers;
     this.logger               = logger;
     this.crudOnMessages       = crudOnMessages;
     this.authorization        = authorization;
     this.mailSender           = mailSender;
     this.myPasswordGenerator  = myPasswordGenerator;
     this.throwExceptionToUser = throwExceptionToUser;
 }
Пример #36
0
 public PackageController(IAttorneyRepository attorneysRepo,
                          IPackageRepository packagesRepo,
                          IMailSender mailSender,
                          INotificationRepository notificationRepo)
 {
     _attorneysRepo          = attorneysRepo;
     _packagesRepo           = packagesRepo;
     _mailSender             = mailSender;
     _notificationRepository = notificationRepo;
 }
 public ReportService(IMailSender mailSender, IGenericRepository <OrgUnit> orgUnitRepository,
                      IGenericRepository <Employment> employmentRepository, IGenericRepository <Substitute> substituteRepository, ILogger <ReportService <T> > logger, IGenericRepository <T> reportRepo)
 {
     _orgUnitRepository    = orgUnitRepository;
     _employmentRepository = employmentRepository;
     _substituteRepository = substituteRepository;
     _mailSender           = mailSender;
     _logger     = logger;
     _reportRepo = reportRepo;
 }
Пример #38
0
 public UserService(IUserRepository userRepository, IUserRoleRepository userRoleRepository, IUserRolePermissionRepository userRolePermissionRepository, IPasswordHelper passwordHelper, IMailSender mailSender, IViewRenderService renderView, IUserPermissionRepository userPermissionRepository)
 {
     _userRepository               = userRepository;
     _userRoleRepository           = userRoleRepository;
     _userRolePermissionRepository = userRolePermissionRepository;
     _passwordHelper               = passwordHelper;
     _mailSender = mailSender;
     _renderView = renderView;
     _userPermissionRepository = userPermissionRepository;
 }
Пример #39
0
        public MailSenderManager(
            IMailSender sender,
            IConfig config
            )
        {
            _sender = sender;
            _config = config;

            _origin = _config.Get(MAIL_SENDER_KEY);
        }
 public InvitationController(IInvitationRepository invitationRepository,
                             IMailSender mailSender,
                             IAdministratorRepository adminRepository,
                             IConfiguration config)
 {
     _invitationRepository    = invitationRepository;
     _mailSender              = mailSender;
     _configuration           = config;
     _administratorRepository = adminRepository;
 }
Пример #41
0
 public EFUserRepository(ApplicationDbContext ctx,
                         IGuidManager guidManager,
                         ICryptoManager cryptoManager,
                         IMailSender mailSender)
 {
     this.context   = ctx;
     _guidManager   = guidManager;
     _cryptoManager = cryptoManager;
     _mailSender    = mailSender;
 }
Пример #42
0
        public CheckAudioExistsJob(IEntryRepository entryRepository, IOptions <StorageSettings> storageSettings,
                                   IOptions <AudioFileStorageSettings> audioStorageSettings, ILoggerFactory logger, IMailSender mailSender)
        {
            _mailSender           = mailSender;
            _storageSettings      = storageSettings.Value;
            _audioStorageSettings = audioStorageSettings.Value;
            _entryRepository      = entryRepository;

            _logger = logger.CreateLogger <CheckAudioExistsJob>();
        }
Пример #43
0
		public MailSenderJob(
			IEmailMessageRepository messages,
			int partitionId,
			IMailSender sender,
			ISerializer serializer)
		{
			_messages = messages;
			_partitionId = partitionId;
			_sender = sender;
			_serializer = serializer;
		}
Пример #44
0
        /// <summary>
        ///     Creates a new delivery helper to be used for sending messages.
        /// </summary>
        /// <param name="sender">The sender to use when delivering mail.</param>
        /// <param name="interceptor">The interceptor to report with while delivering mail.</param>
        public DeliveryHelper(IMailSender sender, IMailInterceptor interceptor)
        {
            if (interceptor == null)
                throw new ArgumentNullException("interceptor");

            if (sender == null)
                throw new ArgumentNullException("sender");

            _sender = sender;
            _interceptor = interceptor;
        }
Пример #45
0
        /// <summary>
        ///     Initializes MailerBase using the defaultMailSender and system Encoding.
        /// </summary>
        /// <param name="mailAttributes"> the mail attributes</param>
        /// <param name="mailSender">The underlying mail sender to use for delivering mail.</param>
        protected MailerBase(MailAttributes mailAttributes = null, IMailSender mailSender = null)
        {
            MailAttributes = mailAttributes ?? new MailAttributes();
            MailSender = mailSender ?? new SmtpMailSender();

            if (System.Web.HttpContext.Current == null) return;
            HttpContextBase = new HttpContextWrapper(System.Web.HttpContext.Current);
            RouteData routeData = RouteTable.Routes.GetRouteData(HttpContextBase) ?? new RouteData();
            var requestContext = new RequestContext(HttpContextBase, routeData);
            base.Initialize(requestContext);
        }
Пример #46
0
 protected Basket(IDbOrderHistoryRepository dbOrderHistoryRepository, IMailSender mailSender,
     IUserGroup userGroup, ILangSetter langSetter, ICurrencyCultureService<HttpCookieCollection> currencyCultureService,
     IGridViewBasketManager<HttpSessionState> gridViewBasketManager)
 {
     _dbOrderHistoryRepository = dbOrderHistoryRepository;
     _mailSender = mailSender;
     _userGroup = userGroup;
     _langSetter = langSetter;
     _currencyCultureService = currencyCultureService;
     _gridViewBasketManager = gridViewBasketManager;
 }
Пример #47
0
 public ErrorHandler(IWebContext context, ISecurityManager security, InstallationManager installer,
     EngineSection config, EditSection editConfig)
     : this(context, security, installer)
 {
     this.editConfig = editConfig;
     action = config.Errors.Action;
     mailTo = config.Errors.MailTo;
     mailFrom = config.Errors.MailFrom;
     maxErrorReportsPerHour = config.Errors.MaxErrorReportsPerHour;
     handleWrongClassException = config.Errors.HandleWrongClassException;
     mailSender = new SmtpMailSender();
 }
Пример #48
0
        public MailerNotifier(ILogger<MailerNotifier> logger,
            IKeyValueStore keyValueStore,
            IMailSender mailSender)
        {
            if (logger == null) throw new ArgumentNullException("logger");
            if (keyValueStore == null) throw new ArgumentNullException("keyValueStore");
            if (mailSender == null) throw new ArgumentNullException("mailSender");

            _logger = logger;
            _keyValueStore = keyValueStore;
            _mailSender = mailSender;
        }
            internal MailSenderQueueParams(IMailSender MailSender, string To, string Subject, string Body, string Attach, bool AttachAutoRemove)
            {
                this.to = To;

                this.subject = Subject;

                this.body = Body;

                this.attachment = Attach;

                this.attachmentAutoRemove = AttachAutoRemove;

                this.mailSender = MailSender;
            }
Пример #50
0
        public ExpirationChecker(IBaseScoreCardRepository baseScoreCardRepository, IValuationScoreCardRepository valuationScoreCardRepository, ExpirationCheckerNotification expirationCheckerNotification, ExpirationCheckerSettings expirationCheckerSettings, IMailSender mailSender)
        {
            Requires.NotNull(baseScoreCardRepository, "baseScoreCardRepository");
            Requires.NotNull(valuationScoreCardRepository, "valuationScoreCardRepository");
            Requires.NotNull(expirationCheckerNotification, "expirationCheckerNotification");
            Requires.NotNull(expirationCheckerSettings, "expirationCheckerSettings");
            Requires.NotNull(mailSender, "mailSender");

            this.baseScoreCardRepository = baseScoreCardRepository;
            this.valuationScoreCardRepository = valuationScoreCardRepository;
            this.expirationCheckerNotification = expirationCheckerNotification;
            this.expirationCheckerSettings = expirationCheckerSettings;
            this.mailSender = mailSender;
        }
Пример #51
0
 public void FileMailSent(Mail mail, Exception error, IMailSender sender)
 {
     if (error != null)
     {
         var del = MailSendingError;
         if (del != null)
             del(mail, error, sender);
     }
     else
     {
         var del = MailSent;
         if (del != null)
             del(mail, sender);
     }
 }
Пример #52
0
 public MailWrapper(XmlNode section, MailSendType type)
 {
     m_MailSendType = type;
     m_Mail = Create(type);
     int tmp;
     m_Config = m_Mail.AnalyseConfig(section, out tmp);
     m_RecoverSeconds = tmp;
     m_ErrorTimeList = new DateTime[m_Config.Count];
     m_ErrorInfoList = new string[m_Config.Count];
     for (int i = 0; i < m_Config.Count; i++)
     {
         m_ErrorTimeList[i] = DateTime.MinValue;
     }
     m_StartIndex = 0;
 }
Пример #53
0
		public BillManager(
			IApplicationRepository applications,
			ISettingRepository settings,
			IBillRepository bills,
			IBillPdf pdf,
			IAdminRepository admins,
			IMailSender mail)
		{
			_applications = applications;
			_settings = settings;
			_bills = bills;
			_pdf = pdf;
			_admins = admins;
			_mail = mail;
		}
Пример #54
0
 /// <summary>
 /// Initializes MailerBase using the default SmtpMailSender and system Encoding.
 /// </summary>
 /// <param name="mailSender">The underlying mail sender to use for delivering mail.</param>
 /// <param name="defaultMessageEncoding">The default encoding to use when generating a mail message.</param>
 protected MailerBase(IMailSender mailSender = null, Encoding defaultMessageEncoding = null)
 {
     From = null;
     Subject = null;
     To = new List<string>();
     CC = new List<string>();
     BCC = new List<string>();
     ReplyTo = new List<string>();
     Headers = new Dictionary<string, string>();
     Attachments = new AttachmentCollection();
     MailSender = mailSender ?? new SmtpMailSender();
     MessageEncoding = defaultMessageEncoding ?? Encoding.UTF8;
     if (System.Web.HttpContext.Current != null)
         HttpContextBase = new HttpContextWrapper(System.Web.HttpContext.Current);
 }
Пример #55
0
        public ErrorHandler(IErrorNotifier notifier, IWebContext context, InstallationManager installer, IMailSender mailSender, 
            ConfigurationManagerWrapper configuration)
        {
            this.notifier = notifier;
            this.context = context;
            this.installer = installer;
            this.mailSender = mailSender;

            beginUrl = configuration.Sections.Management.Installer.WelcomeUrl;
            action = configuration.Sections.Engine.Errors.Action;
            mailTo = configuration.Sections.Engine.Errors.MailTo;
            mailFrom = configuration.Sections.Engine.Errors.MailFrom;
            maxErrorReportsPerHour = configuration.Sections.Engine.Errors.MaxErrorReportsPerHour;
            handleWrongClassException = configuration.Sections.Engine.Errors.HandleWrongClassException;
            mailSender = new SmtpMailSender();
        }
Пример #56
0
		public ErrorHandler(IErrorNotifier notifier, IWebContext context, InstallationManager installer, IExceptionFilter exceptionFilter, IMailSender mailSender, 
			ConfigurationManagerWrapper configuration)
		{
			this.notifier = notifier;
			this.context = context;
			this.installer = installer;
			this.exceptionFilter = exceptionFilter;
			this.mailSender = mailSender;

			beginUrl = configuration.Sections.Management.Installer.WelcomeUrl;
			action = configuration.Sections.Engine.Errors.Action;
			mailTo = configuration.Sections.Engine.Errors.MailTo;
			mailFrom = configuration.Sections.Engine.Errors.MailFrom;
			maxErrorReportsPerHour = configuration.Sections.Engine.Errors.MaxErrorReportsPerHour;
			handleWrongClassException = configuration.Sections.Engine.Errors.HandleWrongClassException;
			handleSqlException = configuration.Sections.Engine.Errors.SqlExceptionHandling == ExceptionResolutionMode.RefreshGet;
		}
Пример #57
0
        public HomeController(
            IBaseScoreCardRepository baseScoreCardRepository, 
            IValuationScoreCardRepository valuationScoreCardRepository, 
            IJournalRepository journalRepository, IMailSender mailSender, 
            ContactSettings contactSettings, 
            IUserProfileRepository userProfileRepository, 
            IAuthentication authentication)
            : base(baseScoreCardRepository, valuationScoreCardRepository, userProfileRepository, authentication)
        {
            Requires.NotNull(journalRepository, nameof(journalRepository));
            Requires.NotNull(mailSender, nameof(mailSender));
            Requires.NotNull(contactSettings, nameof(contactSettings));

            this.journalRepository = journalRepository;
            this.mailSender = mailSender;
            this.contactSettings = contactSettings;
        }
Пример #58
0
        public IMailSender GetMailSenderInstance()
        {
            switch (_mailSendingType)
            {
                case MailSendingType.Mandrill:
                    objMailSender = new MailSenderMandrill();
                    break;
                case MailSendingType.Sendgrid:
                    objMailSender = new MailSenderSendgrid();
                    break;
                case MailSendingType.Gmail:
                    objMailSender = new MailSenderGmail();
                    break;
                default:
                    break;
            }

            return objMailSender;
        }
Пример #59
0
        public static IPost CreatePost(
            this IDocumentSession documentSession,
            IMailSender mailSender,
            int roomId,
            int senderId,
            string avatarUrl,
            string source,
            string type,
            string text)
        {
            documentSession.Ensure("documentSession");
            roomId.Ensure("roomId");
            senderId.Ensure("senderId");
            type.Ensure("type");
            text.Ensure("text");

            var sender = GetMemberById(documentSession, senderId);
            if (sender == null)
                throw new InvalidOperationException(Strings.NoEntityForId("member", senderId));

            var room = GetRoomById(documentSession, roomId);
            if (room == null)
                throw new InvalidOperationException(Strings.NoEntityForId("room", roomId));

            var post = new Post
            {
                AvatarUrl = avatarUrl,
                RoomId = room.Id,
                AuthorAlias = sender.Alias,
                AuthorId = sender.Id,
                Source = source,
                Text = text,
                Timestamp = DateTimeOffset.UtcNow,
                Type = type
            };

            documentSession.Store(post);
            documentSession.SaveChanges();

            NotifyRoom(room, post, mailSender);

            return post;
        }
Пример #60
0
        /// <summary>
        /// Creates a new EmailResult.  You must call ExecuteCore() before this result
        /// can be successfully delivered.
        /// </summary>
        /// <param name="interceptor">The IMailInterceptor that we will call when delivering mail.</param>
        /// <param name="sender">The IMailSender that we will use to send mail.</param>
        /// <param name="mail">The mail message who's body needs populating.</param>
        /// <param name="viewName">The view to use when rendering the message body (can be null)</param>
        /// <param name="masterName">The maste rpage to use when rendering the message body (can be null)</param>
        /// <param name="messageEncoding">The encoding to use when rendering a message.</param>
        /// <param name="trimBody">Whether or not we should trim whitespace from the beginning and end of the message body.</param>
        public EmailResult(IMailInterceptor interceptor, IMailSender sender, MailMessage mail, string viewName, string masterName, Encoding messageEncoding, bool trimBody)
        {
            if (interceptor == null)
                throw new ArgumentNullException("interceptor");

            if (sender == null)
                throw new ArgumentNullException("sender");

            if (mail == null)
                throw new ArgumentNullException("mail");

            ViewName = viewName ?? ViewName;
            MasterName = masterName ?? MasterName;
            MessageEncoding = messageEncoding;
            Mail = mail;
            MailSender = sender;
            _interceptor = interceptor;
            _deliveryHelper = new DeliveryHelper(sender, interceptor);
            _trimBody = trimBody;
        }