Tech Off Thread

3 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Does anyone know how to use SSL with Indy Sockets POP3?

Back to Forum: Tech Off
  • User profile image

    I have been working with SMTP and POP3 in a Visual Developer for Web 2012 project using Indy Sockets. The standard server protocols work great but I have run into a snag attempting to implement SSL. There are a number of SMTP & POP servers out there that require SSL, including Gmail and I would like to make it available in the project. However, I cannot seem to find any good documentation on SSL for Indy Sockets SMTP & POP3 objects. The only place I could find anything about SSL for Indy Sockets was listed on a reference from an Indy Sockets knowledge base article pointing to an item posted on Intellicom ( but the link gives a Not Found error when followed.

    I am looking for some documentation that could help with using SSL with Indy Sockets. If anyone knows where I can find documentation or some code examples I would greatly appreciate being pointed in the right direction. I have posted some code below that I am using to implement SSL for POP3, bit it does not seem to work when 'UseSSL' is set to true.



     Dim xHost As String = Session.Item("POPServer")
    Dim xUsername As String = Session.Item("POPUser")
    Dim xPassword As String = Session.Item("POPPassword")
    Dim xPort As String = Session.Item("POPPort")
    Dim xSSL As Boolean = Session.Item("POPUseSSL")
    Dim xPOP3 As POP3 = New POP3
    Dim xMsg As Message = New Message()
    xPOP3.Username = xUsername
    xPOP3.Password = xPassword
    xPOP3.Port = CType(xPort, Integer)
    If xSSL Then xPOP3.AuthType = POP3AuthenticationType.atSASL
    Dim xCount As Integer = xPOP3.CheckMessages()
    ReDim TheEmailMessages(xCount, msgCount)
    If xCount = 0 Then
    Exit Function
    For ACounter = 1 To xCount
    xPOP3.Retrieve(ACounter, xMsg)
    TheEmailMessages(ACounter, msgSubject) = xMsg.Subject.ToString
    TheEmailMessages(ACounter, msgFrom) = xMsg.From.Text
    TheEmailMessages(ACounter, msgTo) = xMsg.Recipients(0).Text
    TheEmailMessages(ACounter, msgBody) = xMsg.Body.Text
    TheEmailMessages(ACounter, msgMsgID) = xMsg.MsgId.ToString 
    TheEmailMessages(ACounter, msgAddress) = xMsg.From.Address.ToString
    TheEmailMessages(ACounter, msgNumber) = Str(ACounter).Trim
    TheEmailMessages(ACounter, msgDate) = Indy.Sockets.Units.IdGlobalProtocols.DateTimeToInternetStr(xMsg.Date, False) 
    End If
    Catch ex As Exception
    Debug.Print ex.Message
    End Try

  • User profile image

    PS. I am assuming that the problem comes in at line 11 when xPOP3.AuthType is set to POP2AuthenticationType.atSASL if  the session variable POPUseSSL is true. I am guess that atSASL is not the same as the actual SSL protocol. When the POP3 authentication type is set to atSASL in line 11 the code on line 13 where it connects to the host after timing out it produces the exception 'Connection Closed Gracefully'

  • User profile image

    have you tried using the pop / smtp from lumi soft ? I have used the mail server they wrote and had good luck with it and they have a very good set of  pop / smtp / imap code you can read if you want.


Conversation locked

This conversation has been locked by the site admins. No new comments can be made.