Unable to delete IMAP mail account in Yosemite
This is not my Fix I found it here

Find and Open the Folder Where Mac OS X Mail Stores Mail. To open the folder where Mac OS X Mail keeps your messages:


Open a Finder window.
Select Go | Go to Folder… from the menu.
Type ~/Library/Mail/V2


Delete all the folders and files in this directory

Find and Open the Folder Where Mac OS X Mail Store Mail. To locate the folder where Mac OS X Mail stores mail:


Open a Finder window.
Select Go | Go to Folder… from the menu.
Type ~/Library/Mail/


Delete the folders. Now all the Accounts will get deleted from mail