Joanne Fitton, 39, met Andrew Scott, 39, online but she decided not to date him anymore.
A court has heard that Scott took the break up badly and bombarded the teacher with calls and text messages which she ignored.
Scott then sent a topless image of Fitton to governors at Masham Church of England Primary School in North Yorkshire questioning whether she was fit to run a religious school.
He was arrested and has now been given a restraining order.
It is believed the decision to resign was Mrs Fitton's and the school had wanted her to stay on.
A spokesperson for North Yorkshire County Council told the Mail Online: "The issue is a personal matter for the head teacher. The head teacher was a victim of harassment and a restraining order was placed on the perpetrator.
"At no time was this a safeguarding issue for the school. The head teacher has taken the decision to resign."