Get mailBoxSize with Invoke Code

@Marisa_Ontiveros1

You can try this as below:

Imports Spire.Email.Pop3

’ Initialize the mailbox size variable
out_mailBoxSize = 0

Try
’ Create a POP3 client
Using pop As New Pop3Client()
’ Set host, authentication, port, and connection protocol
pop.Host = “outlook.office365.com
pop.Username = “LeonDavisLD@outlook.com
pop.Password = “your_password_here” ’ Replace with secure method
pop.Port = 995
pop.EnableSsl = True

    ' Connect to the POP server
    pop.Connect()

    ' Get the size of the mailbox
    out_mailBoxSize = pop.GetSize() ' Assign the size to the output argument

    ' Optionally, you can also get the number of messages if needed
    ' Console.WriteLine("Mailbox message count: " + pop.GetMessageCount())
    ' Console.WriteLine("Mailbox size: " + out_mailBoxSize + " bytes")
End Using

Catch ex As Exception
’ Handle exceptions, log error messages
Console.WriteLine("Error: " + ex.Message)
End Try