25 year old Phillip Paul was operating into Leatherhead, Epsom, Redhill and Dorking.
Messages advertising the sale of drugs were accidentally sent to the mobile number of a serving police officer who reported Paul.
He was detained at his home following an investigation.
Paul pleaded guilty to being concerned in the supply of crack cocaine and heroin and possession of cannabis.
Investigating officer, PC Joseph Brown, said; “Drug dealing can have a hugely disruptive effect on the local community and dealers make their ill-gotten money off the misery of others. If you come into Surrey to deal drugs, we will pursue you and bring you to justice.”