Marissa Mayer is about to lose her CEO job, but she's in for a nice consolation prize.

Mayer is set to receive a $23 million severance package after Yahoo's (YHOO) sale to Verizon (VZ) is completed, according to a company filing Monday.

The severance payout is contingent on Yahoo getting sold and Mayer being terminated without cause.

The golden parachute package would come on top of the more than $150 million Mayer received in salary and stock awards since joining the company in 2012.

Yahoo confirmed in the filing that Mayer will cease to be CEO of what remains of Yahoo after Verizon buys its core Internet assets. But that shouldn't come as much of a surprise.

After the deal closes, all that remains of Yahoo will effectively be an investment company for its Alibaba holdings. That company will be renamed Altaba and Mayer will be replaced as CEO by Yahoo board member Thomas McInerney.

Yahoo had previously announced Mayer would step down from the board of directors of this new company after the sale goes through.

It remains unclear what, if any, role Mayer will have with Yahoo's Internet properties under Verizon. When the acquisition was first announced in July, Mayer said she planned to "see Yahoo into its next chapter."

Related: Yahoo's hometown isn't losing sleep over its sale

The Yahoo sale was thought to be in jeopardy for months after the company disclosed two massive security breaches affecting more than one billion users.

Verizon agreed to move forward with the deal last month -- at a $350 million discount. The new price tag for the acquisition is $4.48 billion.

The security breach also cost Mayer personally. Yahoo's board decided not to award her a cash bonus due to the security incidents. Mayer also oped to give up her annual equity grant for 2017, which would be worth at least $12 million based on her contract.

"We continue to be very excited to join forces with Verizon and AOL," Mayer said in a statement last month about the revised deal. "It is an important step to unlock shareholder value for Yahoo, and we can now move forward with confidence and certainty."

Verizon's goal is to use Yahoo's billion users to build an online advertising powerhouse to rival Google (GOOGL) and Facebook (FB).