Disconnect Method


Disconnects from the SMTP server.

It is not necessary (though it's recommended) to call this method. The SMTP object automatically disconnects from SMTP server when the object is to be freed.


blnResult = ObjectName.Disconnect  
Parameters: None 
Return value As Boolean True if successful, False if disconnect procedure failed (was not connected, mail server is not responding). You can check ErrDesc property or log file to get more detailed error information  
Remarks: Even if this method failed, connection will be closed anyway. This means that Connected property will be always False after calling Disconnect method.

Usage example:

Dim Mailer
'Using visual basic to create object
Set Mailer = CreateObject("MailBee.SMTP")
'Using ASP to create object
'Set Mailer = Server.CreateObject("MailBee.SMTP")
'In ASP use Response.Write instead of MsgBox
Mailer.LicenseKey = "put your license key here"
Mailer.ServerName = "mailserver.com"
Mailer.Domain = "mydomain"
If Mailer.Connect
  Mailer.RelayMessage "C:\msg.eml", "from@me.com", "to@you.com"
  If Mailer.Disconnect Then
    MsgBox "Connection gracefully closed"
  Else
    MsgBox "Connection aborted"
  End If
End If

See Also:

Connect Method


Copyright © 2002-2024, AfterLogic Corporation. All rights reserved.