Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

SpamAway

Security covered Under active development 1,385 sites

This module adds an extra layer of spam protection to webforms by analyzing submitted text, limiting similar submissions, and restricting submissions from the same IP address within a set timeframe. It works best when used alongside other anti-spam measures like honeypots.

When Antibot & Honeypot aren't sufficient and you don't want those in your face anti spam captchas, this is the module for you!

What is it?

This module was created because Antibot/honeypot were still being bypassed thus we created an extra anti spam measure for webforms. Although it can be used standalone, it is still advised to use this module as an extra measure, next to other modules like antibot/honeypot.

What does it do?

It will mark webform submissions as spam:

  • By analysing text of previous submissions and rating it by similarity. A similarity threshold is then used to decide if a submission is considered spam or not.
  • Limit these similar submissions within a configurable period of time
  • Limit submissions from the same IP within a configurable period of time

How can I use/add this?

This module provides a webform handler.
Thus adding this handler to your webform and configuring it properly will most likely eliminate spam attacks.

Notes

  • Query limit has a hard limit of 200!, setting it any higher won't have any effect. This is done for performance reasons
  • Warning: this will handle SPAM attacks, but it doesn't eliminate SPAM 100%.
    What does this mean? It can happen that one, two, three (depending on your settings) SPAM submissions get through before the code kicks in.

More information/descriptions about the configuration options can be found in the field descriptions in the handler configuration form.

Auto add this handler to new webforms

/**
 * Implements hook_ENTITY_TYPE_insert().
 */
function MY_HOOKY_webform_insert(WebformInterface $webform) {
  /** @var \Drupal\webform\Plugin\WebformHandlerManagerInterface $handler_manager */
  $handler_manager = \Drupal::service('plugin.manager.webform.handler');
  // Create webform handler.
  $handler_configuration = [
    'id' => 'spamaway_anti_spam_forms',
    'label' => 'SpamAway - Anti spam handler',
    'handler_id' => 'spamaway_anti_spam_handler',
    'status' => 1,
    'weight' => 0,
    'settings' => [],
  ];
  $handler = $handler_manager->createInstance('spamaway_anti_spam_forms', $handler_configuration);
  // Must set original id so that the webform can be resaved.
  $webform->setOriginalId($webform->id());
  // Add webform handler which triggers Webform::save().
  $webform->addWebformHandler($handler);
}

Supporting organizations

  • Federal Police Belgium

Drupal 10–11

Ask your assistant about SpamAway

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
4
Tracked since
Apr 2025
Latest release
11 months ago
Releases (12 mo)
1 ▼ from 3
Maintenance
Slowing

Release Timeline

Releases

Version Type Core PHP Release date
2.0.3 Stable 10–11 Oct 20, 2025
2.0.2 Stable 10–11 Oct 14, 2025
2.0.x-dev Dev 10–11 Apr 18, 2025
2.0.1 Stable 10–11 Apr 18, 2025