Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi;
i am writing a simple class representing an email server, and a Test Method to test the provided Mail Server informations, however, when i try to connect with smtp.live.com:25 with ssl enabled i got an exception "unexpected packet format" , i'm using MailSystem.Net API and testing with SMTPClient Class.
Any help is welcome , thank you.

Here is my Class :
VB
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

And Here is the Test method :
VB
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
Posted
Comments
Sergey Alexandrovich Kryukov 24-Apr-13 18:28pm    
The term "mail server" is not a definitive notion to me (unlike, say, "HTTP server" or "FTP" server, the well-defined concepts). What is the "mail server", exactly?
Please see:
https://en.wikipedia.org/wiki/Message_transfer_agent
If would be more informative if you told us a protocol it implements and explained the goal of this project.
—SA
Abinonos 24-Apr-13 19:43pm    
MailServer Class is intended to represent SMTP , POP or IMAP servers Informations , i thought this was clear from code,but you are right Sergey, this should be named MailServerInfos instead of MailServer.
i am using a .Net library Named 'MailSystem.Net' the library seems to be unmaintained for a while.
well, when theses Mail Server Informations are defined , we are able to test them using an SmtpClient Object, however, i am getting an error when trying smtp.live.com on port 25 with SSL, the error reported is (translated from French) : Unexpected Packet Format.

1 solution

Port 25 is normally not used with SSL. Check the specs from live.com which port you have to use (587, 997, or something like that).
 
Share this answer
 
Comments
Abinonos 25-Apr-13 10:45am    
hi, i tried Port 25 with SSL , Port 587 with SSL , and all these settings are only working when no security is used !! i found a link for outlook settings :
http://windows.microsoft.com/en-us/windows/outlook/send-receive-from-app
but none of these settings are working !!
i am thinking about finding another api ..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900