Relations between stellar mass and electron temperature-based metallicity for star-forming galaxies in a wide mass range