IMAPNotifier
The IMAPNotifier class allows you to manage IMAP IDLE notifications for a selected mailbox.
履歴
| リリース | 内容 |
|---|---|
| 21 R3 | クラスを追加 |
The IMAPNotifier class is available from the 4D class store.
An IMAPNotifier object is associated with an IMAP transporter and provides access to mailbox notification management.
All IMAPNotifier class functions are thread-safe.
例題
// Define listener callbacks
var $parameter : Object
var $transporter : 4D.IMAPTransporter
$parameter:=New object
$parameter.authenticationMode:=IMAP authentication OAUTH2
$parameter.host:="Outlook.office365.com"
$parameter.port:=993
$parameter.accessTokenOAuth2:=$myToken
$parameter.user:="myaddress@email.com"
$parameter.listener:=cs.IMAPListener.new()
$transporter:=IMAP New transporter($parameter)
$transporter.selectBox("INBOX")
$transporter.notifier.start()
IMAPNotifier object
An IMAPNotifier object provides the following properties and functions:
| .isStarted : Boolean indicates whether the notifier is started ( true) or stopped (false) |
| .start() : Object starts the subscription to server notifications and activates IMAP listener callbacks |
| .stop() : Object stops the notification subscription |
4D.IMAPNotifier.new()
4D.IMAPNotifier.new() : 4D.IMAPNotifier
| 引数 | 型 | 説明 | |
|---|---|---|---|
| 戻り値 | 4D.IMAPNotifier | <- | New IMAPNotifier object |
説明
The 4D.IMAPNotifier.new() function creates a new IMAPNotifier object.
.isStarted
.isStarted : Boolean
説明
The .isStarted property indicates whether the notifier is started (true) or stopped (false). このプロパティは 読み取り専用 です。
.start()
.start() : Object
| 引数 | 型 | 説明 | |
|---|---|---|---|
| 戻り値 | Object | <- | Operation status |
説明
The .start() function starts the subscription to server notifications and activates IMAP listener callbacks.
A mailbox must be selected using selectBox() before calling .start().
Callback functions are executed in the worker where .start() is called.
-
When the notifier is started, other transporter functions (such as
getMail()orsend()) are not available. You must call.stop()before using these functions, then call.start()again to resume notifications. -
IMAP IDLE notifications indicate that a change has occurred but do not provide updated mailbox data. To refresh the mailbox state, you must stop the notifier, retrieve the updated data (for example using
getMail()), and then restart it.
返されるオブジェクト
| プロパティ | 型 | 説明 | |
|---|---|---|---|
| success | Boolean | 処理が正常に終わった場合には true、それ以外は false | |
| statusText | Text | IMAPサーバーから返されたステータスメッセージ、または 4Dエラースタック内に返された最後のエラー | |
| errors | Collection | 4D error stack (not returned if a server response is received) | |
| [].errcode | Number | 4Dエラーコード | |
| [].message | Text | エラーの詳細 | |
| [].componentSignature | Text | Signature of the component that returned the error |
.stop()
.stop() : Object
| 引数 | 型 | 説明 | |
|---|---|---|---|
| 戻り値 | Object | <- | Operation status |
説明
The .stop() function stops the notification subscription. Calling .stop() is required before using other transporter functions (such as getMail() or send()).
返されるオブジェクト
| プロパティ | 型 | 説明 | |
|---|---|---|---|
| success | Boolean | 処理が正常に終わった場合には true、それ以外は false | |
| statusText | Text | IMAPサーバーから返されたステータスメッセージ、または 4Dエラースタック内に返された最後のエラー | |
| errors | Collection | 4D error stack (not returned if a server response is received) | |
| [].errcode | Number | 4Dエラーコード | |
| [].message | Text | エラーの詳細 | |
| [].componentSignature | Text | Signature of the component that returned the error |