Mail (Yosemite): Use a specific mailbox to store messages on an IMAP server
If your IMAP account stores draft, sent, junk, and deleted (or “trash”) messages on the mail server (set in the Mailbox Behaviors pane of Mail preferences), Mail looks for a specific mailbox on the server. If it can’t find the mailbox (typically because the server uses a different name for it), Mail creates the mailbox on the server or on your Mac and stores the messages there. When this happens, messages you work with on your Mac may not be available in the account’s webmail interface, and vice versa. To avoid this situation, tell Mail which mailbox you want to use for storing messages.
In the Mail sidebar below the name of your account (for example Gmail), select the mailbox you want Mail to use for storing draft, sent, junk, or deleted messages.
For example, below Gmail, select Deleted Messages.
Choose Mailbox > Use This Mailbox As > [mailbox].
For example, choose Mailbox > Use This Mailbox As > Trash Mailbox.
If the mailboxes listed in the menu are dimmed, you didn’t select a server mailbox for the account in the Mail sidebar; make sure you select a mailbox below the account name.
If Mail can’t upload the messages to the selected mailbox, they remain in their current location.