private static void SendEmail(User user) { string serviceName = RoleEnvironment.GetConfigurationSettingValue("ServiceName"); var fromAddress = new MailAddress( RoleEnvironment.GetConfigurationSettingValue("ServiceGmailAddress") + "@gmail.com", serviceName ); var toAddress = new MailAddress(user.Email, user.Name); string fromPassword = RoleEnvironment.GetConfigurationSettingValue("ServiceGmailPassword"); string subject = string.Format("[LetMeLogThatForYou] IMPORTANT: Coinbase Account Balance Critically Low!!"); string body = string.Format( "<p>The Coinbase User Account {0} current balance is: {1}</p>" + "<p>This is below the minimum balance {2} requried by the application.</p>", user, user.Balance, MINIMUM_TOTAL_BALANCE_AMOUNT ); var smtp = new SmtpClient { Host = "smtp.gmail.com", Port = 587, EnableSsl = true, DeliveryMethod = SmtpDeliveryMethod.Network, Credentials = new NetworkCredential(fromAddress.Address, fromPassword), Timeout = 20000 }; using (var message = new MailMessage(fromAddress, toAddress) { Subject = subject, Body = body, IsBodyHtml = true } ) { smtp.Send(message); } }
public static User CreateUser(User user) { UserResponse userResponse = (UserResponse)PostResource( "users", user, typeof(User), typeof(UserResponse) ); return userResponse.User; }
public static User UpdateUser( User user, APIKey apiKey ) { User updatedUser = new User() { Email = user.Email, Name = user.Name, NativeCurrency = user.NativeCurrency, TimeZone = user.TimeZone }; UserResponse userResponse = (UserResponse)PutResource( "users", user.ID, updatedUser, typeof(User), typeof(UserResponse), apiKey ); return userResponse.User; }
public static User CreateUser(string email, string password) { User user = new User() { Email = email, Password = password }; return CreateUser(user); }