A Thai man who was sentenced to 20 years in jail for defaming Thailand's royal family in text messages has died in prison.

Amphon "Akong" Tangnoppakul, 61, also known as Uncle SMS, died after he complained of stomach cramps and was transferred to a prison hospital, his lawyer, Anon Numpa, said. Cause of death is not known though he had been diagnosed with mouth cancer.

Tangnoppakul was arrested in August 2010 and charged with sending text messages to the personal secretary of then prime minister Abhisit Vejjajiva, which were deemed offensive to Thailand's Queen Sirikit.

His 20-year sentence for insulting the monarchy last November was one of the heaviest ever given for someone accused of breaking Thailand's severe lese-majesty laws.

Tangnoppakul constantly pleaded innocent during the trial, saying he did not know how to use the SMS function on his phone. In court, he wept and said: "I love the king."

Thailand's government has ignored calls to reform the law. It is a highly sensitive issue in a country where King Bhumibol Adulyadej is regarded as a demigod.

Before his arrest, Amphon had lived with his wife, daughter-in-law and three grandchildren in a rented room in Samut Prakan province, on the outskirts of Bangkok.

In a handwritten note to his lawyer from prison, Tangnoppakul said he was "often disheartened," and missed his wife and grandchildren. "I'm trying to be patient," he said. "I have high hopes that I will get freedom soon," the New York times reported.

He had been hoping to get a royal pardon, Numpa said.

Reuters reported that Numpa had secured a pardon for another client, Lerpong Wichaikhammat, known as Joe Gordon, who had been jailed for breaking lese-majesty laws.

Gordon, a Thai-born US citizen, was sentenced to two-and-a-half years in December after pleading guilty to using the internet to distribute information that insulted the monarchy.