Star formation and environment of galaxies