Within Gmail, is there any way to automatically forward an email when I apply a label?

Gmail filters appear to only work with new emails. For my needs, applying the label is a manual process after the email was received.


3 Answers 3


Here is an Apps Script solution. Save it, changing the label and recipient, and set a trigger to run this function every 5 minutes.

It searches for threads with the given label that were created after the last time the script ran. In each, it forwards the first message to the given address.

function autoForward() {
  var label = 'forwardthis';
  var recipient = '[email protected]';
  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 = GmailApp.search('label:' + label + ' after:' + timeFrom);
  for (var i = 0; i < threads.length; i++) {
    threads[i].getMessages()[0].forward(recipient);  // only the 1st message

I add some variations, replacing the line with "only the 1st message":

Forward every message in the thread

var messages = threads[i].getMessages();
for (var j = 0; j < messages.length; j++) {

Forward the last message in the thread

var messages = threads[i].getMessages();
messages[messages.length - 1].forward(recipient);
  • This is definitely a great step forward. I can see how this would possibly solve the problem, however, how would I prevent the script from forwarding the same message again and again. Also, what about old email that I wanted to forward?
    – Aaron
    Commented Jul 26, 2016 at 19:37
  • The after parameter makes sure that the script only looks at the emails from the last 5 minutes, which is after the previous time it ran. As for old messages with that label, you can forward them by temporarily removing ' after:' + timeFrom part, and running script manually once.
    – user79865
    Commented Jul 26, 2016 at 19:40
  • 3
    I modified this a little, and instead of using a date check, I created a label ForwardThis and a nested label ForwardThis/Forwarded. The script looks for any messages in ForwardThis and forwards them, and removes the ForwardThis label and applies the ForwardThis/Forwarded label. Lets me stage any messages, regardless of age, for forwarding. Thanks for the idea! Commented Jan 12, 2017 at 16:23
  • @DaveMartorana Can you share your script? I would like to see an example. Commented Dec 6, 2017 at 21:16
  • 2
    @botenvouwer sure - I use a mac/iOS app called "Deliveries" to track packages, and it integrates with Amazon receipts. All other shipping notifications get forwarded to them for processing. Just so you know what's going on: gist.github.com/themartorana/5fe0c4543e46213686d22580fe47969f Commented Dec 14, 2017 at 15:11

Update: Support dropped due to Google's API change.

The 3rd-party service IFTTT (If This Then That) makes this possible. Use the first Gmail trigger "New email labeled...". It doesn't have to be a new email, just newly labeled. May take a bit to trigger.

  • 1
    I just tested it and it seems to work a treat.
    – ale
    Commented Jul 27, 2016 at 17:10
  • Really worked for me, the applet link is ifttt.com/applets/214039p-auto-forward-mail-from-gmail The only bad thing is it fowards a unique email for every reply of the original email, so big conversations can 'spam' your inbox a little. I don't solve it yet, but it seems like it's possible to configure. It worked fast for me.
    – jards
    Commented Jun 28, 2017 at 15:09
  • @jards I tried and failed to address the trouble you described: I forwarded an email thread with 3 emails in total, and each individual email got forwarded individually when I applied the label. Could you clarify how to possibly configure things properly? I find the IFTTT fields limited, as of telling "thread" apart from "individual emails."
    – llinfeng
    Commented Feb 26, 2019 at 20:46
  • 1
    this used to be a good solution, unfortunately IFTTT no longer supports gmail Commented Feb 20, 2020 at 10:08

No, sorry. The only automation available in Gmail by itself is Gmail Filters, which act on messages as they arrive. There's nothing built-in to Gmail that allows something to happen when a label is added to a message (unless it's part of a filter acting on an incoming message).

Not the answer you're looking for? Browse other questions tagged or ask your own question.