-
AuthorPosts
-
August 22, 2018 at 6:52 pm #1000472
i do get now from mail.ru adresses a lot of spam.
is there a way to filter the contact form that email send from some ip or domains are not send?I know on CF7 there is a little plugin for it.
Maybe to block all from ru or cn ;)August 22, 2018 at 10:42 pm #1000536maybe we can do something over this check in contact.js:
if(classes && classes.match(/is_email/)) { if(!value.match(/^[\w|\.|\-]+@\w[\w|\.|\-]*\.[a-zA-Z]{2,20}$/)) { surroundingElement.removeClass("valid error ajax_alert").addClass("error"); send.validationError = true; } else { surroundingElement.removeClass("valid error ajax_alert").addClass("valid"); } nomatch = false; }
August 24, 2018 at 7:07 pm #1001347Hi,
I asked Ismael to take a look at the ticket, maybe he can come up with something quick! :)
Best regards,
BasilisAugust 25, 2018 at 7:39 am #1001505Thanks!
August 25, 2018 at 8:35 am #1001527Hi!
You could replace it with this code:
if(classes && classes.match(/is_email/)) { if(!value.match(/^[\w|\.|\-]+@\w[\w|\.|\-]*\.[a-zA-Z]{2,20}$/)) { surroundingElement.removeClass("valid error ajax_alert").addClass("error"); send.validationError = true; } else { var emailReg = value.match( /@\w[\w|\.|\-|ÄÖÜäöü]*\.[a-zA-Z]{2,20}$/ ); var domain = emailReg[0].split('.'); var country = domain.slice(-1).pop(); var block_countries = ['cn', 'ru']; for (var i = 0; i < block_countries.length; i += 1) { if (country.toLowerCase() == block_countries[i]) { surroundingElement.removeClass("valid error ajax_alert").addClass("error"); send.validationError = true; break; } else { surroundingElement.removeClass("valid error ajax_alert").addClass("valid"); } } } nomatch = false; }
to block domains ending with cn or ru.
Best regards,
PeterAugust 26, 2018 at 9:11 am #1001828thanks dude :
and best would be for me ( i got always a lot of customised alb elements) to load this script instead – if i got a custom contact.php in my child-theme/shortcodes folder and this edited new contact.js.
I have then edited the contact.php tofunction extra_assets() { //load css wp_enqueue_style( 'avia-module-contact' , AviaBuilder::$path['pluginUrlRoot'].'avia-shortcodes/contact/contact.css' , array('avia-layout'), false ); //load the new js wp_enqueue_script( 'avia-module-contact' , get_stylesheet_directory_uri().'/shortcodes/contact.js' , array('avia-shortcodes'), false, TRUE ); }
– it works ! but:
what is the difference between is_ext_email and is_email
do i have to do it with this part too?
if(classes && classes.match(/is_ext_email/))
August 26, 2018 at 10:48 am #1001834Hey!
The is_ext_email check will only fire if you use the “Valid E-Mail address with special characters” field validation (screenshot http://www.clipular.com/c/6126134404841472.png?k=929gwJ5qXLLVAavl5nIn-ZrnKn4 ). The extended characters check would also allow special characters like öä, etc. in the e-mail address but tbh you probably won’t stumble over e-mail addresses which contain special characters because of the reference standards (see https://stackoverflow.com/questions/2049502/what-characters-are-allowed-in-an-email-address )
Best regards,
PeterAugust 26, 2018 at 6:59 pm #1001921it works – now I just hope that the spammers will not switch to other country addresses.
and if I don’t get the mega order from China now , then it’s fate.September 5, 2018 at 11:16 pm #1006366it works – but – one e-mail has passed – and i don’t know how?
No more e-mails from ru or cn came in now. None, except one. And I’m really surprised. There is probably still one who can crack it.
Can be closed. thanks
September 6, 2018 at 5:38 am #1006449 -
AuthorPosts
- The topic ‘blacklist emails from contact form’ is closed to new replies.