/// <summary> /// Ensure that an email is set if the user wants notifications. /// </summary> /// <param name="email"></param> /// <param name="session"></param> /// <exception cref="ValidationException"></exception> public static void SetNotificationEmail(bool notify, string email, SessionWrapper session, SiteConfiguration config, IUsersService service) { if (notify && config.Notifications.Subscription.IsDefined) { if (session.User.Email == null) { service.AddEmail(session.User.Id, email, EmailPolicy.SendFromSubscriptions); session.User.Email = email; } } }