A former Perth school teacher who had sex with a 14-year-old boy is otherwise of "impeccable character" and not a predator, a judge says.

The 37-year-old woman, who cannot be named for legal reasons, pleaded guilty in June last year to three counts of engaging in sexual behaviour with the teenager.

She cried in the dock on Thursday as she was given a 21-month prison sentence, suspended for two years.

The District Court of Western Australia heard that the woman became fond of the boy, whom she taught, in 2009 and exchanged phone numbers and email addresses with him.

Their exchanges were at first unremarkable but became more personal and sexual.