google apps script – How to automatically forward Gmail messages when a label is applied?

I have found this question that is answered:

How can I automatically forward Gmail emails when a label is applied?

However I’m using that exact script and have replaced the label and recipient with my information, and it works intermittently, if at all.

I’ve tried formatting the label text string differently, changing the interval from 5 minutes to 1 minute and back, and if it does work, it misses a lot.

One note: I took out the “+’after:’ +timeFrom” snippet and ran it once, and it was forwarding everything in the folder before it gave me a server error (which is understandable, there are about 6600 messages in the label) so I’m wondering if it might have something to do with the timing coding?

Another note is that I’m trying this on a G Suite email, rather than a regular Gmail account, so I’m not sure if that would affect anything.

Here’s what I have currently:

  function autoForward() {
  var label = 'Questionnaires/Agent Logins';
  var recipient = '';
  var interval = 5;          //  if the script runs every 5 minutes; change otherwise
  var date = new Date();
  var timeFrom = Math.floor(date.valueOf()/1000) - 60 * interval;
  var threads ='label:' + label + ' after:' + timeFrom);
  for (var i = 0; i < threads.length; i++) {
    threads(i).getMessages()(0).forward(recipient);  // only the 1st message

I’ve tried reformatting the “label” variable to be:


questionnaires-agent-logins, which is the format you see in the Gmail search bar when viewing the label.

I’m somewhat familiar with javascript and the general logic of programming, so this code more or less makes sense to me, and I don’t see why it would be having trouble.

I would really really appreciate any help with this, as it could save my boss up to 3 hours a day if I could automate this for him.

P.S. I also have tried the IFTTT recipe mentioned and no dice either.

graphs – 2-Approximation algorithm for for messages across a cyclic network

There are $n$ computers arranged in a cycle ($1,2,3..,n,1$), with undirected edges between adjacent computers. There are $m$ messages that need to be delivered. Message $i$ ($1 le i le m$) has to be sent from computer $s_i$ to computer $t_i$. There are two ways to deliver a message $i$: clockwise from $s_i$ to $t_i$ or anti-clockwise from $s_i$ to $t_i$. Aim is to send all messages in such a way that the number of messages going through the most frequently used edge is minimized. We need to devise a $2$-Approximation algorithm for the same.

Let $n=4$. Let $m=2$. And let $s_1=1,t_1=4$ and $s_2=2,t_2=3$. Then if we send message $1$ in the following way: $1 to 2 to 3 to 4$ and message $2$ as: $2 to 3$. The most frequently edge used is $2 to 3$, through which $2$ messages go. We can do better than this.

Message $1$: $1 to 4$ and delivery of message $2$ remains same $2 to 3$. Then both the edges are most frequently used. But only $1$ message goes through most frequently used edges.

My approach 1
For every message with probability $frac{1}{2}$ send it in clockwise direction and with $frac{1}{2}$ in anti-clockwise direction.
But this gives a bad performance, which can be seen with the help of the following example:
$n=10000$, $m=200$ and $s_i = i,t_i=i+1$ for $1 le i le 200$. Then the optimal answer is $1$ (ie. every edge has at most $1$ message going through it). Which can be achieved by sending message $i$ as $i to (i+1)$.
Also this is the only way to achieve the optimal. If anyone of the messages were sent in the other direction the answer increases. For eg. if $x$ of the $200$ messages were sent in other direction, all these $x$ would use say edge $800 to 801$. So the answer would be at least $x$. Thus in this case the random solution picks the optimal arrangement with only probability $frac{1}{2^{200}}$, which is very less and for other arrangements answer gets bigger.

My approach 2
I turned towards greedy. Where for message $i$ we send it in the direction where it will travel through lesser number of edges, ie. we send it along the shorter route. Then I argued as below

(I consider $n$ odd for now, and also don’t consider some other corner cases)

For an arbitrary input $n$, $m$ (and the respective source and sinks) let the optimal be $p$ (that is $p$ is the number of messages going through the most frequent used edge), then the optimal arrangement cannot have more than $2p$ messages for which longer routes were chosen. Reason: longer routes have at least $frac{n+1}{2}$ contiguous edges, for example for $n=7$, if I list all thecontiguous subsets of size $frac{n+1}{2}$ (the possibilities of longer route)

1,2,3,4 \
3,4,5,6 \
4,5,6,7 \
6,7,1,2 \
7,1,2,3 \

and lets say $p=1$. Then as first two subsets (nearly the half) have a common element $4$, and so do the last three subsets (again nearly the half) have common element $7$ (this is true for arbitrary odd $n$).
There can be a case where (in the optimal arrangement) $p$ of the longer routes lie in first half of subsets and another $p$ of longer routes in the second half of subsets. But if more than $2p$ are there. There would be at least $p+1$ in a single half of subsets, making the answer $p+1$ which is a contradiction.

And as changing direction of a message can at worst increase the answer by $1$. The greedy should have answer $le 3p$ (change all $2p$ longer routes to short, to get to what greedy outputs).

But I seem to be stuck beyond this. As this gives approximation factor of $3$ (I did not consider $n$ is even case, as I think if odd case is handled it will be just about the corner case of source and sink being at exactly $frac{n}{2}$ distance).
Maybe in my reasoning I overestimated somewhere.

I had also tried tried to obtain bounds using weak duality by expressing problem as LP relaxation. Assuming my working was correct what I could get is $1le$ optimal. Which is trivially true.

PS: I would highly appreciate hints only.

Can phone be set to only make sound for calls (not even text messages)? Can it only make sound for certain numbers?

I work on call and need to have my ringer on for phone calls. But I would like everything else silent for when I sleep. How can I set it so not even text messages make a sound? I’m using Lineage OS 16. It would be even better if only certain numbers can make the phone ring. Is there an app or setting that can do this?

log messages – User Import module’s “Send email” option is not reported in system log

When importing batches of users as .csv files, the module’s option “send email” appears to be working inconsistently. Some users receive the email, others don’t and can’t find it in Spam. Repeating the import doesn’t always solve the problem.

In addition to the mystery of this inconsistency, the email send-out by the module does not show up in the system log, whether successful or not. Therefore there is no way to verify if it was sent, except to depend on the user’s report of receiving or not receiving it. (Other kinds of email sends are recorded in the log; for example one that we set up in Rules.) Is there a solution for addressing this?

What can i do to get my cloned WhatsApp to show messages with names from my contacts (address book) in a Huawei 40P lite smart phone?

I transferred my phone contacts from my old Samsung phone into a new Huawei 40P lite. The phone doesnt come with pre-installed WhatsApp. I then cloned WhatsApp from the old Samsung phone. The address book is showng pretty well but the names in my contacts havent synched with the WhatsApp. What should i do to activatte the address book (contacts) so that the WhatsApp messages should be showing the names of the people in my contacts list.

Telephone messages

If writing the script yourself seems a bridge too far, then we’ll do it for you! Our team of copywriters are expert in crafting audio scripts for radio, TV, Cinema, Internet & Telephone messages.


data leakage – Does Whatsapp’s link preview on the link messages leaks information?

WhatsApp client makes http GET request to the site sender types in, in order to fetch site’s meta properties that show up in preview.

<meta property="og:title" content="Information Security Stack Exchange">
<meta property="og:description" content="Q&A by infosec enthusiasts">
<meta property="og:image" content="">
<meta property="og:url" content="">

The http request is not protected by E2EE so it can be sniffed by MITM. If the requested site is not using https, the query string and site’s meta content can also be seen by the observer. If the sender forgets to put space between the query string of the URL and the next immediate word after the query string, that word is leaked as being a part of query string. ... text ... message ... contents ...

The SECRET will be queried to the requested site. WhatApp client also tries to query sites that does not exist as long as the typed word matches with the regex of URL. As for the requested site, it doesn’t know who is requesting it and to whom the URL is being sent.

If Bob tricks Alice to type URL of the web service he controls, he will be able to learn her IP Address and probably her location too. To fix this, Signal uses proxy server for link previews.

syslog shows a bunch of FF messages

When I run dmesg I see a bunch of these errors,

FF SUSPEND INT                  0 ?x09
FF WAKEUP                       0 ?x09
FF GAD SUS                      0 ?x09

What do these mean? Is this normal?