Anyone who shared their email address with the Obama campaign received emails with subject lines like “Join me for dinner?” “It’s officially over,” “It doesn’t have to be this way,” or just “Wow.” This was playfully mocked by Jon Stewart on the Daily Show and women’s website the Hairpin likened them to notes from a stalker.

The effectiveness of the emails cannot be underestimated, however, and most of the $690 million Obama raised online came from fundraising e-mails. Now, the campaign is sharing some of the formula they used to raise the large amount.

“We did extensive A-B testing not just on the subject lines and the amount of money we would ask people for,” says Amelia Showalter, director of digital analytics, “but on the messages themselves and even the formatting.”

The campaign worked on multiple drafts, as many as 18, before deciding one to send out to millions. “When we saw something that really moved the dial, we would adopt it,” says Toby Fallsgraff, the campaign’s e-mail director, who oversaw a staff of 20 writers. “The subject lines that worked best were things you might see in your in-box from other people… ‘Hey’ was probably the best one we had over the duration.”

“We were so bad at predicting what would win that it only reinforced the need to constantly keep testing,” says Showalter. “Every time something really ugly won, it would shock me: giant-size fonts for links, plain-text links vs. pretty ‘Donate” buttons. Eventually we got to thinking, ‘How could we make things even less attractive?’ That’s how we arrived at the ugly yellow highlighting on the sections we wanted to draw people’s eye to.”

Even some mild cursing like “Hell yeah, I like Obamacare” got big clicks, but no formula lasted forever. “Eventually the novelty wore off, and we had to go back and retest,” says Showalter.

One thing the scads of emails showed were that unsubscribers were relatively rare. “At the end, we had 18 or 20 writers going at this stuff for as many hours a day as they could stay awake. The data didn’t show any negative consequences to sending more,” says Fallsgraff, who qualified, “We do know that getting all those e-mails in your in-box is at least mildly irritating to some people. Even my father would point that out to me.”