Quickie on how to block a specific email

JackGoa

Member
Hey guys. Long time no see.

Once in a while I get annoying emails from my "fans in the 'stans".

I have the obvious and usual spam checks in place, including reCaptcha.

I think these ones are submitted manually, unless it's a really clever bot.

Seeing as it barely ever happens and it's usually the same email address that will go on for weeks,
I've been thinking of a simple way to block them without them knowing, like a "soft fail" or something.

If I had to make use of the conditional field in the Email Form Plugin and I did something like below, would that stop the email from sending? I know it will still save in the database and I don't really care too much about that as the duplicates will eventually get filtered out any way.

*this does not happen often, I'm ok with manually adding more emails to the array when they show signs of getting a bit over excited.

PHP:
$knownSpammers = array('foo@spam.com', 'foobar@spambar.com');

if (in_array({tablename___elementname_raw}, $knownSpammers) {
return false;
}

Is there maybe a better way I might be missing? Fabrik does not look at the Contact form rules in J!'s Contact component hey?
 
Well, you can test your code with one of your own email addresses, obviously.

However, I find the easiest and most effective ways outside of Fabrik:
- Probably your mail server has tools such as SpamAssassin or SpamExperts where you can blacklist email addresses.
- If not (against all odds), your server's webmail will probably let you blacklist email addresses, effectively preventing them from hitting your inbox.
- If that not either (??!!), then you email client should let you set a filter rule that sends certain email senders straight to the trash bin.
 
Well, you can test your code with one of your own email addresses, obviously.
Did you? Your code looks ok (beside of missing quotes around the placeholder).
 
Hey @troester, hope you're well.

Thanks, I always forget the placeholder is not variable.

I haven't tested it, I'm assuming it's probably going to work. My question really was whether anyone might know of a better, more elegant solution? In retrospect, could have probably phrased it better. :confused:
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top