Unicode and UTF-8
This sample will display any e-mail (even encoded in UTF-8) in Western-Europe codepage (iso-8859-1, codepage number 1252).
The sample gets e-mail from POP3 server but you can use the same approach for IMAP4 and for messages taken from disk or database.
To send UTF-8 email, see Sending e-mails /International e-mail topic.
POP3.CodepageMode and POP3.Codepage are key properties of this sample. These properties are also available for IMAP4 and Message objects.
Note: If you change codepage of HTML message, also remove (or replace with new value) CHARSET setting found in META tag of HTML HEAD section.
Dim objPOP3, objMsg
' Create POP3 object
Set objPOP3 = CreateObject("MailBee.POP3")
' Unlock POP3 object
objPOP3.LicenseKey = "put your license key here"
' Set POP3 server name
objPOP3.ServerName = "mail.server.com"
' Set user credentials
objPOP3.UserName = "username"
objPOP3.Password = "password"
' UTF8 mail will be converted to codepage specified
' in Codepage property
objPOP3.CodepageMode = 2
' In most cases, you do not need to set Codepage property.
' However, you can always explicitly specify target
' codepage as it is done here.
objPOP3.Codepage = 1252
' Download a message
Set objMsg = objPOP3.RetrieveSingleMessage(1)
If Not objPOP3.IsError Then
' Display message body
MsgBox objMsg.BodyText
End If
' Disconnect if needed
If objPOP3.Connected Then
objPOP3.Disconnect
End If
<%
Dim objPOP3, objMsg
' Create POP3 object
Set objPOP3 = Server.CreateObject("MailBee.POP3")
' Unlock POP3 object
objPOP3.LicenseKey = "put your license key here"
' Set POP3 server name
objPOP3.ServerName = "mail.server.com"
' Set user credentials
objPOP3.UserName = "username"
objPOP3.Password = "password"
' UTF8 mail will be converted to codepage specified
' in Codepage property
objPOP3.CodepageMode = 2
' In most cases, you do not need to set Codepage property.
' However, you can always explicitly specify target
' codepage as it is done here.
objPOP3.Codepage = 1252
' Download a message
Set objMsg = objPOP3.RetrieveSingleMessage(1)
If Not objPOP3.IsError Then
' Display message body
Response.Write objMsg.BodyText
End If
' Disconnect if needed
If objPOP3.Connected Then
objPOP3.Disconnect
End If
%>
See Also:
Message.Codepage Property
Message.CodepageMode Property