Jill Kelley with husband Scott, left, and Vice Adm. Robert Harward in 2012 at a party at the Kelleys’ home in Tampa. (Bill Serne/New York Daily News via Getty Images)

Judging from her e-mails, Jill Kelley was star-struck by the big-name military commanders rotating between the war zones in the Middle East and her home town of Tampa. And they were equally smitten with her.

“Everyone thinks you’re a RockStar!” Kelley gushed in a 2012 e-mail to Marine Gen. James N. Mattis, then commander of all U.S. military forces in the Middle East. “We agreed how amazing it must be that you’re single-handedly re-writing history,” she added, recalling how she had sung the general’s praises to several foreign ambassadors at the Republican National Convention that August in Tampa.

After another social event, she wrote a similar mash note to Mattis’s deputy, Vice Adm. Robert S. Harward. “What a Leader you were to these heads of State,” she enthused. “You ROCK!!!”

Replied Harward: “YOU ROCK MORE!”

[Read: Excerpts of e-mail conversations between a Tampa socialite and two high-ranking military officials]

The Kelleys hosted Gen. David Petraeus and his wife, Holly Petraeus, right, at their home in 2010. At left is Jill’s twin, Natalie Khawam. (Amy Scherzer/AP)

In late 2012, Kelley’s talent as a Tampa hostess and her knack for charming men in uniform indirectly triggered one of the most embarrassing national security scandals of the past decade. Among other casualties, the fallout led to the forced resignation of CIA Director David H. Petraeus — a former four-star Army general — and the early retirement of Marine Gen. John Allen, the commander of U.S. and NATO forces in Afghanistan.

Kelley’s chumminess with Petraeus and the military brass had attracted the notice of the spymaster’s biographer and mistress, Paula Broadwell. She bad-mouthed Kelley in anonymous e-mails to military officials and others, according to federal investigators and a lawsuit filed by Kelley. The FBI got involved. Petraeus quit in disgrace. Allen retired.

The case still has not been entirely resolved. The Justice Department is deciding whether to charge Petraeus with leaking classified material to his lover. He has denied doing so.

Long after the scandal broke, it remains unclear what exactly prompted Broadwell to view Kelley as a rival. Kelley has said the two never met and that she never had an affair with Petraeus, Allen or anyone else.

Nor has anyone fully explained why Allen, while busy overseeing the war in Afghanistan, exchanged a blizzard of correspondence with Kelley — between 20,000 and 30,000 pages of e-mails, according to some senior defense officials. Other officials have said that figure includes many duplicate notes and exaggerates the extent of their communications, adding that there were only about 300 total e-mails.

The Defense Department inspector general investigated and concluded in 2013 that Allen had not committed any wrongdoing. But it has kept its report and all of Allen’s e-mails under lock and key.

Now, a glimpse into Kelley’s relationship with military commanders has emerged from another, previously undisclosed batch of e-mails: her correspondence with Mattis, a legendary Marine, and Harward, a Navy SEAL, from when they served as the top two officers at U.S. Central Command headquarters in Tampa. The Washington Post requested the e-mails in November 2012 under the Freedom of Information Act. More than two years later, after numerous unexplained delays, the Pentagon released 238 pages of heavily censored documents.

The unredacted portions of the e-mails — from Mattis’s and Harward’s government e-mail accounts — contain no evidence of improper behavior. But taken together, the records depict two wartime commanders who were easy marks for the flattery of an exuberant socialite. “I wish that we could clone a couple thousand of you, but the land is likely not ready for that big an impact,” Mattis told Kelley in a Jan. 31, 2012, e-mail.

Mattis and Harward, who have since retired from the military, did not respond to multiple requests for comment.

Kelley, 39, who still lives in Tampa, referred questions to her attorney, Alan C. Raul of Washington. He released a statement that read, in part: “The latest set of e-mails made public by the government simply confirms that Jill Kelley is and was a talented, civic-minded woman doing productive work as Honorary Ambassador to Central Command in Tampa and as Honorary Consul for the Republic of Korea.”

“Nonetheless,” he added, “continued unauthorized government release of the Kelleys’ e-mails exposes them to further unjustified embarrassment and injury.”

A relative newcomer on Tampa’s social scene, Kelley and her husband, Scott, hosted events at their mansion for military officers from nearby MacDill Air Force Base, home of Central Command headquarters. The e-mails show how Kelley was eager to deepen and formalize the relationship, urging the brass to bestow on her the title of honorary ambassador for Central Command and the U.S.-led military coalition in Afghanistan and the Middle East.

