this repo has no description

appview: expand domain of acceptable email addresses

Signed-off-by: tjh <x@tjh.dev>

tjh.dev bbf62469 5d2f08b3

verified
Waiting for spindle ...
+12 -4
+12 -4
appview/email/email.go
··· 49 49 parts := strings.Split(addr.Address, "@") 50 50 domain := parts[1] 51 51 52 - mx, err := net.LookupMX(domain) 53 - if err != nil || len(mx) == 0 { 54 - return false 52 + // Ignore err because mx may contain valid records if err != nil anyway. 53 + mx, _ := net.LookupMX(domain) 54 + 55 + if len(mx) != 0 { 56 + return true 57 + } else { 58 + // Ignore err because addr will be nil if any errors occur anyway. 59 + addr, _ := net.LookupIP(domain) 60 + if len(addr) != 0 { 61 + return true 62 + } 55 63 } 56 64 57 - return true 65 + return false 58 66 }