Tuesday 18 December 2018

Deleting a single email from all mailboxes in GSuite using GAM tool

Or, How to delete a single email using GAM tool in GSuite?
Or, Delete a single email from all mailboxes in GSuite
Or, Email sent by mistake to all users, want to delete the specific email from everyone’s mailboxes

Descriptions: This is a very common scenario where someone in your organization sent an email by mistake to a ‘Distribution List’ which may contain 100-1000 or even more users. Now the role of administrator starts here.
The requirement here is to delete this particular email from every user’s mailbox without letting them know about this or without their intervention.
Take it easy, you can use below GAM command to get it done.

Prerequisite: You should have the Message ID of the email that you want to delete

Steps:
Open GAM CMD with administrative privilege, and Run below command to delete the specific email
gam all users delete messages query rfc822msgid:<Message_ID> doit

Example:-
gam all users delete messages query rfc822msgid:CAhshdghs79jo_J6XZimV_tywxjhshgQh2cZV-mQ@mail.gmail.com doit

Result:
-----------------------------------------------------------------------------------------------------------------------
Got 1 messages for user tsadmin@techiessphere.com
delete 1 messages
Got 0 messages for user tsuser@techiessphere.com
would try to delete 0 messages for user tsuser@techiessphere.com (max 1)
----------------------------------------------------------------------------------------------------------------------
Here in the above result section, you can see that the email was deleted from one affected user where it was found matched, and the command skipped the second user where there was no matched content/email found.


Cheers, please write me back if you have any query or feedback on this.

8 comments:

  1. I am glad that i came to see this, really loved it. Thank you for sharing it. SwissMailbox is offering the Virtual Address, Handle Mail and Swiss Mailing and secure scan service Address in Switzerland in the cost effective prices.For more mailing address switzerland

    ReplyDelete
  2. A very awesome blog post. We are really grateful for your blog post. You will find a lot of approaches after visiting your post. www.hotmail.com entrar

    ReplyDelete
  3. A webmaster can now use this information with ease as the URL logging feature will know where the information is and pages will not have to be loaded and searched individually. email extractor from google search

    ReplyDelete
  4. I admire this article for the well-researched content and excellent wording. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much. email extractor mobile

    ReplyDelete
  5. Hey techiessphere team,

    i follow with above step on my GAM super admin but i get below errors, some one please help this issues.

    ERROR: User 12121@domain.com : unauthorized_client: Client is unauthorized to retrieve access tokens using this method, or client not authorized for any of the scopes requested.

    ReplyDelete
    Replies
    1. This error is possibly from the GAM authorization on your tenant and on your admin account that you are using to perform this action. Please ensure that the GAM authorization is done properly and then try again.

      Delete
  6. Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info. Zendable

    ReplyDelete