Darren Bygraves, of Kirkham Place, Monk Bretton, handed over tablets to the woman - who was jailed for stabbing him - as he gave her a hug in HMP New Hall’s visiting area, near Wakefield.
Leeds Crown Court was told the inmate had aroused prison officers’ suspicions before the visiting session by telling them that she was no longer taking drugs, despite being a ‘known user’.
Afterwards they searched her and found tablets - wrapped in clingfilm - in her trousers.
Bygraves, 49, and the woman were both arrested but, having been bailed, he continued to offend on three occasions in Barnsley.
Police found 18 packages of ketamine having stopped his car - a Fiat Punto - before a Kinder chocolate egg containing heroin and crack cocaine was found in a Ford Mondeo being driven by Bygraves at a later date.
He was also caught selling the same Class A substances on the streets, the court was told.
His mobile phone - which was seized and analysed - contained messages linking him to drug supply and ‘delivery cards’ were found.
He pleaded guilty to two counts of possession of a class A drug, possessing a class B drug and conveying a drug into prison.
Sean Fritchley, defending, said Bygraves was a former car salesman and his relationship with the woman began in 2015, but has now ended.
He said: “He got dragged into the cycle of drug use - she had been using drugs recreationally. From the start the relationship was a violent one, he says.
“He had become infatuated with a female that was far younger than him. The relationship, on her part, might not have been genuine from the start.”
South Yorkshire Police admitted that drug mules have become an emerging concern, but bosses - alongside West Yorkshire colleagues - said they are committed to tackling the problem.
The government also vowed to invest more to stiffen up security at entrances - including improved scanners - while increased searches have also been adopted by South Yorkshire Police in a bid to crackdown on smuggling.
Repeats of Bygraves’ behaviour will not be tolerated, according to Detective Inspector Steve Smith, who heads up Operation Fortify, an anti-drugs and organised crime unit which has recently focused on local prisons.
He added: “Bringing illicit items into prisons is a serious crime as it can bring misery to staff and inmates.
“Also, it often leads to or provokes violent crime.
“Officers are carrying out searches and speaking to visitors as they work towards eliminating these items from coming into prisons.
“I want to warn anyone who’s considering bringing illegal items in that we will give them a robust response.”