public object Post(TestNotification request) { var options = GetOptions(request.UserID); var mail = new MailMessage(options.EmailFrom, options.EmailTo) { Subject = "Emby: Test Notification", Body = "This is a test notification from MediaBrowser" }; var client = new SmtpClient { Host = options.Server, Port = options.Port, DeliveryMethod = SmtpDeliveryMethod.Network, UseDefaultCredentials = false }; if (options.SSL) client.EnableSsl = true; if (options.UseCredentials) { var pw = _encryption.DecryptString(options.PwData); client.Credentials = new NetworkCredential(options.Username, pw); } return client.SendMailAsync(mail); }
public void Post(TestNotification request) { var task = Notifier.Instance.SendNotification(new UserNotification { Date = DateTime.UtcNow, Description = "This is a test notification from Emby Server", Level = Model.Notifications.NotificationLevel.Normal, Name = "Emby: Test Notification", User = _userManager.GetUserById(request.UserID) }, CancellationToken.None); Task.WaitAll(task); }