MailBee Objects FAQ


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


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


How to distribute MailBee Objects?


How to use Office 365 OAuth 2.0 (modern authentication) IMAP/POP3/SMTP with MailBee Objects?


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


(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?


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


(SMTP) Messages are not sent. Any solution?


64-bit version of MailBee.dll


32-bit version of MailBee.dll on 64-bit Windows


Using MailBee with MS Exchange Server (for developers how previously worked with Outlook).


Is IPv6 supported?


Is OAuth 2.0 supported?


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 is not locked by some other application is to reboot the machine where MailBee Objects is installed. After rebooting, you must run MailBee uninstaller BEFORE using IIS or Developer Studio (otherwise, MailBee Objects could get locked again).

As soon as MailBee Objects is not locked anymore, you can uninstall it and install the new version.


'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.

Another reason is a permission problem (often the case for ASP applications). Make sure IIS user (can be IUSR_<YOUR_SERVER_NAME>, NETWORK SERVICE, and a few other names) has permission to read MailBee.dll and read the Windows registry entries related to MailBee.


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).

If you're using 64-bit version, the same instructions apply with the only difference that the file to be distributed is MailBee64.dll.


How to use Office 365 OAuth 2.0 (modern authentication) IMAP/POP3/SMTP with MailBee Objects?<


Yes, you can find Office 365 OAuth 2.0 samples in My Documents/MailBee Objects/Samples/OAuth2_VBScript folder.


(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 

(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

(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

(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:\Temp\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

64-bit version of MailBee.dll


64-bit version of MailBee.dll (MailBee64.dll) is installed in the same folder where MailBee.dll resides. If your system is 64-bit, MailBee64.dll also gets registered (so that both 32-bit and 64-bit versions are registered side-by-side). If you need to register it on 64-bit Windows manually (for instance, when deploying your application), use regsvr32 utility in Windows\System32 folder. Note: there is another version of regsvr32 in Windows\SysWOW64 folder, do not use it!

You must run regsvr32 in "Run as Administrator" mode (for instance, when opening Command Prompt, use "Run as Administrator" option).

Example: C:\Windows\System32\regsvr32 "C:\Program Files (x86)\MailBee Objects\MailBee64.dll"


32-bit version of MailBee.dll on 64-bit Windows


To register 32-bit version of MailBee.dll on 64-bit Windows, use regsvr32 in Windows\SysWOW64 folder, NOT the regular regsvr32 in System32 folder. Also, You must run regsvr32 in "Run as Administrator" mode.


Using MailBee with MS Exchange Server (for developers how previously worked with Outlook)


Outlook usually works with MS Exchange over ExchangeRPC protocol, not over SMTP, POP3 or IMAP. Thus, the fact you can successfully connect with MS Outlook does not yet mean the same settings will apply in SMTP, POP3 or IMAP case.

If you have connectivity issues, make sure SMTP, POP3 or IMAP port is opened on both the server and your computer. Also, make sure MS Exchange is running SMTP and POP3 or IMAP service and the user you're trying to authenticate has permissions to use SMTP, POP3, or IMAP (depending on which protocol you're using).

By default, POP3 and IMAP access is DISABLED on MS Exchange server.

Using logging (see EnableLogging property of your mailer object) can be helpful for troubleshooting (for instance, to find out whether the problem occurs during connecting or during authenticating).

If the connection itself succeeds but you cannot log in, try using NTLM or GSSAPI authentication (see AuthMethod of the mailer component for details) because MS Exchange may disable other methods. Or, try setting Mailer.SSL.Enabled=True (where Mailer is your SMTP, POP3 or IMAP4 object). MS Exchange may be configured to allow you to authenticate only if the connection is secured.

Tthe username you're using for authentication may be incorrect due to the domain part. With GSSAPI or NTLM authentication, you can specify the domain with UserDomain property. With regular authentication, you have to supply it in the UserName. The typical syntax is "domain\username".

If your Exchange account is aliased, the full form of the login name can be "domain\logon_name\alias_name".


Is IPv6 supported?


Yes, IPv6 is supported for all components in MailBee Objects suite.


Is OAuth 2.0 supported?


Yes, OAuth 2.0 is supported for all components in MailBee Objects suite. You can find Gmail and OAuth 2.0 samples in My Documents/MailBee Objects/Samples/OAuth2_VBScript folder.


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