Hi I am doing a dns test before sending mail so that I don't get errors. But there is a problem when I try to send an email to xxxxx@eco-log.se I get an error message from the dns function. when I try to remove the "-" in the mailing address, it works.
at first I had this because of a “-”, but I did an email at zzzzzz@eh-design.se and it works like a charm, what could be the problem? 100% sure that " xxxxx@eco-log.se " is an existing email address / DNS. The error message im get is "There is no such known source" (freely translated)
Here is the dns verification code:
Public Function testDNS(ByVal dnsstring As String) As Boolean
Dim email As String = dnsstring
Dim host As String() = email.Split("@")
Dim hostName As String = host(1)
Dim socket As Net.Sockets.Socket
Try
Dim entry As IPHostEntry = Dns.GetHostEntry(hostName)
Dim endPoint As New IPEndPoint(entry.AddressList(0), 25)
socket = New Sockets.Socket(endPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp)
Return True
socket.Connect(endPoint)
Catch se As SocketException
Try
Return False
Catch ex As Exception
End Try
End Try
End Function