-
-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom symbols for incoming emails #409
Comments
Hi, yes you can and those are all possibilities. Settings module (recommended): https://rspamd.com/doc/configuration/settings.html DIY: https://rspamd.com/doc/lua |
Sender's mail server ip and host name blacklisting example: rspamd.conf.local
ip-blacklist.map.local
rspamd.local.lua local rspamd_regexp = require "rspamd_regexp"
rspamd_config.HOSTNAME_IN_LOCAL_BL = function(task)
local re = rspamd_regexp.create_cached('/( \
^mail-b((n1|n1b|y2)h|l2u)n02[45][0-9]\\.outbound\\.protection\\.outlook\\.com$ | \
^p\\dnlsmtp\\d{2}\\.shr\\.prod\\.phx3\\.secureserver\\.net$ | \
^p\\dplsmtpa\\d{2}-\\d{2}\\.prod\\.phx3\\.secureserver\\.net$ | \
^mtaout0\\d-winn\\.ispmail\\.ntl\\.com$ | \
^trafik\\d{3}\\.ru$ | \
^a\\d{1,2}-\\d{2}\\.smtp-out\\.(amazonses|us-west-2)\\.com$ | \
^[^\\.]+\\.mxlogic\\.net$ | \
^vm\\d{4}\\.vps\\.agava\\.net$ | \
^bba\\d{6}\\.alshamil\\.net\\.ae$ | \
^vm\\d{5}\\.hv8\\.ru$ | \
^m[a-z]\\.wixshoutout\\.com$ \
)/ix')
local hn = task:get_hostname()
if hn and re:match(hn) then
>return true
end
return false
end |
to @fatalbanana
According to rspamd documentation the setting module allows to modify weight of a symbol. Is it possible to add custom symbols with the settings module? |
Thank you. This setup working for me: /etc/rspamd/modules.d/settings.conf:
/etc/rspamd/settings/global-blacklist.conf:
As I understand, settings module only can modify current symbols or actions. But I think, that adding a new symbol is better way. |
I suppose for best use of settings module as a whitelist/blacklist you must use hacks: https://groups.google.com/d/msg/rspamd/8RqmIW9b5OM/mKe5L3KwTMYJ |
Summary, two ways: 1. Add new symbol with weight (regexp or multimap module):
2. Modify current symbol (settings module):
PS. Maybe, add this usecases to documentation? |
Both ways works for me, thank you for config examples 👍 |
I'm using this method to whitelist symbols. Blacklist won't work if particular message doesn't have that symbol. You should add the symbol to all messages as @fatalbanana suggested. |
@moisseev I understood. Thats why I prefer adding new symbol (first method with multimap module). |
I have added feature to insert symbols when settings match to the master branch. |
Update index.md
Hello. Can I add custom symbols for incoming emails?
For example, I want blacklist some incoming messages (filtering by 'From' field). I see 'regexp' and 'settings' modules, and possibility to write lua script, but I don't see examples.
The text was updated successfully, but these errors were encountered: