4D Blog

Home Product IMAP: Mailbox Id and mail keywords

IMAP: Mailbox Id and mail keywords

April 28, 2023

Product

4D v20 brings two very useful features to IMAP Transporters!

Interacting with some IMAP mail servers and clients requires to manage custom keywords in mails, and benefit from some of their specific features.

We also added the mailbox ID support in our IMAP Transporter so that you can identify a given mailbox even after it is renamed.

Custom keywords

Because some IMAP servers allow user to define custom keywords, the .addFlags() and .removeFlags() function accept now arbitary words as keywords :

$transporter:=IMAP New transporter($parameters)
$boxInfo:=$transporter.selectBox("INBOX")

$mailIds:=["122";"123";"124"]
// Custom keyword
$keywords:={"myKeyword":true}
// apply the custom keyword to the collection of mail
$status:=$transporter.addFlags($mailIds; $keywords)

and the .selectBox() function returns the list of flags allowed in the current mailbox through the .flags and .permanentFlags attributs:

$selectBox:=$transporter.selectBox("INBOX")
//$selectBox={name:INBOX,
//mailCount:124,
//mailRecent:0,
//id:644737301,
//flags:\\Answered \\Flagged \\Draft \\Deleted \\Seen $NotPhishing $Phishing myKeyword,
//permanentFlags:\\Answered \\Flagged \\Draft \\Deleted \\Seen $NotPhishing $Phishing myKeyword \\*} 

mailbox Id

Because the mailbox name is not sufficient alone to know if the box selected has been renamed or removed and recreated, we add the id to the information returned by the .selectBox() and the .getBoxInfo() function of the IMAP transporter:

$boxInfo:=$transporter.getBoxInfo("INBOX")
//{name:INBOX,
//mailCount:125,
//mailRecent:0,
//id:644737301}

Check out these features with the documentation for more details!

Discuss

Tags IMAP, Mail, v20

Latest related posts

  • February 3, 2026

    4D Write Pro – Adding a margin automatically when bullets are set using standard actions

  • January 22, 2026

    Transform Static Documents into Actionable Knowledge with AIKit

  • January 22, 2026

    Deploy Fluent UI effortlessly in your 4D applications

Fabrice Mainguené
Fabrice Mainguené
• Product Owner •Fabrice Mainguené joined 4D Program team in November, 2016. As a Product Owner, he is in charge of writing the user stories then translating it to functional specifications. His role is also to make sure that the feature implementation delivered is meeting the customer need.After obtaining a Bachelor degree in Computer Science at CNAM, Fabrice joined a small software publishing company as a Windev developer. Then he worked for different companies in industry and trade areas as a Windev and web developer as well as technical advisor on new features.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • AI
  • 4D View Pro
  • 4D Write Pro
  • 4D for Mobile
  • Email
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • Qodly Studio
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 21 R2 Administration AI Artificial Intelligence Build application CI/CD Class Client/Server Code editor Collections Formula Listbox Logs Mail Microsoft 365 Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience vscode Web Word processor

Tags

4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 21 R2 Administration AI Artificial Intelligence Build application CI/CD Class Client/Server Code editor Collections Formula Listbox Logs Mail Microsoft 365 Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience vscode Web Word processor
Subscribe to 4D Newsletter

© 2026 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy