ScottishPower has been fined £18 million by Ofgem for customer service failures.
Ofgem, the regulator for gas and electricity providers, said that the energy firm "failed to treat its customers fairly" when dealing with complaints and billing, and handling calls.
Dermot Nolan, Ofgem chief executive, said: "ScottishPower let its customers down during the implementation of a new IT system.
"This created frustration and worry for many customers, who also wasted a lot of time trying to contact the supplier by phone."
ScottishPower was slammed for "unacceptably long call waiting times", and received over one million complaints between June 2013 and December 2015.
Additionally, the regulator said, thousands of Ombudsman rulings were not implemented within the required 28 days, and ScottishPower's billing failures meant that many customers did not receive money they were owed.
However, Ofgem said that since it started investigating, ScottishPower had improved its customer service.
Up to £15 million of the fine will be paid to ScottishPower customers, and the remainder will go to charity.