예제 #1
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, "*****@*****.**");
        }