handle Null MX records

parent c1d99d17
...@@ -37,8 +37,9 @@ if not ans then ...@@ -37,8 +37,9 @@ if not ans then
ngx.log(ngx.WARN, "no ans: '" .. args.email .. "'") ngx.log(ngx.WARN, "no ans: '" .. args.email .. "'")
error("server DNS timeout problem, please contact support") error("server DNS timeout problem, please contact support")
end end
if #ans == 0 then -- https://tools.ietf.org/html/rfc7505
ngx.log(ngx.WARN, "no mx: '" .. args.email .. "'") if #ans == 0 or (#ans == 1 and ans[1].preference == 0 and ans[1].exchange == "") then
ngx.log(ngx.WARN, "no no/null: '" .. args.email .. "'")
error("domain does not accept mail") error("domain does not accept mail")
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment