Hillary Clinton’s presidential campaign was “foolish” not to mount a louder and longer defense of her government email troubles in its last weeks, when the FBI had suddenly reopened the issue and Donald Trump was using it to thrash Clinton daily, a top Clinton aide concludes in a new memoir.

Clinton herself had a gut feeling she should be addressing the issue more forcefully in those closing days in 2016, but her campaign staff urged a strategy that would show her tackling policy questions that would matter if she won the White House, campaign communications director Jennifer Palmieri wrote.

“It was a mistake, although at the time it was hard to accept that telling Hillary to keep bringing up the emails herself could possibly be the right advice,” Palmieri wrote. “But I should have seen that, as unappealing as addressing the issue was, it was what voters needed to hear from Hillary at that moment. She got that.”

Palmieri’s memoir, “Dear Madam President,” is a campaign postmortem wrapped in an open letter to the woman who will one day become what Clinton did not — the country’s first female president. It is also a compendium of advice for working women now and in the future, and at times a diatribe against President Trump and the campaign he ran. She calls Trump a misogynist and a race baiter, for starters.

Trump suggests Comey prematurely exonerated Clinton over emails

The email issue that dogged Clinton from the first moments of the campaign runs through Palmieri’s book as an annoyance, an enigma and a cautionary tale about the different standards applied to a woman seeking power. Palmieri maintains, as Clinton does, that Clinton’s use of a private email system for her government work as secretary of state was a mistake but that criticism of it was overblown.

“One thing our campaign was never able to move beyond was the vexing issue of Hillary’s emails,” Palmieri wrote. “I think it was the unease people felt about Hillary’s motivation as a woman seeking power that made it impossible for us to very fully put this matter to bed. I have weathered a lot of political crises, but never encountered one quite like this. It was a box we could never get out of.”

The press and public kept moving the goal posts for addressing the email issue, Palmieri wrote. She came to believe that whatever Clinton said about it would never be enough, because the matter had become a stand-in for wider unease about Clinton herself and a female presidential candidate more generally. Palmieri does not fault Clinton, as many did during the campaign, for a reaction that could have appeared grudging or defensive.

“It’s not on the level,” Palmieri said in an interview. “I would push people about emails, like, ‘What is it? Why is this so troubling?’ and eventually there was not an answer, not a rational answer.”

Not an answer for why the whole issue was such a roadblock and also not an answer that would resolve the matter, she said.

“I realized there is no right answer” Clinton could give, Palmieri said.

Clinton used private email instead of a government address as secretary of state

The email system, which was not disclosed during Clinton’s time at the State Department, led to an FBI inquiry into whether classified information was put at risk. Then-FBI director James B. Comey shuttered the investigation in July 2016 but did so with a public dressing down of Clinton, which, Palmieri notes, gimlet-eyed, was not the usual way to end an FBI investigation.

Comey’s surprise announcement the following October, just 11 days before the election, that he was reopening the inquiry was among the campaign’s darkest hours, Palmieri wrote. But Clinton seemed almost to expect it, telling her staff, “You knew we weren’t done,” Palmieri quotes Clinton as saying when Palmieri told her the news aboard the campaign plane.

Clinton “knew we weren’t going to make it all the way to Election Day without a major new plot twist, and here it was,” Palmieri wrote.

Palmieri defends Clinton throughout the short book as a woman who faced unimaginable odds over four decades of public life and who, in Palmieri’s telling, understood better than her campaign team how disconcerting a figure she was to many people and how difficult the election would be.

“Madam President, I believe this to my very core: If it weren’t her emails, it would have been something else,” Palmieri wrote. “Another issue equally trivial and irrelevant for which Hillary would have been tortured. Because underneath all the questions about wiping servers and deleting emails lay the fundamental truth that what all of this was really about was there was something about Hillary Clinton folks just didn’t trust. And that something was an intelligent, capable, ambitious woman in a position of power.”

Palmieri gave that unease, that sense of not “liking” Hillary Clinton, a name during the campaign and in the book: TSAHIJDL — There’s Something About Her I Just Don’t Like. Clinton has faced TSAHIJDL at least since Bill Clinton ran for president in 1992, “and that was before everything,” Palmieri said in the interview. Before Whitewater, health care, Monica Lewinsky, Benghazi or emails.

“Get to know it,” Palmieri advised her unknown correspondent in the book, because she said a version of TSAHIJDL will hover around that woman’s candidacy and presidency, too.

Palmieri writes that women she respects questioned her decision to “go back over everything that happened with Hillary in the 2016 campaign,” on the theory that the account would be seen as complaining about Clinton’s treatment. Palmieri writes that she might have agreed but for the front-row seat she had to what she calls the unfair expectations the public and the press set for her candidate.

“We need to understand what happened. We need to make the path easier for all women working to succeed in whatever role they choose,” Palmieri wrote. “The unease we felt toward Hillary could hold any woman back anywhere.”

Clinton herself already has addressed “what happened” in a campaign memoir by that title, which was published last year. It is a more candid and rawer book than her previous memoirs, and it apportions blame to herself as well as to the same forces Palmieri identifies.

Palmieri wrote that she was among the “hand-wringers” who worried that Clinton’s memoir would backfire and only lead to more criticism.

“Whenever she has set out to explain herself in the past, whatever she had to say has been processed through some weird reverb and ended up distorted,” Palmieri wrote, adding that to her surprise, “this time she was heard.”

Clinton concession speech: This is painful and will be for a long time

Palmieri has some standard workplace advice for women — own your place in the room where it happens, speak up, stop doubting whether you were meant to be there — and less-conventional suggestions, such as to ditch the Botox and go ahead and cry at work.

“I hope you will see fit to let us see some of your tears, as other presidents have done in recent years,” Palmieri wrote to the future female commander in chief.

Asked why she chose the letter format, Palmieri said it allowed an assessment of the campaign that also reckons with the political power she believes the failure of that campaign has helped to marshal.

“I chose to not just make it a book about advice around politics or even the workplace but life lessons, as well, because I think what happened on Nov. 8, 2016, was something bigger than a political loss,” Palmieri said.

It may be an end to the political rubric that a successful female candidate has to be “a facsimile” of a successful male candidate, Palmieri said. That denied Clinton a part of her humanity and probably accounts for some of the criticism that she wasn’t “authentic” enough, Palmieri said.

“It might not have been a glass ceiling that shattered that night, but something sure did. The way I have experienced it, the fourth wall of the matrix fell,” she said. “I realized we — women, we, me — we have been thinking about leadership all wrong.”