Gmail waste and disinfection. How to take advantage of the applications programs to make your life easier!
Get unwanted email messages from a specific sender and you cannot resist garbage checks? This guide will help you to remove it forever.
Note: This article may contain Amazon links. Nothing will be imposed to click on these links, but you will support Hackernoon if you choose to buy something through one of these links.
This post is slightly different from my usual content. Although it includes an excerpt from software instructions, it is designed for a lower technical audience, and thus floods screen shots.
I received an inhuman cry for help. There is a couple who divides and one of the partners sends an email with abusive email. The reception device created a Gmail candidate to activate messages, but the policy of keeping Gmail is 30 days, and at moments of weakness, you cannot resist clicking in the garbage and reading it, which exacerbates the problem in a understandable way.
Looking at the violent nature of email messages, I did not want to risk deleting possible evidence, so my suggestion was to create a process: it would:
-
Automatically forward on emails from this sender to a lawyer
-
Delete these emails and disinfect them from trash, bypassing the Gmail policy for 30 days
Create a title forward
In this particular case, the front address will be the lawyer. Go to Gmail settings, select “Restoring and Pop/IMAP” and click “Add a Restore title”.
Remember to continue to redirect the disabled, we just want to redirect emails from one sender
After adding an address to the front, Gmail will send an assertion to this email – your lawyer – asks for permission. Once you are given, you can continue to the next step. Just remember to stay Forwarding
helpless!
Create a new candidate
Here we will determine that all emails that come from [email protected]
It will be sent to [email protected]
Then send to the trash.
Go to the “banned candidates and addresses” and then click “Create a new candidate”.
The form will be opened to add filters. Want All messages From this specific address that is filtered, so just add.[email protected]“To the candidate and choose” Create a candidate. “
Now you will have to determine what the candidate wants to do exactly. In our specified case, we will redirect email to the lawyer, so select this box. We also want to delete the email, as well as mark it.
This solves half of the problem, which is the most obvious part of the process. The difficult decisions come after that, and how to disinfect these emails from the garbage immediately so that we do not run in reading it. Google Rescue Text Program Appness!
Create a text program for Google applications
Google Drive provides a feature that allows you to host and operate text programs. Although most developers are aware of this, energy users may not be aware of it. For the task, this feature is completely perfect.
Go to https://script.google.com/, follow the authentication procedures, if necessary, then click on a “new project”.
You are now on your project screen. You will need to interact with Gmail so let’s add this service. Click the big +
Besides “services”, search for Gmail API
And add it.
Now, replace myFunction
With this piece of the code. Remember, You must change [email protected] To the actual title you want to remove from garbage!
function deleteMailsFromTrash() {
var gmailSearchString = `in:trash from:[email protected]`
var threads = GmailApp.search(gmailSearchString);
const n = threads.length;
if (n <= 0) {
Logger.log("No threads matching search string \"%s\"", gmailSearchString);
return
} else {
Logger.log("%s threads matching action **%s**", n, gmailSearchString);
}
for (var i = 0; i < threads.length; i++) {
var thread = threads[i];
Logger.log(`\t Thread# ${i} [ID: ${thread.getId()}]: [message : ${thread.getFirstMessageSubject()}] deleted`);
Gmail.Users.Threads.remove('me', thread.getId());
}
}
This text program will be discussed in the trash of email messages from [email protected]
And delete it
You should look like this screen now. Go ahead and prepare “Project Without Title” to a more feasible thing, such as “cleansing specific messages from Trash”. Change too myFunction
to deleteMailsFromTrash
Then hit Run
.
You are asked to give permissions to access your Google account.
Now you’ll get a mistake! Google has not been achieved from this app. Although the developer was not verified, it should not be used. In this particular case, You are the developer! For this reason, I did not release this solution as a predetermined. It is more safe for the symbol to work on your side.
Click this, “Go to the Certains of the Specified Post (Usafe) mail messages” and then continue. On the window of the applications program, you will see the first implementation of your text program.
In my case, because I do not have an email from [email protected]
In “Trash”, the program is simply printed “No indicators of interconnection to match the search chain. In your specific condition, you may see that some emails have been deleted! I did well.
Now everything works, but we still need to prepare an operator to automatically run the text program, ensuring that unwanted emails in time.
Trush composition!
You will need a time -driven trigger. Something is cleared on a timetable to ensure that emails that were placed in the garbage by the candidate you created above before you can reach them.
Click the watch on the left sidebar, then on the large blue button at the bottom of the right, which says “Add the operator” and form the filter according to the image below.
You have set this textual program to run it every 5 minutes, but you can adjust the timeline to less than one minute if you prefer it. Modify as needed. Determination of a tallest time separation is a tallest way to think about the Google infrastructure.
Now, to ensure that things are working as expected, on the left sidebar, click the executions. You will see a table with all the times when the text program works. As you just applied it, there are likely to be two to three. One guide Type: Editor
When implementing it manually, then a other couple of trigger based on the named time Type: Time-Driven
.
Although the challenge that may be the movement in these situations, it is important to remember that protecting your health is a priority.
While technology can help us reduce harmful deviations, recovery takes time and self -assembly. Stay strong, take care of yourself, and do not hesitate to request support.
You deserve peace and recovery through this process.
I don’t know if you have tried to blame before, but it is something that frees my mind.
It simply walks while carrying weight. Originally, a military exercise, transportation is popular with its benefits for physical health, stability and mental well -being. Try it!