- Products
- Purchase
Order Online Maintenance Renewal Resellers - Support
Helpdesk Online Documentation Web Forum - Our Clients
- About
About us Services Contact
Back to Tutorials list
RetrieveSingleMessage Method
Back to Tutorials list
Downloading entire message
The sample completely downloads last message in the mailbox.
Body text of the downloaded message is displayed to user.
[Visual Basic]:
Dim objPOP3, objMsg
' Create POP3 object
Set objPOP3 = CreateObject("MailBee.POP3")
' Enable logging POP3 session into a file
objPOP3.EnableLogging = True
objPOP3.LogFilePath = "C:\pop3_log.txt"
' 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"
' Connect to the server and log in the mailbox
If objPOP3.Connect Then
' Download last message completely
Set objMsg = objPOP3.RetrieveSingleMessage(objPOP3.MessageCount)
If Not objPOP3.IsError Then
' Display message body
MsgBox objMsg.BodyText
Else
' Display error information
MsgBox "Error #" & objPOP3.ErrCode & ", " & objPOP3.ErrDesc
End If
' Close the connection
objPOP3.Disconnect
Else
' Display error information
MsgBox "Error #" & objPOP3.ErrCode
MsgBox "Server response: " & objPOP3.ServerResponse
End If
[ASP]:
<%
Dim objPOP3, objMsg
' Create POP3 object
Set objPOP3 = Server.CreateObject("MailBee.POP3")
' Enable logging POP3 session into a file
objPOP3.EnableLogging = True
objPOP3.LogFilePath = "C:\pop3_log.txt"
' 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"
' Connect to the server and log in the mailbox
If objPOP3.Connect Then
' Download last message completely
Set objMsg = objPOP3.RetrieveSingleMessage(objPOP3.MessageCount)
If Not objPOP3.IsError Then
' Display message body
Response.Write objMsg.BodyText
Else
' Display error information
Response.Write "Error #" & objPOP3.ErrCode & ", " & objPOP3.ErrDesc
End If
' Close the connection
objPOP3.Disconnect
Else
' Display error information
Response.Write "Error #" & objPOP3.ErrCode & "<br>"
Response.Write "Server response: " & objPOP3.ServerResponse
End If
%>
See Also:RetrieveSingleMessage Method