Although they split nearly three years ago, the 34-year-old singer, whose exes also include Jessica Simpson and Jennifer Love Hewitt, penned his single "Shadow Days" (from the album "Born and Raised") with Aniston, 43, in mind.
"'Shadow Days' is about Jen," a source tells Us Weekly. "It really took him a long time to get over her. He really loved her a lot."
Sings Mayer in the song, "You find yourself alone ... I found myself in pieces/ On my hotel floor/ Hard times help me see/ I'm a good man with a good heart/ Had a tough time, got a rough start/And I finally learned to let it go."
Explains the source, "He wrote the song as a farewell letter knowing [Jen] would hear it. Ultimately he's done a lot of self-reflection, though, and he realizes they weren't right for each other."
The rocker and the actress first got together in April 2008 and, after multiple breakups, called it quits for good in late 2009. Aniston has been happily ensconced with Justin Theroux for over a year now.
"[John and Jen] weren't right for each other, but he is really a good guy," a source added.
After high-profile flameouts with both Simpson, 31, and then Aniston, Mayer is done dating celebs, the source adds, "He's looking for a nice, non-famous girl he can relate to. ... He loved [Jen and Jessica] both, but it really affected him emotionally and it wasn't worth it."
MORE FROM WONDERWALL: