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!