Dear Mr./Ms. Chairperson,
It is with great shame and disgust that I must offer my resignation as (position/political role).
When I was (hired/elected), my No. 1 goal was to serve (customers/constituents) with honor. I have failed in that duty. When I (legal/moral/ethical violation), I violated not only the trust of my respected colleagues and (customers/constituents); I violated my own moral code.
It is my fervent hope that this (body/company) can move on to pressing matters without the distraction and embarrassment of my personal and professional misdeeds. I am deeply sorry for my transgressions and all the fallout that has affected those around me.