A prison officer who sent an X-rated Valentine's card to a convicted sex offender has been locked up over her secret affair.