If you've accumulated thousands of emails in your Apple Mail program and it seems to get more and more sluggish, then you may need to do a little database cleanup.
The Envelope Index is really just a small SQLite database that the Mail program uses to keep track of a lot of mail stuff. Before you do the clean up, go to your ~/Library/Mail/ folder and check out the size of the Envelope Index file.
Quit Mail.app.
Launch Terminal and run the following command:
/usr/bin/sqlite3 ~/Library/Mail/Envelope\ Index vacuum
As it runs, you will see some files come and go in ~/Library/Mail/ When the command has finished running in Terminal you will be brought back to the prompt. Take a look at the size of your Envelope Index now. if you've never done this before you may notice a HUGE difference. One user I ran this for started out at 50MB and it cleaned up to about 12MB. His Mail program was MUCH faster after I did that. YMMV.
You shouldn't need to run this very often. I would only suggest doing it if you notice the Mail program getting really really slow.