Search code examples
google-apps-scriptgmail

Google purgeGmail script script suddenly turns up in my inbox with the status failed - what are my next steps?


My original question was asked in google's support forum (https://productforums.google.com/forum/?utm_medium=email&utm_source=footer#!msg/gmail/0t_T1zvYzJQ/xCPLQXpYBQAJ), then redirected to their dev support (https://developers.google.com/apps-script/support) which finally redirects to this site when clicked on "Ask a question". So please don't blame me for asking this question here.

Please refer to the first link above for my question. It contains a lot of details and 2 screenshots. I'm copy-pasting them here also but you are free to refer to that link for more details.

I received the following email. However, I don't recognize this "script" or what it means. I wasn't trying to run a "purgeGmail" script. Any idea what this email means or should be my next steps?

Your script, Copy of Gmail Purge - Digital Inspiration, has recently failed to finish successfully. A summary of the failure(s) is shown below. To configure the triggers for this script, or change your setting for receiving future failure notifications, click here. Start Function Error Message Trigger End 1/17/17 12:13 AM purgeGmail Authorization is required to perform that action. time-based 1/17/17 12:13 AM Sincerely, Google Apps Script Need help? Visit the Google Apps Script documentation. Please do not reply to this message. (c) 2017 Google

I checked my account activity and found nothing suspicious. I did change my password about 2 weeks back actually because I received an email alert saying "sign-in attempt was blocked - unusual activity".

However, I'm not sure whether this "purgeGmail" script is a default script gone haywire or is it some kind of custom script setup by someone. If it's a custom script then I'm going to delete it.

When I goto script.google.com it shows me "Triggers for script Copy of Gmail Purge - Digital Inspiration" > 4 options underneat - initialize, install, uninstall, purgeGmail.

Not sure how this ended up in my account. I would like to report this to the authorities so that they can take down this script. But I'm not seeing any link or option to report it to the authorities. (1) Any idea where I need to report it?

(2) Also, any idea whether this is a default script or custom script? If it's custom I'm going to delete it. I click the cross icon. The heading still remains but the 4 options are gone. Then there is a save button. I'm not sure whether I should click that save button. The UI just sucks for this whole thing.

Here's a screenshot for this whole thing. I'm guessing you can open this pic in a new window so that it shows the actual size. Just right-click "open image in new tab" or download and open should work as on most websites.

Screenshot attached here


Solution

  • I figured out what to do in this situation and would like to post an answer here so that it may help someone else too.

    This script has come via some unknown source. I'm not sure how that person got in but google had once given me an alert for my account activity following which I had chaned the password. Here are the steps which I took to remove that script. In other words if you ever get an email from google stating script xyz failed due to lack of permissions then you can do the following steps:

    1) Observe that the script is named "Copy of PurgeGmail". Hence, it is not part of the usual Gmail because had it been so it wouldn't have been named "copy of". This is definitely the work of some person (which you can also see in the screenshots in the question).

    2) The script wasn't running because the permission was missing. So the next step is to go to script.google.com, use your google account to sign-in by clicking on "Start scripting".

    3) On trying to sign-in Google asks you whether you want to create an account in scipt.google.com . If you do get this confirmation then click yes.

    4) Google takes you to the default script editor. It loads a "new script" with only 2 lines showing up in the code section.

    function myFunction() {
    
    }
    

    If this code is not present then add it. To view the trigger settings the IDE requires you to have an error free code. If you have a blank canvas or any errors in the code then the IDE will give you an error and not allow you to navigate away from this page.

    5) Once you've copy-pasted the code above just click on Resources> All my triggers. This should now open a popup that actually shows you the triggers with a delete button (cross button).

    6) Click the cross button and it instantly deletes the script. Click okay to confirm.

    Now the suspicious script is not present anymore and you should not receive any further notifications. Just to be safe double-check your secondary email address to safguard against a second attempt.