MailBee Objects FAQ


1. Repairing MailBee Objects installation or updating MailBee Objects to a new version.


2. 'CreateObject Failed' (or 'Server.CreateObject failed') error. Why?


3. How to distribute MailBee Objects?


4. (POP3) How to retrieve headers for all messages and iterate through a collection in ASP?


5. (POP3) I need to get somewhat more than just message headers (but still not a whole message). Is it possible to get headers and first lines of message body?


6. (SMTP) How to turn line-wrapping off when composing plain-text body.


7. (POP3) Some symbols displayed as "???". How to prevent this?


8. (SMTP) Messages are not sent. Any solution?


1. Repairing MailBee Objects installation or updating MailBee Objects to a new version.


To reinstall MailBee Objects or install a new version, it's required to uninstall an existing version first.

Prior to uninstalling make sure no applications use MailBee Objects. For example, Internet Information Server (IIS) caches recently used components, so you need to stop or restart the server BEFORE uninstalling MailBee Objects (execute "iisreset" command in Start/Run menu).

Also, ActiveX-aware development environments (such as Developer Studio) might lock MailBee Objects if you develop an application or ASP page that uses MailBee Objects. You need to close your development environment before uninstalling.

The easiest way to make sure MailBee Objects are not locked by some other application is to reboot the machine where MailBee Objects are installed. Of course, after rebooting you must launch MailBee uninstaller before using IIS or Developer Studio (otherwise, MailBee Objects might be locked again).

As soon as MailBee Objects are not locked anymore, you can uninstall them and install new version.


2. 'CreateObject Failed' (or 'Server.CreateObject failed') error. Why?


MailBee Objects installation was damaged for some reason. Stop or exit all applications that can potentially use MailBee Objects (such as IIS or Developer Studio), and reinstall MailBee Objects.


3. How to distribute MailBee Objects?


MailBee.dll ActiveX component is an only file required to distribute MailBee objects across computer systems. Copy it to any location (for example, windows system32 directory or your application directory) and register it as ActiveX component in the registry (for example, using regsvr32 utility or other tool your installer program provides).


4. (POP3) How to retrieve headers for all messages and iterate through a collection in ASP?


To retrieve only headers (without downloading whole messages) at once, use RetrieveHeaders method that returns collection of Message objects:


' Assume Mailer object is already created and all required settings
' (LicenseKey/UserName/Password/ServerName) are set.
If Mailer.Connect Then
  Set Msgs = Mailer.RetrieveHeaders
  Response.Write Msgs.Count & " messages total in mailbox<br>"
  For Each Msg In Msgs
    Response.Write "Subject: " & Msg.Subject & "<br>"
  Next
  Mailer.Disconnect
Else
  Response.Write Mailer.ErrDesc
End If 

5. (POP3) I need to get somewhat more than just message headers (but still not a whole message). Is it possible to get headers and first lines of message body at once?


RetrieveHeaders along with RetrieveSingleMessageHeaders methods have optional parameter BodyLinesCount that allows you to specify how many body lines to download in addition to headers part.


Dim Mailer, Msg
'Using visual basic to create object
Set Mailer = CreateObject("MailBee.POP3")
'Using ASP to create object
'Set Mailer = Server.CreateObject("MailBee.POP3")
'In ASP use Response.Write instead of MsgBox
Mailer.LicenseKey = "put your license key here"
Mailer.Connect "mailserver.com", 110, "MyName", "MyPassword"
If Mailer.Connected Then
  If Mailer.MessageCount > 0 Then

    ' Download headers and 10 lines of the body
    Set Msg = Mailer.RetrieveSingleMessageHeaders(1, 10)

    If Not Msg Is Nothing Then
      MsgBox "Body preview: " & Msg.BodyText
    End If
  End If
  Mailer.Disconnect
End If

6. (SMTP) How to turn line-wrapping off when composing plain-text body.


Use quoted-printable (QP) or base64 (B64) body encoding methods. These advanced methods preserve original text formatting - text is no longer wrapped by 76 characters per line. See BodyEncoding and AltBodyEncoding topics or the sample code below for details.


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.BodyText = "Assume the text at this line is longer that 76 symbols length"
  Mailer.Message.BodyEncoding = 2 ' Quoted-printable encoding
  Mailer.Send
  Mailer.Disconnect
End If

7. (POP3) Some symbols displayed as "???". How to prevent this?


Set POP3.CodepageMode=1 prior to retrieving messages. This will activate an alternate method of charset conversions.


Dim Mailer, Msg
'Using visual basic to create object
Set Mailer = CreateObject("MailBee.POP3")
'Using ASP to create object
'Set Mailer = Server.CreateObject("MailBee.POP3")
'In ASP use Response.Write instead of MsgBox
Mailer.LicenseKey = "put your license key here"
Mailer.Connect "mailserver.com", 110, "MyName", "MyPassword"
If Mailer.Connected Then
   If Mailer.MessageCount > 0 Then

      ' Now MailBee will convert the body into Windows version of the message's codepage
      ' instead of converting into current system's Windows codepage.
      Mailer.CodepageMode = 1

      Set Msg = Mailer.RetrieveSingleMessage(1)
      If Not Msg Is Nothing Then
        MsgBox Msg.BodyText
      End If
   End If
   Mailer.Disconnect
End If

8. (SMTP) Messages are not sent. Any solution?


SMTP server you are using:

MailBee.SMTP object supports a number of debugging properties and logging option to help you in understanding what really happens. Also, you may send the log file to us to find the solution quickly.

Debugging properties are:

Logging may be activated by enabling logging option and specifying log file path (see EnableLogging and LogFilePath properties).

Sample code below shows how to activate logging and check debugging properties on error:


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

' Enable logging option
Mailer.EnableLogging = True
Mailer.LogFilePath = "C:\smtp_log.txt" ' You may send this log to us

' Uncomment the next line if you want the log file to be cleared first
' Mailer.ClearLog

Mailer.LicenseKey = "put your license key here"
Mailer.ServerName = "mail.site.com"
If Mailer.Connect Then
  Mailer.Message.ToAddr = "recipient@server.com"
  Mailer.Message.FromAddr = "sender@server.com"
  Mailer.Message.Subject = "Test"
  Mailer.Message.BodyText = "Body test"
  If Not Mailer.Send Then
    MsgBox _
      Mailer.ErrDesc & vbCrLf & _
      "ErrCode: " & Mailer.ErrCode & vbCrLf & _
      "Last server reply: " & Mailer.ServerResponse

  End If
  Mailer.Disconnect
Else
  MsgBox _
    Mailer.ErrDesc & vbCrLf & _
    "ErrCode: " & Mailer.ErrCode & vbCrLf & _
    "Last server reply: " & Mailer.ServerResponse
End If

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