For retirees, a lot depends on the person, his/her rank, his/her feelings about time spent in the service, and his/her feelings about leaving the service. It can also be impacted by what they do after leaving the military. It's complicated . . .
However, if you retire, you are entitled to be addressed by your rank at retirement.
For flag officers, I would always defer to addressing them by rank. It's almost like "Dr." in terms of usage.
For O-6 retirees (Colonels, Captains), it's probably 50/50. Some very much use their ranks; others drop their rank the minute they retire.
I would say that most who retire at O-5 (Commander, Lt. Col.) or less, as well as retired enlisted personnel, do not go by their rank. However, there are definitely exceptions.
I would look at the way your BGO is listed in CIS and start with that. If it is a rank, address an email or conversation as "Commander X." If the person prefers "Mr." or "Ms.," he/she will likely let you know.