Tackle IMAP e-mail not being stored on server
If OS X Mail will not store drafts, junk mail, or trashed messages on the server for an IMAP account, you likely just need to re-establish Mail's link to the designated account folder.
Apple's Mail e-mail client supports a number of different messaging protocols including POP and IMAP, but if you convert an existing account from POP to IMAP then you may run into a problem in which e-mails are longer saved on the server.
MacFixIt reader Bruce recently wrote in with such a situation:
I have recently tried to convert my wife's AOL email from POP to IMAP. I did this by adding a new account in Mail. When she sends messages with the new account, the sent messages do not show up on the server, even though I have checked the box telling it to [make them] do so. I have tried both totally disabling the old account and leaving the account active but not checked. The sent mail shows up in a folder (mailbox) on the computer but not on the server. All works properly with the iPad. I would like the Mail app to work as well as the iPad so they are the same.
Initially it seemed as though some corruption in the account or the way Mail was handling the account was the root cause, which often can be tackled by clearing the account completely and recreating it from scratch (though you may lose some settings and account organization doing this); however, Bruce was able to find a quick solution to the problem without needing to resort to such measures.
By default IMAP accounts will have mailboxes on the server for various temporary items so they can be synced among different e-mail clients configured for the account. These include the main inbox, message drafts, sent messages, junk mail, and trashed items, allowing you to continue your e-mail work flow on different devices that use this account.
Since IMAP accounts are simply folder hierarchies, folders can be created and named at any location in the account; however, this does not mean the account will identify and use it. Therefore, even if you have a folder called "Junk," Mail must be set to identify it as the Junk folder to use.
This was the root of Bruce's problem. When he established the IMAP account, it did not have any designation for the various Drafts, Sent, Junk, and Trash folders, so even though he used Mail's preferences to change the account's settings to move messages to these folders and keep them there for a specified time frame, they were not being synced back to the server.
In order to fix the problem, Bruce simply needed to re-establish the designation for these folders on the server. To do this, just expand the account's directory tree in the Mail sidebar, select the folder to use for Junk, and then assign its purpose by going to the Mailbox menu's "Use this mailbox for" submenu and choosing the "Junk" option. Bruce found that performing these steps for the Drafts, Sent, and Trash folders linked them up properly and allowed Mail to properly sync them with the server as well.