tl;dr: We don't know, because no one has definitely said in any televised episode.
Strictly speaking, we don't even know when he told River his name; it almost certainly happened off-screen, since we've seen River's entire life play out across the various episodes and that didn't happen in any of them.
We know that it did happen at some point, because River has repeated his name at least twice where we would know if she got it right or wrong. (Once in the Library and once at The Doctor's grave.)
There is a very, very strong implication that it happened when they were married. When they actually did the "short version" of the wedding, he leans in and whispers what he claims is his name into her ear. As far as we know, he's following an actual Gallifreyan wedding ceremony, meaning that would be part of it. It's entirely possible, though, that he made the whole thing up on the spot.
In addition, even before it actually happens there is a very strong married-couple vibe from the two of them; from the very beginning in The Library others make remarks that hint towards that kind of relationship. It's pretty obvious that the writers are implying that they are married, and that's how she knows his name.
However, all of that is speculation and implication, and has never been explicitly confirmed on-screen by either one of them, and at this point probably never will.