Learning the total size of messages

The sample prints the total size (in bytes) occupied by all mesages in the mailbox.

TotalSize is a key property of this sample.

Visual Basic

Dim objPOP3

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

' Force APOP authentication
objPOP3.AuthMethod = 1

' Set user credentials
objPOP3.UserName = "username"
objPOP3.Password = "password"

' Connect to the server and log in the mailbox
If objPOP3.Connect Then

  ' Display the total size of messages
  MsgBox objPOP3.TotalSize & " bytes of mailbox space used"

  ' Close the connection
  objPOP3.Disconnect
Else
  ' Display error information
  MsgBox "Error #" & objPOP3.ErrCode
  MsgBox "Server response: " & objPOP3.ServerResponse
End If

ASP

<%
Dim objPOP3

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

' Force APOP authentication
objPOP3.AuthMethod = 1

' Set user credentials
objPOP3.UserName = "username"
objPOP3.Password = "password"

' Connect to the server and log in the mailbox
If objPOP3.Connect Then

  ' Display the total size of messages
  Response.Write objPOP3.TotalSize & " bytes of mailbox space used"

  ' Close the connection
  objPOP3.Disconnect
Else
  ' Display error information
  Response.Write "Error #" & objPOP3.ErrCode & "<br>"
  Response.Write "Server response: " & objPOP3.ServerResponse
%>

See Also:

TotalSize Property