mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
17 lines
338 B
Go
17 lines
338 B
Go
package utils
|
|
|
|
import (
|
|
"net"
|
|
"strings"
|
|
)
|
|
|
|
// CheckEmailMX takes an e-mail address and verifies that an MX DNS record exists for its domain
|
|
func CheckEmailMX(email string) bool {
|
|
parts := strings.Split(email, "@")
|
|
if len(parts) != 2 {
|
|
return false
|
|
}
|
|
records, err := net.LookupMX(parts[1])
|
|
return len(records) > 0 && err == nil
|
|
}
|