Ben Affleck received words of encouragement from an unlikely source in the days after his estranged wife Jennifer Lopez filed for divorce.

If Affleck had been listening to Mindy Kaling's speech at the Democratic National Convention Wednesday, he would have been surprised to hear his name.

"I couldn’t leave here without giving a shoutout to the amazing delegation from my home state, Massachusetts. I love you, Massachusetts," Kaling, 45, told the crowd in her speech.

"Everyone is always hating on us! But they just don’t get it! Go Sox! Go Jayson Tatum! Ben Affleck, hang in there!"

JENNIFER LOPEZ IS ‘DEVASTATED’ ABOUT BEN AFFLECK DIVORCE, ‘GAVE IT HER ALL TO MAKE THIS WORK’: SOURCE

Mindy Kaling shouted out Ben Affleck at the DNC

Mindy Kaling gave a speech at the DNC and mentioned Ben Affleck. (Getty Images)

Ben Affleck and Jennifer Lopez pose at an event

Ben Affleck and Jennifer Lopez married in 2022. (Michael Tran/AFP via Getty Images)

"Ben Affleck, hang in there!"

— Mindy Kaling

Lopez filed for divorce from Affleck  Aug. 20, the anniversary of the couple's formal Georgia wedding ceremony.

The "Let's Get Loud" singer gave the marriage her all and wanted to make things work after the couple rekindled their romance in 2021, a source told Fox News Digital. Lopez is "devastated" over the split.

Meanwhile, Affleck seems to be doing just fine despite the marriage ending, another source shared. The "Gone Girl" star "threw in the towel a long time ago."

Jennifer Lopez walks in Los Angeles on Aug. 17

Jennifer Lopez was spotted without her wedding ring days before she filed for divorce from Ben Affleck. (Getty Images)

JENNIFER LOPEZ, BEN AFFLECK DIVORCE AFTER TWO YEARS OF MARRIAGE

Jennifer Lopez and Ben Affleck

Jennifer Lopez and Ben Affleck hosted a second wedding in Georgia in 2022 following their secret Las Vegas nuptials.  (Jennifer Lopez/OntheJLO.com)

Speculation that the couple's marriage was over began in May, after Lopez attended the Met Gala without her significant other. At the time, a representative for Affleck told Fox News Digital the star had been filming "The Accountant 2" in Los Angeles.

However, the two hadn't been spotted together in months, further fueling rumors of a split.

Sources told People magazine in June that Lopez was living in the couple's $60 million Beverly Hills home while Affleck stayed in a rental nearby as they attempted to sell the pricey mansion.

"He started moving out a while ago," a source told Fox News Digital at the time. "The marriage is completely over, and Jennifer is heartbroken. She loves love and wanted this to work so badly."

LIKE WHAT YOU’RE READING? CLICK HERE FOR MORE ENTERTAINMENT NEWS

Ben Affleck, Jennifer Lopez Gigli

Ben Affleck and Jennifer Lopez met while filming "Gigli." (Tom Kingston/WireImage via Getty Images)

Lopez and Affleck first met while filming "Gigli" in 2002. The couple planned to marry in 2003 before postponing the wedding. By early 2004, the two had ended their engagement.

Affleck went on to marry Jennifer Garner, whom he had met on the set of "Pearl Harbor" in 2000. Garner was married to Scott Foley at the time, and Affleck has publicly said the two fell in love in 2002 while filming "Daredevil." The "Good Will Hunting" actor was in a relationship with Lopez at that time. 

Affleck and Garner got engaged in 2005. They welcomed three children together before divorcing in 2018.

Jennifer Garner and Ben Affleck enjoy a baseball game

Jennifer Garner and Ben Affleck married in 2005. (AP)

CLICK HERE TO SIGN UP FOR THE ENTERTAINMENT NEWSLETTER

Lopez has been married three times before. She married Ojani Noa in 1997 before divorcing in 1998. The pop star went on to marry backup dancer Cris Judd in 2001. The couple called it quits in 2003. Lopez married Marc Anthony in 2004 after her split from Affleck.

Anthony and Lopez welcomed twins in 2008 before divorcing in 2014.

CLICK HERE TO GET THE FOX NEWS APP

Fox News Digital's Tracy Wright contributed to this report.