ServerResponse Property


Contains string sent by SMTP server as a response of last performed operation (string caused SMTP server to execute the action is available through ClientRequest property value).

You might consider using this property if you want to know exactly what server reply is. For example, if sending failed even if all parameters (such as sender, recipients) are correct and network connection is stable, you may check this property to determine why SMTP server rejected the sending. Logging feature is also helpful for debugging purposes (EnableLogging property).

In the rest of cases Licensed/ErrDesc/ErrCode/IsError properties would be enough for organizing error-handling mechanism.


Value Type: String
Parameters: None 
Remarks: This property is read-only

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 = "mail.server.com"
If Mailer.Connect Then
  Mailer.Message.ToAddr = "bill@yoursite.com"
  Mailer.Message.FromAddr = "joe@mysite.com"
  Mailer.Message.Subject = "Hello"
  Mailer.Message.ImportBodyText "C:\docs\letter.htm", True
  If Not Mailer.Send Then
    If Mailer.ErrCode > 100 Then ' SMTP-specific error, i.e. not connection error
      MsgBox "Server rejected the message and responded: " & Mailer.ServerResponse
    Else
      MsgBox Mailer.ErrDesc ' Timeout occurred, connection lost, etc.
    End If
  End If
  Mailer.Disconnect
Else
  If Mailer.ErrCode > 100 Then ' SMTP-specific error, i.e. not connection error
    MsgBox "Server rejected the connection and responded: " & Mailer.ServerResponse
  Else
    MsgBox Mailer.ErrDesc ' Server not responding, timeout during connecting, etc.
  End If
End If

See Also:

ClientRequest Property
Licensed Property
IsError Property
ErrCode Property
ErrDesc Property
EnableLogging Property
LogFilePath Property


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