“Sooooooooo…..Did you and Jim finally decide to make me your ‘official’ CentCom ambassador?????” Kelley asked Harward on Jan. 12, 2012. “Please! Please! Please! I always wanted to be an Ambassador, since I was made to be a ‘catalyst’ — that helps build or facilitate Foreign relations.”

Harward gave a teasing reply: “We’ll have to put you through the vetting process and interviews to ensure you have the right attributes!”

She passed muster soon enough. On April 19, Harward hosted an official recognition ceremony and reception in which Kelley was anointed “United States Central Command and Coalition Honorary Ambassador.”

Mattis was tied up in Baghdad and couldn’t attend. Kelley, who is of Lebanese descent, e-mailed him afterward with a narrative of the event. She described how she gave a speech, partly in Arabic, and did her best to make a good diplomatic impression with VIPs from Middle Eastern countries.

“I gave my commitment . . . as the Ambassador, to make it my priority to advance global trust, international exchange, and camaraderie within the Command,” she wrote. “But most importantly I thanked Gen Mattis for his priceless support and glorius leadership. I said, without him, this would not be a reality!”

She added: “Harward also spoke — really flattering words about ‘Madame Ambassador’ He explained how they decided to designate this new position — and why the CentCom unilaterally chose me. :) (which was very humbling to hear in front of a million guys)”

A medical researcher and the mother of three young children, Kelley found her niche as a networker, volunteering her time to arrange dinners, charity functions and other events in Tampa and Washington. Her ebullient personality stood out in military and diplomatic circles, catching attention from some unexpected corners.

In January 2012, for example, the South Korean Embassy in Washington informed Kelley that she had been selected to become an honorary consul. Even though she knew little about the country, she accepted the title with gusto.

“YES!!!! Honorary Consul General. I’m soooooo excited about the humbling honor,” she wrote to Mattis on Jan. 31 to inform him of her appointment. “It’s ironic that I get the request from the state of Korea — which is NOT my expertise. However as a lover of International Politics/Foreign Affairs, I do find the Korean Statehood quite interesting . . . (I’m a lover of conflict problem solving, and have a keen sense of seeking opportunities in chaos.).”

While Kelley’s appointments as ambassador and consul general were honorary positions, the e-mails indicate she was eager to become a diplomatic player.

In July and August 2012, she informed Harward in a series of notes that she had received an official invitation from the parliament of Afghanistan to visit Kabul. In correspondence with State Department officials, she emphasized that her planned visit to Kabul had the backing of Allen, the U.S. general in charge of military operations in Afghanistan.

“I am honored by their petition of me, and would be humbled to serve the request to foster, promote and proliferate future relations and agreements with the Members of Parliament,” Kelley wrote in an Aug. 27 e-mail to an unidentified State Department official, which was copied to Allen. “As I stated in our conversation, COMISAF John Allen is well aware of the invitation by Parliament, and is in support of my visit to Kabul.” Kelley’s attorney did not respond to a query about whether she went on the trip.

As she embraced her honorary roles, Kelley also became protective of her diplomatic turf. The tone of her cheery, solicitous e-mails changed abruptly in early July 2012 after an unidentified NATO official informed her matter-of-factly that three other coalition ambassadors had been appointed and would be attending a French-sponsored Bastille Day party.

“Bob,” she e-mailed Harward minutes later. “WHAT IS THIS ALL ABOUT??? You never informed me of ‘3’ other Honorary Ambassadors??????”

When Harward replied that he would check into the matter, Kelley fumed some more. “Please call . . . and make it very clear that you are NOT supporting this,” she wrote. “These NATO guys manipulate passive behavior . . . Clearly, I’m offended, and not standing up for this . . . Please address this today, and kill this for once and for all.”

Kelley’s diplomatic career crumbled a few months later — not because of her perceived NATO rivals but because of the FBI’s investigation into Broadwell’s anonymous e-mails and the ripples from Petraeus’s downfall.

Although Kelley was never accused of wrongdoing, her name and her unusual niche in the national-security establishment were quickly publicized by the news media. In 2013, she sued the FBI and the Defense Department, asserting that her privacy rights had been violated by officials who leaked her name and personal information to reporters.

The federal government has sought to dismiss the case, but a judge has ruled that the lawsuit can proceed in U.S. District Court in Washington.