Ex-News International chief executive Rebekah Brooks received messages of support from politicians including the Prime Minister and Chancellor after she resigned over the phone-hacking scandal last July.
Brooks confirmed that David Cameron sent a message to her indirectly 'along the lines'of 'keep your head up'shortly after her departure from News International.
Appearing at the Leveson Inquiry this morning, she also confirmed receiving a message through an intermediary of Cameron along the lines of 'sorry I couldn't have been as loyal to you as you have been to me, but Ed Miliband had me on the run".
She also received messages of support or commiseration from Tony Blair, the Home Office and Foreign Office, but from 'very few'Labour politicians.
Asked if former Prime Minister Gordon Brown got in touch, she replied: 'Not Mr Brown. He was probably getting the bunting out".
Details of the messages emerged this week when The Times serialised the book, Cameron: Practically a Conservative, detailing how Cameron and Brooks would often pop round to one another's houses in south Oxfordshire.
Authors Francis Elliott, of The Times, and James Hanning, of the Independent on Sunday, said: 'The wider public might have liked to know too of the text message that Charlie Brooks told friends Cameron sent to Brooks at the beginning of the week in which she resigned, telling her to keep her head up and she'd get through her difficulties.
"Such contact came to an abrupt halt soon afterwards, with Brooks not wanting to embarrass Cameron and he wanting to be able to say, hand on heart, that they had not been in touch.
"But it was claimed that Cameron did send an emissary to Brooks to mitigate his sudden coldness towards her.
"The gist of the message was 'Sorry I couldn't have been more loyal to you as you have been to me, but Ed Miliband had me on the run'."
Brooks resigned on 15 July following allegations broken by The Guardian that the News of the World hacked the voicemail messages of murdered schoolgirl Milly Dowler in 2002 when Brooks (then Wade) was editor of the paper.
After she became editor of the Sun, in which she admitted Rupert Murdoch had a hand, she spoke to the mogul "frequently", Brooks said.
She revealed that the tycoon "liked X Factor", despite arguing for coverage of serious issues over celebrity, and also quashed a rumour that the pair used to swim together when he was in London.
Brooks also denied that, after she was arrested in 2005 over an alleged assault on her husband, Murdoch sent a dress to the police station where she was being held. She was later released without charge and the police took no further action.
The inquiry heard that former prime minister Tony Blair attended a surprise party thrown for Brooks by Murdoch, but she said she could not remember whether Cameron was there, though it was possible he was.
She told the inquiry she met Blair in 1995 after he became leader of the Labour Party, and their meetings became more frequent throughout his decade as premier.
They met formally, informally and socially, and often spoke on the telephone, she said, admitting they became "friendly".
But she said there were no emails or texts because "he did not have a mobile phone or in fact I think use a computer when he was prime minister".
In a written statement she said she became close friends with Mr Blair and his wife, Cherie, as well as his spin doctor Alastair Campbell and his partner, Fiona Millar.
Brooks disclosed details of her meetings with senior politicians over more than a decade, although she stressed that they were merely from her secretary's diary and "very incomplete".
She met or dined with Blair at least 30 times between 1998 and 2007, including three times in June 2008.
But Brooks said there were only around three occasions when they dined alone.
After Brown took over as Prime Minister in 2007, they met or dined at least five times including once at the Browns' home.
Brooks recorded one lunch and four dinners with Mr Cameron in 2010, after he had taken power. One was the widely-reported Christmas dinner party at the Brooks' Oxfordshire home on December 23.