public Task SendAsync(IdentityMessage message) { sysReferences = new SysReferencesService(new UnitOfWork(new AppContext())); sender = new EmailSender(); var sendOptions = new EmailSenderOptions(); int port = 0; if (int.TryParse(sysReferences.GetValueByKey(SysConstants.EmailGate_SmtpPort), out port)) { sendOptions.Port = port; } else { throw new InvalidCastException("Error parse email port!"); } sendOptions.Body = message.Body; sendOptions.Subject = message.Subject; sendOptions.From = sysReferences.GetValueByKey(SysConstants.EmailGate_Login); sendOptions.To = message.Destination; sendOptions.Host = sysReferences.GetValueByKey(SysConstants.EmailGate_SmtpServer); sendOptions.EnableSSL = true; sendOptions.IsBodyHtml = true; sendOptions.Attachment = false; sendOptions.UseDefaultCredentials = true; sendOptions.Password = sysReferences.GetValueByKey(SysConstants.EmailGate_Password); sender.Send(sendOptions); return(Task.FromResult(0)); }
public ReferencesController(ISysReferencesService _sysRefService, IReferencesService _refService, IUserProfileService userSrv) : base(userSrv) { this.sysRefService = _sysRefService; this.refService = _refService; }