UTF7EncodeMailboxNames Property


Tells MailBee whether to automatically encode IMAP mailbox names to UTF-7M when sending requests to the server.

By default, this property is set to True which means mailbox names are encoded automatically when MailBee sends them as part of requests to the server. This property, however, doesn't affect decoding of mailbox names received from the server: Mailbox.Name property always contains decoded name, Mailbox.OriginalName - original name.

Encoding mailbox names makes sense when your application operates with mailboxes having non-latin or special characters in their names. However, some IMAP servers don't support UTF-7M encoding for mailboxes names.

Well designed application sets this property to False; then, it uses decoded names when presenting them to the user and encoded names when sending them to the server. To get encoded name, use Mailbox.OriginalName property. To encode a mailbox name manually (if you're creating a new mailbox and thus no Mailbox.OriginalName value is available), use ToUTF7 method.

In case if you hardcode mailbox names in Visual Basic code (such as VBScript), make sure you saved the code file in ANSI and not UTF-8 encoding. Otherwise, non-English characters may get corrupted when the actual content in the file is UTF-8 while VB runtime thinks it's ANSI. This may also be a problem for other programming environments which are limited in their UTF-8 support.


Value Type: Boolean
Parameters: None 

Usage example:

' This sample gets all mailboxes list and selects last mailbox in the collection.
' Then, messages count is displayed for this mailbox.

Dim Mailer, Mailboxes
'Using visual basic to create object Set Mailer = CreateObject("MailBee.IMAP4") 'Using ASP to create object 'Set Mailer = Server.CreateObject("MailBee.IMAP4") 'In ASP use Response.Write instead of MsgBox Mailer.EnableLogging = True Mailer.LogFilePath = "C:\Temp\imap4_log.txt" Mailer.ClearLog Mailer.LicenseKey = "put your license key here" If Mailer.Connect("mailserver.com", 143, "MyName", "MyPassword") Then 'Turn off encoding mailbox names Mailer.UTF7EncodeMailboxNames = False Set Mailboxes = Mailer.RetrieveMailboxes If Not Mailboxes Is Nothing Then If Mailboxes.Count > 0 Then If Mailer.SelectMailbox(Mailboxes(Mailboxes.Count).OriginalName) Then MsgBox Mailer.MessageCount & " messages in " & Mailboxes(Mailboxes.Count).Name End If End If End If Mailer.Disconnect End If

See Also:

SelectMailbox Method
RetrieveMailboxes Method

Mailbox.Name Property
Mailbox.OriginalName Property


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