Public Class MailServer 'Ctors : Public Sub New() Me.Host = "smtp.host.ext" Me.Port = 25 Me.Secured = False End Sub Public Sub New(ByVal host As String, ByVal port As Integer, ByVal secured As Boolean) Me.Host = host Me.Port = port Me.Secured = secured End Sub 'Properties : Private _Host As String Public Property Host As String Get Return _Host End Get Set(value As String) _Host = value End Set End Property Private _Port As Integer Public Property Port As Integer Get Return _Port End Get Set(value As Integer) If value >= Net.IPEndPoint.MinPort OrElse value <= Net.IPEndPoint.MaxPort Then _Port = value End If End Set End Property Private _Secured As Boolean Public Property Secured As Boolean Get Return _Secured End Get Set(value As Boolean) _Secured = value End Set End Property End class
Public Sub Test(ByVal ms As MailServer) Try If ms.Secured = True Then _TestSmtp.ConnectSsl(ms.Host, ms.Port) Else _TestSmtp.Connect(ms.Host, ms.Port) End If Catch ex As Exception 'Message Box Here... End Try End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)