When retrieving email messages using POP3, it’s possible to retrieve just the message headers (which include information such as the sender, subject, and date) without downloading the entire message body.
Retrieving just the message headers can be helpful when you want to quickly scan the list of messages in your mailbox to decide which ones to download and read in full.
Starting with 4D v20, a new parameter is added to the .getMail() function of the POP3 transporter to receive your emails without the body. This function can be even more helpful if you use Gmail because it does not trigger the deletion of read emails.
To download the email headers with POP3, you need to use .getMail() function with its second parameter to true:
$param:=New object()
$param.host:="pop.gmail.com"
$param.port:=995
$param.user:="myaddress@gmail.com"
$param.accessTokenOAuth2:=$access_token
$param.authenticationMode:=POP3 authentication OAUTH2
$transporter:=POP3 New transporter($param)
// Gets the headers of the email
$mail:=$transporter.getMail($mailNumber; True)
It returns a mail object without the body parts:
Check out this feature with the documentation for more details!