Contact Form Spam

Hi all,

    I am using ColdTrick Contact ( which is a quite helpful & beautiful plugin but i want to add an extra condition to the contact form that is when a user places any link inside the contact form. Kindly note i have Captcha, Spam Login, https block all those plugin & still nothing is working so i thought of this idea ..

  1. If any link is placed in the message of the contact form the contact form should simply reject the message stating "Message delivery failed bcz the message might contain spam" This can discourage the contact form being miss used.

So that i will be in peace with flooded Phishing & spam emails hitting on a daily basis.

Thanks in Advance 

  • Hello,

       Does anyone knows how to make this possible where to add the validation any link is placed in the contact forum message/subject it should not send email at all it should simply reject the message with warning.. 

    Thanks you


  • You can add your check in mod/contact/actions/send.php file.

    The message is stored in $message variable. Add your check that if any http or https is present in $message then the message will be rejected.

  • Hello Rohit,

     Thanks for your help but it did not stop ..

    // check spam
    if(!preg_match("#^((ht|f)tps?:)?//#i", $message)) {
        $message= 'http://' . $message;
    I am not a good coder can you tell me like what i am missing here ..
  • I thought you wanted to remove URL from your message but the code that you have shared is doing something else.. This is what it does:

    1. Check if $message is not blank
    2. Check if $message does not starts with https or ftps then
    3. Add http to the $message
    4. Register an elgg error and
    5. continue to run the code as there is no exit command.

    Form the code it seems like you want to add a url to your message and not remove it.

    Your code should be:

    if (strpos($message, 'http') !== false) {
    } else {
        // rest of the code to send the message
  • Hello Rohit,

         Thanks for your help it worked.. Now i am free from this spammer who miss use my contact form ..

    Thanks once again for your valuable time & help ..  

Performance and Scalability

Performance and Scalability

If you've got a need for speed, this group is for you.