Skip to content

dymmer-code/blacklist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blacklist

hex.pm hexdocs.pm hex.pm hex.pm github.com

Blacklist check with Akismet API implemented with Tesla.

This is very useful to check if a message coming from a contact form is a ham or spam one.

Installation

Add blacklist to your list of dependencies in mix.exs:

def deps do
  [
    {:blacklist, "~> 0.1"}
  ]
end

Usage

Blacklist.check author, email, locale, user_agent, user_ip, content
# false

The information provided to check if the message is spam is as follow:

  • author: author name of the message.
  • email: email for the author of the message.
  • locale: language used for the message. It should be in ISO-639 (es, en, ...).
  • user_agent: the user agent of the browser used to send the message.
  • user_ip: the user IP where the message came from.
  • content: the content of the message.

The result of the function will be or a boolean indicating if it's spam or not, or an error in case something went wrong.

This depends on an external service and you should to configure the credentials to use it:

config :blacklist, api_key: "xxxxxxxxxxxx",
                   blog: "https://..."

The values are:

  • api_key: the API key provided by Akismet website.
  • blog: the URL of your website.

You can use also the configuration to use a custom blacklist. The configuration for the blacklist is as follow (you can merge both configurations to generate only one):

config :blacklist, name: [],
                   email: ["@mail.ru", "@plusgmail.ru", "@seocdvig.ru"]

Enjoy!

About

Blacklist using Akismet for Elixir

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages