I am getting a fault saying “Unable to register user due to error: Could not notify user by email” this is my code(written in kotlin).
override fun createUserAccount(@NonNull username: String,@NonNull password: String,
@NonNull email: String,@NonNull userEvents: UserEventListener.UserSignUpEventListener) {
val backendlessUser: BackendlessUser = BackendlessUser()
backendlessUser.email = email
backendlessUser.password = password
backendlessUser.setProperty(Defaults.USERNAME_PARAM, username)
Backendless.UserService.register(backendlessUser, object : AsyncCallback<BackendlessUser> {
override fun handleResponse(response: BackendlessUser) {
userEvents.onUserCreated(User.convertToLocal(backendlessUser))
}
override fun handleFault(fault: BackendlessFault) {
userEvents.onError(fault)
}
})
}
override fun loginUser(@NonNull username: String,@NonNull password: String,
@NonNull userEvents: UserEventListener.UserSignInEventListener) {
Backendless.UserService.login(username, password, object : AsyncCallback<BackendlessUser> {
override fun handleResponse(response: BackendlessUser?) {
userEvents.onUserLoggedin(User.convertToLocal(response))
}
override fun handleFault(fault: BackendlessFault) {
userEvents.onError(fault)
}
})
}
companion object Converter {
internal fun convertToLocal(remoteUser: BackendlessUser?): User {
val user: User = User()
user.objectId = remoteUser?.objectId
user.created = remoteUser?.getProperty(Defaults.CREATED_PARAM) as Date
user.updated = remoteUser.getProperty(Defaults.UPDATED_PARAM) as Date
user.email = remoteUser.email
user.name = remoteUser.getProperty(Defaults.USERNAME_PARAM) as String
user.password = remoteUser.password
user.avatartUrl = remoteUser.getProperty(Defaults.URL_PARAM) as String
user.followers = remoteUser.getProperty(Defaults.FOLLOWERS_PARAM) as List<BackendlessUser>
return user
}
internal fun convertToRemote(localUser: User?): BackendlessUser {
val user: BackendlessUser = BackendlessUser()
user.setProperty(Defaults.OBJECTID_PARAM, localUser?.objectId)
user.setProperty(Defaults.CREATED_PARAM, localUser?.created)
user.setProperty(Defaults.UPDATED_PARAM, localUser?.updated)
user.email = localUser?.email
user.setProperty(Defaults.USERNAME_PARAM, localUser?.name)
user.password = localUser?.password
user.setProperty(Defaults.URL_PARAM, localUser?.avatartUrl)
user.setProperty(Defaults.FOLLOWERS_PARAM, localUser?.followers)
return user
}
}