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.

I have this annoying problem in Gmail. Spammers are by-passing the Gmail spam filters and are so clever that I am not able to create a manual filter of my own to block them. They are sending me junk mails from e-mail IDs of the form:

Jewelskart@greatestjewels.in via watchstore.cleanmail.in

Shoppingkart@shoppers.in via watchstore.cleanmail.in

In general,

something@somethingelse.in via watchstore.cleanmail.in

Now, I cant set a filter for each and every mail as they are from different IDs. The common part is the via address which is watchstore.cleanmail.in. But when I try creating a filter with watchstore.cleanmail.in in From field, Gmail doesn't list these emails. In short, the filter is not able to detect via addresses.

Report Spam/Unsubscribe options aren't working.

How can I get rid of these annoying spammers?

share|improve this question
2  
Are you sure you've Report as Spam by clicking the Gmail button every mail you got? This should work for further mails. Btw, never unsubscribe to spam, it will just confirm that your address is correct. –  JMax Aug 24 '12 at 9:30
    
@JMax Thanks for the reply. Though not every mail, but I used to mark many such mails as Spam. And thanks for reminding me about the unsubscribe trap! –  Pavan Manjunath Aug 24 '12 at 9:53
1  
I'm not sure if GMail has this kind of functionality. It would be a good feature for them to add so perhaps suggest it to Google. As for the Report as Spam problem, my thoughts are that it will just block spam from the apparent domain, not the domain it was sent via. Again, this may be a good feature to suggest. –  njallam Aug 24 '12 at 12:22

4 Answers 4

up vote 4 down vote accepted

The reason Gmail's built-in filters won't work in this situation is because they can't be applied to the "X-Forwarded-For" header. That header is where the "via" domain info is stored.

My solution was to use a Google Apps Script to check my inbox every few minutes and automatically filter out messages sent via a specific domain. It actually works really well. Since implementing the script, I haven't had to deal with this type of spam at all. You can read my full walkthrough here: http://www.geektron.com/2014/01/how-to-filter-gmail-using-email-headers-and-stop-via-spam/

share|improve this answer
    
+1,Excellent workaround!! But I couldn't find the "X-Forwarded-For" header. And other "headers-site names" are not in easily searchable formats. For example, "Return-Path: <campaign-value4shop-10213-2596-859268-pavan8085=gmail.com@mails.cratusservices.‌​in>". The culprit domain "mails.cratus.." is embedded inside the header data. Can we use regular expressions to search for strings inside the headers? As of now, I am directly searching for "mail.cratus.." which is good enough for me, but may lead to false positives in future. –  Pavan Manjunath Jun 5 at 4:12
    
string.search() can do regex searching! Now my code works fine! Thanks for your help. Your answer has made me take interest in Google app scripts :) Until Google themselves come up with a feature to block via addresses, I will mark your answer as correct :) –  Pavan Manjunath Jun 5 at 10:04
    
Glad it worked for you, Pavan! I recently started experimenting with Google App Scripts as well, and there are a lot of cool useful things you can do with it! –  Chris Z Jun 10 at 19:31

I have heard from a friend of mine that there is a Chrome extension that can block an email address or even the entire domain all in just one click. I haven't tried it yet but I hope this helps. Here is the link: Block Sender

share|improve this answer

I made a similar script, it checks for "Received From:", you can add as many domains as necessary in the domains variable.

//without http:// etc, just domain-name.com or domainname.com ....
var domains = [
  'secureserver.net',
];

  //This is not the best solution, a better solution would be to add a filter like this for example => From: #domainname.com
  //and then this app would read your GMail filters and test whether it begins with # to apply the next function if so.. but I couldn't find a way to read GMail settings from here

function filterVia() {
  // get all threads in inbox
  var threads = GmailApp.getInboxThreads();

  for (var i = 0; i < threads.length; i++) {
    Utilities.sleep(100);
    // get all messages in a given thread
    var messages = threads[i].getMessages();
    // iterate over each message
    for (var j = 0; j < messages.length; j++) {
      // log message subject
      var content = messages[j].getRawContent();

      for (var k = 0; k < domains.length; k++) {
        //make domain name as regexp
        var re = new RegExp('\\.|\\-', 'gi');
        var b = domains[k].replace(re, '\\$&');
        var regex = new RegExp("Received\: from .*" + b,'gim');
        var does_match = regex.test(content);

        if(does_match){
          //MARK AS READ (maybe spares you an unnecessary notification)
          messages[j].markRead();
          //DELETE THE MESSAGE
          messages[j].moveToTrash();          
        }

      }
    }
  }
}
share|improve this answer

https://support.google.com/mail/answer/6579?hl=en

http://mashable.com/2012/06/22/gmail-filters/

My suggestion is try creating filters.

share|improve this answer
    
Can you give a bit more detail on what needs to be done? Link-only answers aren't as helpful as giving a recap here of the required action. Also, if the links go down, there's still something helpful for future visitors. –  Andrew Lott Jan 17 at 19:46
    
Nah that doesnt work –  Faiz Mar 25 at 17:20

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.