TInstinct

source/classes/tinstinct.prg

Prototype email transport for an application to talk to its user's own Instinct. This is not an official API. A separately configured receiver is required; sending email does not authorize actions.

Configuration

Only a local relay (127.0.0.1 or localhost) is accepted. The external hop must use TLS and validate certificates. Default ports are SMTP 25 and POP 110; override nSmtpPort and nPopPort as needed. Set cPopUser/cPopPassword for a dedicated reply mailbox.

Examples

oInstinct := TInstinct():New( cFrom, cToken, cTo )
if oInstinct:Send( "Hello Instinct" )
   cAnswer := oInstinct:Answer( 10 )
endif

// Register once, then call Pump() from the application's timer:
oInstinct:OnAnswer( {| cText, cId | MsgInfo( cText, cId ) } )
oInstinct:Pump()

Answer() waits and blocks. OnAnswer() registers a callback; Pump() polls once from a timer, but the connection can take up to nTimeout. It does not start a background thread.

samples/instinct/tinstinct.prg: INSTINCT_FROM, INSTINCT_TOKEN, INSTINCT_TO, INSTINCT_POP_USER, INSTINCT_POP_PASSWORD.

State and limits

The limit counts unprocessed messages, not the first mailbox positions: seen UIDLs are skipped and later calls reach the remaining mail. Answer() retains other-ID replies in aPending for another Answer() or Pump(). That queue lives in the instance; use one instance per mailbox and drain it before closing. Mail is kept on the server: archive processed mail to avoid long scans.