The India-born 37-year-old played two one-day internationals and a Twenty20 match for the Proteas in 2007.
The match-fixing charges relate to the 2015 Ram Slam T20 Challenge Series.
Five of those 20 years are suspended on condition that Bodi, a left-arm wrist-spinner, commits no further offences.
Cricket South Africa said "a lengthy ban was appropriate".
CSA chief executive Haroon Lorgat added: "Our attitude to corruption will always be one of zero tolerance.
"There is no doubt that Mr Bodi's actions have threatened the integrity and image of the game that we love and he must be handed a strong punishment. He accepts the folly of his actions."
Former England captain Michael Vaughan says Bodi should have been kicked out of cricket to send a message to other corrupt players.
"If you are found guilty of corruption, the only way to stamp it out and to set the precedent of everyone in the game of cricket is to give a life ban," he told the BBC's cricket programme  Test Match Special.
"That's the only thing that would send a shockwave through the game."
Vaughan says Pakistan's Mohammad Amir should have been suspended for life not given a five-year ban after being found guilt of spot-fixing.
Former South Africa spinner Gulam Bodi has been banned for 20 years after admitting charges of contriving or attempting to fix a number of domestic Twenty20 matches.