"How many other women did you cheat on your wife with while you had a baby at home?" Avenatti wrote.
The duelling tweets came after District Judge James Otero dismissed Daniels' suit claiming that Trump defamed her when he suggested that she was lying about being threatened to keep quiet about their alleged relationship. Avenatti appealed the ruling to the 9th Circuit Court of Appeals, he tweeted.
Daniels has claimed that she was approached by a man in 2011 in Las Vegas who told her to "leave Trump alone" and threatened her infant daughter. She says she and Trump had a brief affair in 2006.
Trump denies that he and Daniels had an affair. In April, he tweeted that Daniels's story about the threat was a "con job," which became the foundation of her defamation suit.
It was not immediately clear what Trump meant when he vowed to "go after" Daniels and Avenatti in Texas. Daniels, whose given name is Stephanie Clifford, lives in the state.
Avenatti dismissed Trump's threat as "absurd."
"There is no legal basis that would allow him to do this," he said.
The "letter" Trump mentioned seemed to refer to a signed January 10, 2018, statement from Daniels in which she denied having an affair with Trump and called allegations to the contrary "absolutely false." The statement was released to the media that month by Trump's then-lawyer, Michael Cohen.
The statement, which Daniels has since withdrawn, contradicted an extensive account of the alleged liaison she gave in a 2011 interview with In Touch magazine.
Daniels claims that her affair with Trump took place in July 2006, four months after the birth of Trump's third son, Barron. In her new book, Full Disclosure, she gives a detailed account of the evening she said they had sex, including describing Trump's genitals.
Daniels responded to the "Horseface" tweet by referring to Trump as "Tiny."
"Ladies and Gentlemen, may I present your president," she tweeted. "In addition to his . . . umm . . . shortcomings, he has demonstrated his incompetence, hatred of women and lack of self control on Twitter AGAIN! And perhaps a penchant for bestiality."
Avenatti retweeted her message with a reference to Senator Marco Rubio, (R), who during the 2016 Republican presidential primary said that Trump has small hands, another implied reference to his genitals.
The dismissal of the defamation suit was a blow for Daniels, and for Avenatti, who has cultivated an image as one of Trump's chief antagonists and is considering a presidential run in 2020. Their other suit against Trump, over a nondisclosure agreement Daniels signed in 2016, remains pending before Otero.
Trump has a long history of insulting women for their looks.
In 2015, he was quoted mocking the appearance of former business executive Carly Fiorina, then a rival for the GOP presidential nomination.
"Look at that face," Trump was quoted as saying as he watched Fiorina during a television interview. "Would anyone vote for that? Can you imagine that, the face of our next president?"
That year, he was asked during a primary debate about his use of language such as "fat pigs," "dogs," "slobs" and "disgusting animals" to describe women.
"Only Rosie O'Donnell," he replied.