Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET SMTP

 AfterLogic Forum : MailBee.NET SMTP
Subject Topic: smtp.live.com error Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
jvinis
Newbie
Newbie


Joined: 20 May 2008
Online Status: Offline
Posts: 18
Posted: 13 March 2009 at 4:09am | IP Logged Quote jvinis

I Use the method CheckLoginSMTP to check if I can send an email to the specified SMTP Server.

I use the following values:
ServiceTypeName = "HotMail"
ServerName = "smtp.live.com"
UseSSL = True
Port = 25
Email = <The Email to TestSend>
UserΝame = <A valid hotmail account>
Password = <The password of hotmail account>

and I get the following Error: "Error: SSL-related Win32 function returned an error. See NativeErrorCode property value for more information. The Win32 error code is: -2146893048.". You can also see the attached file "smtp.log".

Why does this happen? I can login to the hotmail account via MailBee.Pop3. I would also like to inform you that I use the Hotmail account with Outlook Express and I experience no problems.

I use the same method (CheckLoginSMTP) to check other smtp Servers like gmail.com, gmx.com and I have no problem.


Thank you in advance.




CODE
Protected Function CheckLoginSMTP(ByVal ServiceTypeName As String, ByVal ServerName As String, _
                                       ByVal UseSSL As Boolean, ByVal Port As Integer, _
                                       ByVal Email As String, ByVal UserΝame As String, _
                                       ByVal Password As String, ByRef ErrorsInfo As ErrorInfo()) As Boolean
    Dim ret As Boolean
    Dim tsr As TestSendResult
    Dim srv As SmtpServer
    Dim mailer As Smtp

    ret = False
    MailBee.SmtpMail.Smtp.LicenseKey = MailBeeLicenceKey

    srv = New SmtpServer()
    srv.Name = ServerName
    If Port > 0 Then
      srv.Port = Port
    End If
    srv.AccountName = UserΝame
    srv.Password = Password

    mailer = New Smtp()
    mailer.Log.Enabled = True
    mailer.ThrowExceptions = False

    If UseSSL Then
      srv.SslProtocol = MailBee.Security.SecurityProtocol.Auto
      srv.SslMode = MailBee.Security.SslStartupMode.OnConnect
    Else
      srv.SslMode = MailBee.Security.SslStartupMode.Manual
    End If
    srv.AuthMethods = AuthenticationMethods.Auto

    mailer.SmtpServers.Add(srv)
    mailer.Connect()

    '//: Check Connected
    If mailer.IsConnected Then
      '//: Perform a Test Send
      mailer.From.AsString = Email
      mailer.To.AsString = Email
      tsr = mailer.TestSend(SendFailureThreshold.Default)

      '//: Check LoggedIn
      If mailer.IsLoggedIn Then
        ret = (tsr = TestSendResult.OK)
        If tsr <> TestSendResult.OK Then
           '//: TestSend Failed
           Array.Resize(ErrorsInfo, ErrorsInfo.Count + 1)
           ErrorsInfo(ErrorsInfo.Count - 1) = ErrorInfo.GetError(tsr, My.Resources.msgTestSendFailed, _
                                                                   "CheckLoginSMTP")
        End If
      Else
        '//: Login with given UserName and Password Failed
        If mailer.LastResult = MailBee.ErrorCodes.OK Then
           Array.Resize(ErrorsInfo, ErrorsInfo.Count + 1)
           ErrorsInfo(ErrorsInfo.Count - 1) = ErrorInfo.GetError(My.Resources.msgLoginFailed, _
                                                                   ServiceTypeName, "CheckLoginSMTP")
        Else
           Array.Resize(ErrorsInfo, ErrorsInfo.Count + 1)
           ErrorsInfo(ErrorsInfo.Count - 1) = ErrorInfo.GetError(mailer.LastResult, My.Resources.msgLoginFailed, _
                                                                   ServiceTypeName, "CheckLoginSMTP")
        End If
      End If
    Else
      '//: Connection to the Server Failed.
      If mailer.LastResult = MailBee.ErrorCodes.OK Then
        Array.Resize(ErrorsInfo, ErrorsInfo.Count + 1)
        ErrorsInfo(ErrorsInfo.Count - 1) = ErrorInfo.GetError(My.Resources.msgConnectionFailed, _
                                                                 ServiceTypeName, "CheckLoginSMTP")
      Else
        Array.Resize(ErrorsInfo, ErrorsInfo.Count + 1)
        ErrorsInfo(ErrorsInfo.Count - 1) = ErrorInfo.GetError(mailer.LastResult, _
                                                                 My.Resources.msgConnectionFailed, _
                                                                 ServiceTypeName, "CheckLoginSMTP")
      End If
    End If

    If mailer.IsConnected Then
      mailer.Disconnect()
    End If
    mailer.Dispose()

    Return ret
End Function




LOG
[16:04:46.75] [INFO] Assembly version: 3.1.2.90.
[16:04:46.75] [INFO] Will resolve host "smtp.live.com".
[16:04:46.89] [INFO] Host "smtp.live.com" resolved to IP address(es) 65.55.172.254.
[16:04:46.89] [INFO] Will connect to host "smtp.live.com" on port 25.
[16:04:47.03] [INFO] Socket connected to IP address 65.55.172.254 on port 25.
[16:04:47.03] [INFO] Will create TLS/SSL credentials.
[16:04:47.03] [INFO] TLS/SSL credentials created.
[16:04:47.03] [INFO] Will start TLS/SSL negotiation sequence.
[16:04:47.19] [INFO] Error: SSL-related Win32 function returned an error. See NativeErrorCode property value for more information. The Win32 error code is: -2146893048.
[16:04:47.19] [INFO] Will disconnect from host "smtp.live.com".
[16:04:47.19] [INFO] Disconnected from host "smtp.live.com".
Back to Top View jvinis's Profile Search for other posts by jvinis
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 13 March 2009 at 8:44am | IP Logged Quote Andrew

Connecting to smtp.live.com:25 with SslStartupMode.OnConnect will not work. You should try SslStartupMode.UseStartTls instead.

Best regards,
Andrew
Back to Top View Andrew's Profile Search for other posts by Andrew
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide