Uxbridge Magistrates’ Court heard that Bains was ordered to pay his ex over £80,000 by a family court after their divorce in April 2019.
In October, Bains sent an email to Ms Akhtar 18 times over three days. He blamed this on a “glitch” in his email account.
He also sent “insulting and abusive” emails to her, suggesting her husband was also her brother.
Prosecutor Christine Lynas said: “The nature of both offences relates to sending numerous emails to Ms Akhtar. On one occasion he sent a box of sex toys he said belonged to Ms Bains and a copy of an escort profile she maintains was false.
“Whether or not the allegation was false or not does not make a material difference to sentencing.
Sex toy ads cause broadcasters to pull coverage of Olympic qualifiers over 'bad taste'
“Between 23 and 28 October he sent the same email to Ms Akthar 18 times. In response to that he was asked to refrain from such behaviour and he followed this up with further emails which became abusive.”
One of his emails to the solicitor read: “You look far older than you are. Perhaps you are worn out from all the lies and work over the years. You have the mind of a child.
“Although Zara means beautiful, brilliant or shiny, it seems you are none of those things. You are similar to your client as you are both liars.”
Another email said: “Your client is a disgraceful person and pure evil.”
It was said Bains has previous convictions for assaulting and falsely imprisoning his ex.
Mystery as X-rated banner flies over Leeds and leaves locals in stitches
In a victim impact statement, Ms Bains said: “Since the letters and parcels were sent I don't feel safe. I constantly look over my shoulder for the defendant and worry about what he might do to me. This was designed to cause me to be disgraced and humiliated.
“I am constantly anxious now and I live in fear. I’m scared what he will make up about me next in order to humiliate me – I can't use social media for fear of my photos being taken and used to humiliate me.”
The court heard how Ms Akhtar spent thousands on a security system at her law office as she was so concerned by Bains' harassment.
She said in a statement: “The threats and abuse I have received has had a significant emotional impact on me and generally in my everyday life.
Philips clock ridiculed as 'sex toy' over 'supple and plump' hole design
“I’m scared he will find me. No solicitor should be subjected to threats and abuse I have for merely doing my job. I did not deserve to receive this treatment.”
In his statement Bains said: “I reacted emotionally and wrongly in the contact sent to Mrs Akhtar.
“I am deeply apologetic for any harm I have caused.”
Bains was also ordered to pay court costs totalling £753.
For the latest breaking news and stories from across the globe from the Daily Star, sign up for our newsletter by clicking here.