]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix --from argument
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 1 Dec 2020 14:43:38 +0000 (14:43 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 1 Dec 2020 14:43:38 +0000 (14:43 +0000)
lualib/rspamadm/dns_tool.lua

index f45f4a4a3caca96b4b44a878da9e276445021469..91a726d092da7dbaf12c1b7ac33c6145670b997a 100644 (file)
@@ -98,7 +98,14 @@ local function spf_handler(opts)
   end
 
   if opts.from then
-    task:set_from('smtp', {addr = opts.from})
+    local rspamd_parsers = require "rspamd_parsers"
+    local addr_parsed = rspamd_parsers.parse_mail_address(opts.from)
+    if addr_parsed then
+      task:set_from('smtp', addr_parsed[1])
+    else
+      io.stderr:write('Invalid from addr\n')
+      os.exit(1)
+    end
   elseif opts.domain then
     task:set_from('smtp', {user = 'user', domain = opts.domain})
   else