Knowledge Base

POP3: Some characters are displayed as "???". How to prevent this?

You should 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

When POP3.CodepageMode=0, MailBee Objects converts messages from their original codepages to default server codepage and this may cause non-latin characters loss. POP3.CodepageMode=1 forces MailBee Objects to convert messages from their original codepages to their Windows counterparts.