A Sydney Grammar School teacher who admitted to having sex with a student was warned several times about her inappropriate behaviour with students.

The woman was warned as early as September 2013 to reign in her behaviour and “not in any communication with boys of the school, written or spoken, or electronic, make sexual references” with the students, according to court documents filed on Tuesday.

A month later, she met with the school over a complaint made about her behaviour, and again at the end of 2014 was told to adopt a more professional approach for her “overly close pastoral role with a male student with a mental health problem”.

In 2015, the woman, who cannot be identified for legal reasons, became involved with the 17-year-old student.

The former teacher, 33, has pleaded guilty in Downing Centre Local Court to having sex with the boy on a number of occasions, including during class hours, last year.

Court documents reveal the woman wrote in his school report he was “a delight” to teach.

“If all boys had his sense of humour and level of engagement with the world around them, then teachers would skip to school,” she said.

The teacher disclosed personal details about her marriage, her endometriosis diagnosis, her lack of children and her depression.

She also gifted the boy with poems and letters which centred on themes of love, intimacy, death and suicide.

By the end of 2015, the boy was experiencing a decline in his mental health to the point where he attempted suicide in the school bathrooms.

His parents were notified three days later.

In January 2016, the boy was invited to the woman’s Sydney home where she cooked him lunch and gave him three beers. The pair kissed despite the young boy repeatedly telling her: “I can’t, I can’t”.

They continued to communicate via text message and in the following months, they engaged in planned meet-ups to engage in sexual intercourse during class time and outside school hours.

Court documents state the boy was “scared to end contact with the offender because he knew the offender was depressed and was worried she would self-harm”.

He attempted to break off communication in April last year by telling her his phone credit use was too high. The woman suggested they begin emailing, and set him up with a new email address.

When their interactions became too much, the boy told several of his school friends “because he needed to tell someone” and “wanted it to stop”.

The woman’s house was searched and she was arrested on October 24 last year.