Katy Perry and boyfriend John Mayer spent lots of time writing each other love letters before they went public with their relationship in June 2012.

The singer reveals that new track "Legendary Lovers" was inspired by something she wrote in an email early on in their courtship.

"I actually wrote it in an email one time, and after I wrote it I looked -- we had a long courtship before anything was [public], just writing letters to each other -- and seeing 'legendary lovers,' it sounded so nice," she tells Entertainment Weekly. "Some things float into my mind, and I process them, and [then] I make songs about them."

The new song is about how she looked through her "third eye" and how karma brought the two performers together.

"Maybe this is the beginning of something so magical tonight," she sings in the new song.

Katy also recently told the November issue of W Magazine that she had the hots for Mayer long before the two hooked up.

"I actually am dating my crush," she said. "I had a crush on him for a long time, and it just so happens we fit together great."