A hacker who sent more than 27 million spam messages to Facebook users has been sentenced to 30 months in prison and ordered to pay more than $310,000 in fines.

Sanford Wallace, who promoted himself as the "Spam King," compromised more than 500,000 Facebook accounts between November 2008 and March 2009, sending users links to external websites that harvested their log-in credentials and friend lists. Wallace then spammed these users with links to other websites, earning money by directing traffic their way.

Wallace's spamming career didn't begin with Facebook messages, but stretches all the way back to the '90s, when he sent junk fax messages. He faced civil suits from both Myspace and Facebook in 2007 and 2009, respectively, and racked up nearly $1 billion in fines from the two companies that he was unable to pay. This recent sentence, is the first time Wallace has been convicted of a crime, with the Spam King pleading guilty to one count of "fraud and related activity in connection with electronic mail."

His two-and-a-half year jail sentence is just short of the three year maximum he was facing.

The Verge