ScottishPower has been fined £18million by regulator Ofgem for customer service failings.
The energy firm "failed to treat its customers fairly" when handling calls, dealing with complaints and billing, the watchdog said.
Ofgem chief executive Dermot Nolan said: "Scottish Power let its customers down during the implementation of a new IT system. When things went wrong, it didn't act quickly enough to fix them.
"This created frustration and worry for many customers, who also wasted a lot of time trying to contact the supplier by phone."
ScottishPower was blasted for "unacceptably long call waiting times", with the company receiving more than one million complaints between June 2013 and December 2015.
Ofgem added that thousands of Ombudsman rulings were not implemented within the required 28 days and ScottishPower's failures resulted in more than 300,000 customers receiving late final bills. This meant many customers did not receive money they were owed.
However, the regulator also said that, since it opened the investigation, ScottishPower has improved its customer service.
Up to £15million of the fine will be paid out to ScottishPower customers affected by customer service issues and the remainder will go to charity.
Gillian Guy, chief executive of Citizens Advice, which provided evidence to Ofgem's investigation, said: "ScottishPower failed its customers not once but twice. Not only did the firm struggle to get people's bills right first time, it also failed to sort out the problems when customers tried to complain.
"Time and again we're seeing big companies introduce new billing systems which leave customers in limbo - with the wrong bill and no way to sort it out.
"Ofgem is right to hand ScottishPower such a large fine. We also need the industry to start learning the lessons from issues which have caused such misery for consumers."