DataFlex
DataFlex
Set an IMAP Mailbox Quota (SETQUOTA)
See more IMAP Examples
Demonstrates the Chilkat Imap.SetQuota method, which sends the IMAP SETQUOTA command. The first argument is the quota root, the second is the resource (STORAGE or MESSAGE), and the third is the limit. The server must support the IMAP QUOTA extension.
Background: Setting a quota is an administrative operation, so the logged-in account must have permission to change it. For the
STORAGE resource the limit is measured in units of 1024 octets, so a value of 500000 is roughly 500,000,000 bytes; MESSAGE instead caps the number of messages. Use GetQuotaRoot to read the current usage and limits back.Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoImap
Integer iQuotaKb
String sTemp1
Move False To iSuccess
// Demonstrates the Imap.SetQuota method, which sends the IMAP SETQUOTA command. The 1st
// argument is the quota root, the 2nd is the resource ("STORAGE" or "MESSAGE"), and the 3rd is
// the limit. The server must support the IMAP QUOTA extension.
Get Create (RefClass(cComChilkatImap)) To hoImap
If (Not(IsComObjectCreated(hoImap))) Begin
Send CreateComObject of hoImap
End
Set ComSsl Of hoImap To True
Set ComPort Of hoImap To 993
Get ComConnect Of hoImap "imap.example.com" To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoImap To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComLogin Of hoImap "user@example.com" "myPassword" To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoImap To sTemp1
Showln sTemp1
Procedure_Return
End
// Set the STORAGE limit for the "Mailbox" quota root. STORAGE is measured in units of 1024
// octets, so 500000 is approximately 500,000,000 bytes.
Move 500000 To iQuotaKb
Get ComSetQuota Of hoImap "Mailbox" "STORAGE" iQuotaKb To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoImap To sTemp1
Showln sTemp1
Procedure_Return
End
Showln "Quota set."
Get ComDisconnect Of hoImap To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoImap To sTemp1
Showln sTemp1
Procedure_Return
End
End_Procedure