Note: everything below can be generally applied to most any IMAP mail application, including Outlook, Thunderbird, and the version of Mail included in iOS. Only the details vary. Unfortunately, no standards exist as to what IMAP special folders should be called, so every mail host and IMAP client does things a little differently.
When setting up an IMAP account with Apple Mail, it looks for folders on the server to be used for Sent, Drafts, Trash, and Junk. If it doesn’t find folders named similarly to those, it will create folders for those purposes.
If you’ve already got folders on the server that you want Apple Mail to use — for example Gmail puts its special folders inside the [Gmail] folder — you can uncheck the “Take Account Online” button when you complete the setup wizard, so that nothing happens. Then you can go into account preferences and under Mailbox Behaviors uncheck all the boxes.
Then take the account online, and it will only load up what folders are there without creating new ones. Then you can go back to account preferences and check the boxes — but now folders won’t automatically be created until they are needed.
But before that happens, you can click on each special folder on the server, and then in the Mailbox menu, choose the appropriate item under “Use This Mailbox For”. The special folder will disappear from the standard folder list, and will instead be the folder behind the items in the “Mailboxes” section at the top of the list.
And, if Mail did already create a folder of its own, it will appear in the folder list below, where you can delete it. Or if you deal with it later and have two Sent folders with stuff in them because you use both Mail and webmail, you can figure out which one is the default one your host uses, and drag everything from the one Mail made to that. Then use that one as the special Sent folder, and delete the now-empty one that Mail made.
The Junk folder may require an additional step. If you don’t have junk mail filtering enabled, then Mail will ignore your requests to use any folder as the Junk folder (an error notice explaining what’s going on would be useful here, fellas). But if you’ve already got your mail host (e.g. Gmail) filtering your spam for you, you may not want to use Mail’s less-accurate built-in filtering.
Here’s the trick to make it work: enable Junk Mail filtering, and make sure the option set is “Move it to the Junk mailbox”. Then in the main window, choose which folder you want to use for Junk mail as described above. It will move up top.
Then, return to account preferences, and under Junk Mail, change the option to Perform Custom Actions. Then click Advanced… and change the rule from “Message is Junk Mail” to something that will never be true, e.g. “Message Type is RSS Article” (if you don’t use Mail for RSS feeds), or “Date Sent is greater than 1000 days old”. Now you can have Mail recognize your mail host’s spam folder without actually doing its own filtering.