The National Enquirer should have known better than to approach Jeff Bezos over sexual photos and messages texted to his mistress, Lauren Sanchez, says Stu Zakim, a former spokesman for the tabloid media empire owned by David Pecker, a longtime friend of President Donald Trump.

"Oh my God, have these guys not learned anything? Because common sense alone would say, 'You're going after Jeff Bezos, and you're putting it in writing?' There's nothing private anymore. It's going to be a public document. So what is their motive?" Zakim said on CNBC Friday.

Zakim appeared on "Squawk Box" just before a statement was issued by National Enquirer parent American Media Inc. denying Bezos' claims that he is being blackmailed. "American Media believes fervently that it acted lawfully in the reporting of the story of Mr. Bezos," said AMI's statement — adding, however, the board determined "it should promptly and thoroughly investigate the claims."

The AMI board consists of four people, including Pecker and David R. Hughes, a former Trump casino executive.

In a Thursday blog post headlined, "No thank you, Mr. Pecker," Bezos says that AMI asked him to publicly deny any political motivation in its coverage of his divorce in exchange for not publishing photos he texted to Sanchez, including a "below the belt selfie." Bezos and his wife, MacKenzie, announced their divorce on Jan. 9. Later that day, the Enquirer broke news about Bezos' affair with Sanchez.

"I think Pecker did it — not because necessarily to help Trump — but he knew it was going to sell a lot of copies of the Enquirer and gain a lot of publicity, because here we are talking about it. It's the top story everywhere," said Zakim, corporate communications chief from 2004-2006 at Pecker's American Media, which also owns Men's Journal and other publications.

Zakim referenced Trump because the president has been friends with Pecker for years, and the president has been a frequent critic of Bezos, founder of Amazon and the owner of The Washington Post. He's the world's richest man, with a fortune in excess of $133 billion.

"The 'catch and kill' is not a new concept [for tabloids]. This has been going on long before it got broken with Trump," said Zakim, now president of Bridge Strategic Communications.

"There was a falling out, we thought, between Pecker and Trump when all of a sudden the National Enquirer stopped covering him as lovingly as they did" and then when Pecker agreed to cooperate with prosecutors.

White House Deputy Press Secretary Hogan Gidley, when asked about the Bezos matter, told CNBC, "I'm not sure [the president is] aware of it. And I'm not going to get into a conversation about something between Jeff Bezos and a tabloid magazine."

Amazon has not responded to CNBC's requests for comment.

— CNBC's Eugene Kim and Reuters contributed to this report.