Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

One of my Gmail accounts receives too much spam and I want to abandon it and use a new one. For this I want to specify that if any one from my contact lists sends an email to my current email account, which I am going to abandon, it gets forwarded to the new one automatically.

There are more than 160+ contacts, that will take a lot of time to set forwarding filters through settings. Is there a better way to include a contact list and apply the filter on that?

share|improve this question
1  
It sounds like you know how to mass-forward emails in Gmail, and your real question is about using your Google Contacts lists in a search/filter. Maybe change the title to reflect that? –  Matthew Jun 1 '13 at 23:37
    
yes that is what i need to do. –  Hossein Jun 2 '13 at 6:31
add comment

3 Answers 3

Unfortunately, Gmail doesn't allow setting up filters that key off of contact groups or even whether or not an email address is in your contacts. However, since you're not looking to make changes to your contacts once you've set up this filter, there is a way to make your filter contain your current list of contacts in a relatively simple way.

First, it's assumed that you've already set up the email address you're forwarding to and gone through the steps to authorize it.

This also won't work if you have too many contacts, since the filter can only hold so many.

  1. Create a special group that will contain all of your contacts. (e.g., autoforward-people-i-know)
  2. Add all the contacts you want to have messages forwarded (presumably "My Contacts") to this new group.
  3. Create a new filter. In the "From" field on the form, start typing the name of your newly created group. Once it appears in the list, click it. You will now see all of the email addresses in that group are now listed in the field.
  4. Continue the steps to finish your autoforward filter.

If you find you have too many contacts to fit in one filter using this method, you could always just do it multiple times with smaller groups (perhaps those you've already set up). Not as simple as doing it one time, but certainly simpler than doing it for every contact.

share|improve this answer
    
Thanks, but it seems not to be working! When i set the group name consisting 5 addresses, and specify the forward email, nothing happens! How should i know it is set correctly? –  Hossein Jun 3 '13 at 0:16
    
It should create a filter for you that contains 5 email addresses. –  Al E. Jun 3 '13 at 1:54
    
actually when i click on create filter and do as told, just after clicking Test Search, i am taken to the search result page, and there is nothing there! not a single email! –  Hossein Jun 3 '13 at 2:29
    
I don't know what to tell you. It works for me. –  Al E. Jun 3 '13 at 12:14
add comment

This is possible via the Google Script which you can find here

I adjusted the script to make it possible to filter on Label and skip the newest messages. https://docs.google.com/spreadsheet/ccc?key=0Ai8p-jhLBDB2dGtyWVc5cm9MTFZQVks0U2x0QloyN0E&newcopy=true

The code of the script can be found here:

var sheet = SpreadsheetApp.getActiveSheet();
var spreadsheet=SpreadsheetApp.getActiveSpreadsheet();

function getEmails() 
{
  sheet.getRange("A8:C108").clear();
  var label = GmailApp.getUserLabelByName(sheet.getRange(4,2).getValue());
  var threads =  label.getThreads(sheet.getRange(5,2).getValue(), sheet.getRange(6,2).getValue());
  var row   = getFirstRow()+1;
  var firstmessageId=getfirstmsgid();
  UserProperties.setProperty("firstmsgid", firstmessageId);
  spreadsheet.toast("Loading emails..Please wait. It could take few seconds", "Status", -1);
  for (var i = 0; i < threads.length; i++) 
  {

    try{
      var messages=threads[i].getMessages();
      for (var m=0; m<messages.length; m++) 
      {   
        sheet.getRange(row,1).setValue(messages[m].getFrom());
        sheet.getRange(row,2).setValue(messages[m].getSubject());
        sheet.getRange(row,3).setValue(messages[m].getDate());
        row++;
      }
    }
    catch(error)
    {
      spreadsheet.toast("Error Occured. Report it @ http://techawakening.org/", "Status", -1);
    }
    if(i==threads.length-1)
    {
       spreadsheet.toast("Successfully loaded emails.", "Status", -1);
       spreadsheet.toast("Now mark emails to be forwarded by changing the background color of the cells to green. Then select Forward->Forward selected emails", "Status", -1);
    }

  }
  }

function getFirstRow() {
  var start=10;
  return start;
}

function getfirstmsgid(){
  var threads = GmailApp.getInboxThreads(0, 1);
  var message = threads[0].getMessages()[0];
  var firstmessageId = message.getId();
  return firstmessageId;

}

function emailstoforward() 
{

  var row   = getFirstRow()+1;
  var email=  sheet.getRange(3,2).getValue();
  var isanyforwarded=0;
  var firstmsg=UserProperties.getProperty("firstmsgid");
  var firstmessageId=getfirstmsgid();
  spreadsheet.toast("Please wait while we forward your emails. It could take few seconds", "Status", -1);
if(email!="")
{
  if(firstmsg==firstmessageId)
  {

    var label = GmailApp.getUserLabelByName(sheet.getRange(4,2).getValue());
    var threads =  label.getThreads(sheet.getRange(5,2).getValue(), sheet.getRange(6,2).getValue());
    for (var i = 0; i < threads.length; i++) 
    {
      try{

        var messages=threads[i].getMessages();

        for (var m=0; m<messages.length; m++) 
        {   
          var rowcolor= sheet.getRange(row,2).getBackgroundColor();

          if( rowcolor == '#00ff00' || rowcolor=='green')
          {
            messages[m].forward(email);
            sheet.getRange(row,2).clearFormat();
            isanyforwarded=1;
          }
          row++;

        }
      }
      catch(err)
      {
      }
      if(i==threads.length-1 && isanyforwarded== 1 )
      {
        spreadsheet.toast("Done. Forwarded all messages", "Status", -1);
      }
    }

  }
  else
  {
   spreadsheet.toast("New emails have been found or Emails have been deleted. Updating the Sheet again", "Status", 8);
    getEmails();


  }

 }//end if
else
{
Browser.msgBox("Enter atleast one email address in B3 cell");
}
  }

function clearcanvas()
{
  sheet.getRange("A8:C108").clear();
  sheet.getRange(3,2).clear();
}

function onOpen() {
  var menuEntries = [ {name: "Load Emails", functionName: "getEmails"},
                      {name: "Forward selected emails", functionName: "emailstoforward"},
                      {name: "Refresh Email list", functionName: "getEmails"},
                      {name: "Clear canvas", functionName: "clearcanvas"}
                    ];
  spreadsheet.addMenu("Forward", menuEntries);
}

Cell B2 should hold the forward address, Cell B3 the label name to filter by, Cell B4 the number of conversation to skip (default 0), Cell B5 should contain the number of conversations to download.

share|improve this answer
add comment

Rather use a self hosted mailer; it’s super cheap and has a high inboxing rate. Also eliminates the risk of getting your Gmail accounts banned.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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