See the article Add and manage email aliases for iCloud Mail on iCloud.com - Apple Support
Note: You can’t delete or turn off a primary iCloud Mail address. You can’t use an alias to create a separate Apple ID, and an email alias can’t be converted to a primary iCloud Mail address.
1 ) Enter in user library ( click on finder take cursor on top menu bar > Go then Hold option key and click on library ) > select mail and right click on copy mail and then right click on empty desktop and click on paste item , the V7 folder will be saved on the desktop .
( 2 ) Open mail application and take cursor on top menu bar > file > import mail boxes > import data > select apple mail > click on continue > select desktop > click on continue > the data will start importing and the bar will start loading and let it be completed .
( 3 ) Go to system preferences > internet accounts > select the web mail account and click on minus sign it will be deleted .
( 4 ) You can see the mail data is transferred in the bottom mail side bar but everything is empty there are no mails in sent , inbox or archive but a folder " import " is visible click on drop down arrows of each folders .
( 5 ) And if you plan to switch from yahoo to google or even change the internet servicer provider the folder " import " is still saved in the empty mail application .
( 6 ) When you configure the mail account by taking cursor on top menu bar > click on add account > choose a mail provider and select the box and click on continue > add new web mail address > click on next > and type the password > and click on done you will be joined to the new server say yahoo ( that is still empty for your mail account as you recently joined this new server and no data is saved on their server , but still the mail folder " import " is in the mail application .
You can scatter the mails in the desired mail boxes .
Note : While performing these steps the fans will start running and the system will heat up but this is normal as the the data is transferred , and it will take time to stop the fans and system will cool down .
Note : the second method is even you delete the corrupted account by going to system preferences > internet accounts , the mails are stored in www.icloud.com and they will not be lost unless you permanently delete them , see this article Add email accounts in Mail on Mac - Apple Support
You can also add mail account in internet accounts .
Use your Internet accounts on Mac - Apple SupportUse your Internet accounts on Mac – Apple Support
Change Internet Accounts preferences on Mac - Apple Supportsupport.apple.com › en-in › guide › mac-help › mac
Add an internet account - Apple Supportsupport.apple.com › guide › mac-help › mac