The problem here is that Gmail and Mail.app have never really played well together. It is a huge pain in the a$$ to have the Gmail folders appear that way at the bottom. One day apple may fix this. I've suggested it. But they don't listen to me.
The problem is probably that you have some folders enabled in your Gmail preferences that are not showing up in Mail. I'd go into the Gmail prefs (not in Mail, in your browser), and under Labels, remove all the folders that you don't need, and just keep the basics: drafts, deleted messages, junk, notes, and Sent. All these should be enabled with the checkbox for show in imap.
The main gmail mailboxes need to be mapped to the main mailboxes in Mail. The inbox is automatically done. Highlight Sent Messages under the gmail folder. Then go to Mailboxes in the menu, select Use This Mailbox For, and choose Sent. The sent messages folder will be moved to Mail's Sent mailbox. The local Sent folder that was created for gmail will be moved to On My Mac. You can move those messages to the gmail sent messages and delete that local mailbox.
Repeat the steps for Trash, Drafts, and Junk if you want them under the main mailboxes.
Any other folders will stay under the gmail folder. You can go to the gmail website and choose which folders you want shown in IMAP. There are many discussions on using gmail with Mail and searching the discussions will probably answer most of our questions.
Also google topics you need help with. Many articles are written with explicit instructions on setting up gmail with apple mail.
One thing I did notice in your picture is that your gmail folder is not expanded. Those folders should be under the main folder. Expand the triangle on the side of it to show what is within the main folder.
There's nothing for Apple to fix. Apple works fine with standard IMAP.
Gmail's IMAP is anything BUT standard IMAP. You have to manually tell Gmail to export labels as folders, and show them in IMAP, and you must configure that on the Gmail site, buried way down in preferences.
Then if you move something in Gmail via mail, it will change the labels. And of course, if you delete something in Mail... nothing happens, because Gmail ignores IMAP delete commands.
All *standard* IMAP servers work perfectly well with Mail. But Gmail... yuck.
Currently Being ModeratedAug 16, 2013 9:35 AM (in response to Glenn Leblanc)
Sorry, Glenn, but a bit of time responding. I'm unable to follow your suggestion as I can't distinguish when I'm to be in Mail and when in gmail and/or I cannot find the menu commands in Gmail. Highlight Sent Messages under the gmail folder. Then go to Mailboxes in the menu, select Use This Mailbox For, and choose Sent Am I in Gmail at this time? If so, what "Menu" are you referring to? How do I find that?
Having Gmail display folders below my Mail folders is a bit of a nuisance, but not being sure that all my messages are importing to Mail or to my phone is more concerning. I can't trust that I'm getting everything by using my preferred access to email. E.g. when I read a message on my iPhone, then Mail doesn't always pull that message in. However, if I go either to the special gmail folders at the bottom left below the Mail folders I can find the message, or of course into Gmail on the web.
Is this mapping you and the others speak of the way to fix this discrepancy?
Thanks for your patience with me.
Currently Being ModeratedAug 16, 2013 10:14 AM (in response to tmikeporter)
You should be in Apple Mail to map the gmail mailboxes (the gmail folder in the sidebar) to Mail's main mailboxes. Use this Mailbox for is in Mail's menu at the top of the screen under Mailboxes. Mapping the gmail mailbox to Mail's mailbox will move them from the gmail folder to the main mailboxes.
The mailboxes shown under gmail in the sidebar are gmail's imap folders. Only the main mailboxes (sent, trash, drafts, junk) can be mapped to the main. Whatever imap folders you want shown in the sidebar for gmail will be controlled from the gmail site under settings there.
Currently Being ModeratedAug 16, 2013 10:31 AM (in response to tmikeporter)
As Glenn pointed out, there are many articles on making Gmail work with Mail.
Currently Being ModeratedSep 13, 2013 7:41 PM (in response to Glenn Leblanc)
"Highlight Sent Messages under the gmail folder. Then go to Mailboxes in the menu, select Use This Mailbox For, and choose Sent. "
I just tried this, but the option is greyed out. What next?
Currently Being ModeratedSep 16, 2013 10:41 AM (in response to billbennettnz)
If you did this correctly and the option is greyed out, that means that there is already an IMAP mailbox assigned to Mail's Sent mailbox for that account. It could be a different mailbox such as drafts that was assigned to the Sent mailbox incorrectly. If you go to Mail's preferences under Accounts, select that account and choose the Mailbox Behaviors tab. If the Sent messages settings are stored on the server, you can uncheck that option to clear it. The server mailbox associated with it will be pushed back out to the IMAP folder for that account.
Then you should be able to map the correct Sent Messages imap mailbox to Mail's Sent mailbox.