Mail server connection using IMAP protocol

  
      try {
      const folders = imap.listFolders()
      console.debug('Available folders are:', folders)

      console.log('select INBOX')
      imap.selectFolder('INBOX')

      // Messages that have the \Recent flag set but not the \Seen flag.
      // This is functionally equivalent to "(RECENT UNSEEN)"
      const newSNs = imap.search('NEW')
      console.log(`INBOX contains ${newSNs.length} new messages`)
      if (newSNs.length) {
        let msg = imap.receive(newSNs[0])
        try {
          inspectMessage(msg)
        } finally {
          msg.freeNative()
        }
      }
    } finally {
      imap.freeNative()
    }
  

# new UBMailImap (paramsObjobject)

Arguments:
  • paramsObj: object
    • hoststring

      mail server host

    • portstring

      mail mail server port

    • user=''string

      mail server login

    • password=''string

      mail server password

    • tlsboolean

      use tls on server request

    • fullSSLboolean

      Setup TLS before any IMAP command

    • authboolean

      authentication required

    Mail server connection parameters

Methods

# closeFolder () → boolean instance

Close a selected folder. (end of Selected state)

# deleteMessage (msgSeqNumnumber) → TubMimeMessBind instance

Mark the message with specified sequence number as Deleted.

Real deleting will be done after successful closeFolder or expungeFolder.

Arguments:

# freeNative () instance

Close IMAP connection and release all resources ASAP

# getMessagesCount (folderNameoptstring, criteriaoptstring) instance

Get a message count from a specified folder what match specified criteria

Arguments:

# getMessageSize (msgSeqNumnumber) instance

Returns size of the message with specified sequence number

Arguments:

# listFolders (initialFolderNameoptstring) → Array.<string> instance

List sub-folders of initialFolder. If initial folder is '' then list all available folders

Arguments:
  • initialFolderName = '': string

# receive (msgSeqNumnumber) → TubMimeMessBind instance

Receive a full message from current folder by it's sequence numbers. To get s message sequence numbers use a search() method.

Messages indexes are in the order they're received

Arguments:

# selectFolder (folderNamestring) → boolean instance

Select a folder by it's name. Returns true on success or throw on error

Arguments: