Last active
July 21, 2016 16:20
-
-
Save fredgdaley2/5f5aea00a2880440bbeaf33a3a1e41de to your computer and use it in GitHub Desktop.
Check if email server is alive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports System.Net.Sockets | |
Public Function SmtpAlive(ByVal hostName As String, ByVal port As Integer) | |
Using tcp As New TcpClient | |
Try | |
tcp.Connect(hostName, port) | |
Return True | |
Catch ex As Exception | |
' server not found | |
Return False | |
End Try | |
tcp.Close() | |
End Using | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment