Jennifer Forshaw, 28, who worked as an English teacher at HMP Wymott in Leyland, took explicit photographs of herself and had them printed to take them to her inmate lover Ian Howard.
Preston Crown Court heard her ex husband, who had found intimate messages on a mobile phone at her home, eventually shopped her to a security guard which led to her arrest.
Prison staff had already raised concerns about her "relationships" with pupils.
But the besotted mum continued the affair even after she was arrested, bailed and sacked, buying a new phone to communicate with him on, sending texts, notes and cards, and signing up to a website called "E-mail a prisoner".
The mum-of-two, who was accompanied to court by her dad, pleaded guilty to committing misconduct in a public office by entering into a romantic relationship with an inmate and conveying a SIM card into a prison.
Preston Crown Court heard Forshaw communicated with her lover by a mobile phone that she knew he should not have had inside the prison, and that the offences were committed between December 1, 2015 and June 10, 2016.
Wearing a beige cardigan the brunette, of Barnsley Street, Wigan, began to cry as defence lawyer Nicholas Ross told the court she was devastated at the prospect of being separated from her two young children.
Forshaw was employed by Manchester College, which supplies teachers to different venues, and had previously worked for six years at Hindley YOI near Wigan before joining HMP Wymott, a Category C trainer prison that houses sex offenders and other category C prisoners.
Prosecuting, Robert Dudley said: " This defendant began working at the prison in 2012 in the role of an English teacher.
" The prisoner Ian Howard was transferred to that prison on November 29, 2015, and joined her class.
"Mrs Forshaw and her husband separated in February 2016, although she later admitted the relationship began before that.
"The communications began in March 2016.
"The authorities became concerned as to Mrs Forshaw's relationships with students in general terms, and had meeting with her on April 29. Effectively they were expressing concern at the nature of her relationships particularly at a time when it was appreciated she was vulnerable due to her separation.
"They were attempting to nip any relationships in the bud and to help her move away from any relationships she may have been falling into."
Mobile phone analysis showed their communication from May 24 onwards, with a handset cell sited to Wymott. Over 18 days there were 194 text messages, 23 calls and four call forwards.
On May 30 Forshaw bought a charging cable and top up to credit Howard's phone.
Her ex confronted her on June 5 last year and she admitted the affair, the court heard, but she continued the relationship.
Her concerned husband went to the prison to make a complaint but backed out - however he later made a disclosure to a security guard he knew and on June 7 Forshaw was arrested at work at HMP Wymott.
Packaging for a SIM matching one found in Howard's cell were found in her bedroom during a search.
She made no comment in interview and was bailed at 10.30pm.
But by 11.30am the following morning she was back at Tesco buying a new mobile which she used to continue their communication.
Mr Dudley added: "This was misconduct that went on over a number of months. It continued despite the intervention of the police."
Judge Ian Leeming QC said: "You grossly breached the trust placed in you and the duties of your engagement."