This was what worked for me (I don't have mail for icloud)
- Exit the Mail app completely and launch Finder.
- Click on the Go menu and hold the Option key to make the
~Library
option visible on the screen. - Then open the Mail folder and select the V9 version (or older if you’re running an older OS version).
- Next, open the Mail Data folder, and delete all the filters that begin with the
Envelope Index
. - Clear the Mail app from the library as well. Go to
~/Library/Saved Application State/
and removecom.apple.mail
. - Launch the Mail app again. Wait until the app finishes importing your messages.
from: https://appletoolbox.com/apple-mail-stuck-on-moving-messages-mac/