iOS 8 and Gmail was behaving oddly with regard to a delete action and was still only archiving them. The preferences in account setup was set to to the delete option not archive and the delete folder target was set as Bin on Server.
What happened in iOS 8 Mail app
In iOS8 Mail app in GMail account, a long swipe left (=delete) or short swipe left then choose Trash all had the same effect on message. The message disappeared from inbox and if you looked in the trash folder for the gmail account you may momentarily see message as it syncs with server then the message disappears from Trash folder. Checking directly on server via browser confirmed the message was not in Trash (Bin), however looking at the "All mail" GMail folder (the GMail archive folder) showed message STILL present there.
Compared to how it should have worked as in iOS GMail app
In the iOS Gmail app Deleting a message from Inbox and it appeared in Trash (Bin) folder and remained there; at this time it was also still present in the All Mail folder. However choose then to delete forever option (from within Trash (Bin)) and disappears from both Trash AND the All Mail folder.
Summary of problem
iOS Mail app with Gmail accounts appeared with the TRASH option only to move emails to trash locally but then as soon as sync with server it disappeared from the Trash folder with no further action but remained in the All Folder. This is in effect an Archive. It should work as as the Gmail iOS app - messages deleted or trashed are moved to Trash (from where they can be restored ) and remain there till deleted permanently manually or the Trash can is automatically purged after set time on server.
Solution
Others did not seem to have this problem but took some time to realise the issue was with the type of account configured to connect to the Gmail account, not the settings of that account.
The account was originally setup on iOS 6, upgraded to iOS 7 and then iOS 8. Due to syncing problems with previous versions of iOS and Google many had recommended using the Exchange interface to Google and this is what had done. When the connection was originally established the type of account chosen was "Exchange".
For the GMail account in settings I deleted the Exchange type connection and made new account setup using the Gmail type account option in iOS8. It now all seems to work correctly , so solution was to use correct type account. I cannot remember whether I tested the Exchange version thoroughly in previous iOS versions so cannot say if this is a new problem or also existed in iOS 7. Since identifying the problem and looking at the contents of my All Mail folder it looks as though this was occurring in iOS 7.
Tidying up GMail "All Mail"
Having fixed the issue for future deletes the issue was then how to delete messages in the All Mail folder that I thought I had deleted. It is important to state that I have my own set of user defined folders (labels) where I place messages to be kept and hence do not use the Archive facility of Gmail. The following will delete all messages that exist only in the All Mail folder
- To identify messages in All Mail that do NOT have any user applied labels (i.e. in my folders) and are not in the system folders (labels) Inbox, Drafts or Sent then use the advanced search facility while logged into GMail via a browser. In the Search box type:
has:nouserlabels -in:sent -in:chat -in:draft -in:inbox
- This will present the large number of messages as multiple pages. Select the tick box in header area that will select all the messages on that page and this will also then give you option (if you have selected all on that page) to select all conversations that meet this search criteria - select Yes. With all conversations selected then choose delete.
- At this point they will still show as are in the Trash Bin. Go to Trash bin and scan the messages just to ensure that you have not accidentally deleted a large number of messages you do wish to keep - if there are then undo the delete function. If all is OK and you are happy to get rid of the messages then Empty Trash Bin.