Question

Is there a way to bulk forward messages in Gmail?


Badge +2
  • Active Member / Beta Tester
  • 248 replies

Let’s say - totally hypothetically - that an admin disabled auto-forwarding on an account, and it turns out that account was receiving messages through an extremely convoluted pipeline of groups & forwarding them along to a ticketing system, is there a way to bulk select & forward? I know the Gmail interface doesn’t have that, and Groups doesn’t seem to either.


29 replies

Userlevel 3
Badge +1

so you are looking to select the messages in the inbox that didn't get forwarded?


Open Thread in Slack
Badge +2

Yeah


Open Thread in Slack
Userlevel 5
Badge +2

c55bff8afb27ec02.png !!


Open Thread in Slack
Userlevel 5
Badge +2

(I think?)


Open Thread in Slack
Badge +2

I currently see only two options - the team responsible can filter by date in the last Group in the chain & forward them one at a time, or I can hackerman the user account & do it myself. Both are shit options.


Open Thread in Slack
Userlevel 5
Badge +2

yea I think Apps Script should be doable -- if you were to drop all the messages into a label you can use a script to retrieve the emails in a label and forward them along


Open Thread in Slack
Badge +2

hmmm


Open Thread in Slack
Userlevel 3
Badge +1

1. 0366f7b39b11255a.gif print messages with query.
2. 0366f7b39b11255a.gif send messages using the CSV file that get generated in step 1.
yea or apps script. be careful not to hit rate/sending limit though. 1 message per second.


Open Thread in Slack
Userlevel 5
Badge +2

76d2a1a300707272.gif


Open Thread in Slack
Badge +2

You know what this community needs? A Hire a Consultant button that you can click, select a community member who has a potential solution, and process a payment to that person.


Open Thread in Slack
Badge +2

Or maybe I just need to seek out some additional training ea1f1ada2d93b5c9.png


Open Thread in Slack
Userlevel 5
Badge +2

who needs a consultant when you're in the presence of 76d2a1a300707272.gif !!!!


Open Thread in Slack
Userlevel 5
Badge +2

haha but in all seriousness, I can take a shot at writing this up and publishing a guide on 1d66a85acb9be015.png


Open Thread in Slack
Userlevel 5
Badge +2

and then everyone wins(?)


Open Thread in Slack
Badge +2

Mostly because there are times when I see the direction the proposed solution is going, but don’t know how to implement. And I don’t like to come to a community to ask other people to do the work for me.


Open Thread in Slack
Userlevel 3
Badge +1

im always to happy to answer any 0366f7b39b11255a.gif questions. makes me better at my actual job haha


Open Thread in Slack
Userlevel 5
Badge +2

I see what you mean, but there's a good chance somebody will be seeking the same thing in the future... so in my eyes there's a ton of value in building and posting in here since it's for the community and not for just one person


Open Thread in Slack
Userlevel 5
Badge +2

let me see what I can throw together @ccoy2


Open Thread in Slack
Userlevel 3
Badge +1

need an emoji for your apps script wizardry


Open Thread in Slack
Userlevel 5
Badge +2

create a one trick pony emoji, apps script is my only trick ūüėā


Open Thread in Slack
Userlevel 5
Badge +2

here's the code for anyone interested:

var sheetId = ""
var sheet = SpreadsheetApp.openById(sheetId)
var label = ""
var forwardToAddress = ""

function getMessages() {
  var messages = GmailApp.search("label:" + label)
  for (var i = 0; i < messages.length; i++) {
    var thread = messages[i].getMessages()
    var message = thread[thread.length - 1]
    sheet.appendRow([message.getId(), message.getSubject(), message.getFrom()])
  }
}

function forwardMessages() {
  var messages = sheet.getRange("A2:A" + sheet.getLastRow()).getValues()
  for (var i = 0; i < messages.length; i++) {
    var messageId = messages[i][0]
    var message = GmailApp.getMessageById(messageId)
    message.forward(forwardToAddress)
    sheet.getRange("D" + (i + 2)).setValue("X")
    Utilities.sleep(1000)
  }
}

Open Thread in Slack
Userlevel 5
Badge +2

I'll probably write up a guide for how to use it


Open Thread in Slack
Badge

Also, my Gmail does have "forward several emails as attachments". But if the receiver can't manage that, then som GAM/GAS magic that forwards the emails as separate emails is perhaps necessary.



Open Thread in Slack
Badge

@mike-bc just add three comments in the code. They can all be "Set this value...".



Open Thread in Slack
Badge

Ah, the forwardMessages function doesn't call the getMessages function. Well, then this simple explanation would be enough, don't you think? Also, a tiny change of order of the vars.

// Set these three var values
// Mark all emails to be forwarded with the same label
// Then run the functions getMessages, followed by the forwardMessages
var sheetId = ""
var label = ""
var forwardToAddress = ""

var sheet = SpreadsheetApp.openById(sheetId)



Open Thread in Slack

Reply