Comments on: How to Filter Gmail Headers & Stop “Via” Spam https://www.geektron.com/2014/01/how-to-filter-gmail-using-email-headers-and-stop-via-spam/ Web Tips and Other Nerdiness Sat, 30 May 2020 01:59:22 +0000 hourly 1 https://wordpress.org/?v=5.4.16 By: Sir Matthew https://www.geektron.com/2014/01/how-to-filter-gmail-using-email-headers-and-stop-via-spam/#comment-32 Fri, 05 Jan 2018 22:31:00 +0000 http://www.geekmadness.com/?p=9#comment-32 Is there a way to setup a script to SEARCH for these? I don’t want them to be marked as spam. I view them but don’t always delete right away and I want to mass-delete them.

]]>
By: Chris Z https://www.geektron.com/2014/01/how-to-filter-gmail-using-email-headers-and-stop-via-spam/#comment-16 Wed, 25 Nov 2015 18:06:00 +0000 http://www.geekmadness.com/?p=9#comment-16 In reply to Emil Stahl.

Thanks, glad it worked for you! Sure, yeah you can extend it. Basically all it’s doing is searching for a specific string unique to the unwanted emails. It then sends any emails in which it finds the string to your spam folder with the “GmailApp.moveThreadToSpam(threads[i])” line.

If you want to have it search for multiple strings, like different domains for instance, you can add them in with OR operators in the “if(body.indexOf(“X-Forwarded-For: email@example1.com email@example2.com“)>-1)” line.

Alternatively, you could add additional “else if” statements underneath the above line. I’m no coding expert, so there may be a more efficient way to do it, but I hope that points you in the right direction.

]]>
By: Emil Stahl https://www.geektron.com/2014/01/how-to-filter-gmail-using-email-headers-and-stop-via-spam/#comment-15 Wed, 25 Nov 2015 01:47:00 +0000 http://www.geekmadness.com/?p=9#comment-15 Nice @czalamia:disqus !

Could you extend the script to support different headers, like a list of domains or IPs? (I tested it, it worked fine with one)

]]>
By: Dennis Lee https://www.geektron.com/2014/01/how-to-filter-gmail-using-email-headers-and-stop-via-spam/#comment-9 Sat, 11 Jul 2015 12:39:00 +0000 http://www.geekmadness.com/?p=9#comment-9 I also can’t find the X-forwarded-for part. But there is a dmarc=fail line. You can paste that in also. The spammers faked my own email address so that line will always be a failed check.

]]>
By: Chris Z https://www.geektron.com/2014/01/how-to-filter-gmail-using-email-headers-and-stop-via-spam/#comment-7 Fri, 13 Mar 2015 01:07:00 +0000 http://www.geekmadness.com/?p=9#comment-7 In reply to jg30328.

It’s possible it’s just not there. Are you sure it was sent via another domain? Try a Ctrl-F search for the domain it was sent via. Maybe it’s listed under a different header and you can use that instead. As long as you are copying and inserting a text string that is unique to the “via” spam then it should work just the same.

]]>
By: jg30328 https://www.geektron.com/2014/01/how-to-filter-gmail-using-email-headers-and-stop-via-spam/#comment-6 Thu, 12 Mar 2015 18:23:00 +0000 http://www.geekmadness.com/?p=9#comment-6 I still can’t find the “X-Forwarded-For” info in my “show original” page. I’m not sure what to copy and insert…

]]>
By: Voidheartd https://www.geektron.com/2014/01/how-to-filter-gmail-using-email-headers-and-stop-via-spam/#comment-4 Tue, 23 Sep 2014 18:48:00 +0000 http://www.geekmadness.com/?p=9#comment-4 Thanks for this. It’s silly that google would show us the via domain but give no way to filter by it. I very rarely see spam in my inbox, and it is always coming from the same via domain.

]]>
By: unloco mqx https://www.geektron.com/2014/01/how-to-filter-gmail-using-email-headers-and-stop-via-spam/#comment-3 Tue, 23 Sep 2014 06:02:00 +0000 http://www.geekmadness.com/?p=9#comment-3 A similar script that accepts an array of domain names
http://pastebin.com/Y9HhE1jf

]]>