RTI_GetMail function

This function will retrieve emails from a POP3 or IMAP server, using authenticated logins and/or Secure Sockets Layer (SSL). Users can retrieve entire emails, or headers only; and (for IMAP servers) can specify search/selection criteria.

In OpenInsight 10+, this function is now a thin wrapper around RTI_EMAIL_CLIENT. For other information, including more details on options, please see RTI_EMAIL_CLIENT.

RTI_GetMail(mailservername, mailservertype, Username, Password, useSSL, bHeadersOnly, bSkipAttachments, searchParamNames, searchParamVals, otherOptions, errStatus)

The function has the following parameters:

ParameterDescription
mailservernameThe IP address of the mailserver.
mailservertypeSpecify POP (or use the equated value EMAIL_SERVER_TYPE_POP$) to indicate a POP3 connection; specify IMAP (or use the equated value EMAIL_SERVER_TYPE_IMAP$) to indicate an IMAP connection
usernameThe username of the mail account.
passwordThe password of the mail account.
useSSLA boolean flag. When TRUE$ SSL will be used when connecting to the mail server.
bHeadersOnlyA boolean flag. When TRUE$ the message body and any attachments will NOT be retrieved.
bSkipAttachmentsA boolean flag. When TRUE$ attachments will not be retrieved.
searchParamNamesFor IMAP servers only. An @FM delimited list of recognized search parameter names, such as FROM (the sender), SINCE (date sent) or UNSEEN (for unseen messages).
searchParamValsFor IMAP servers only. An associated @FM delimited list of parameters, corresponding with the searchParamNames. Multiple values for a particular search parameter name may be @VM delimited.
otherOptionsA dynamic array containing a list of option names (in field 1), and the asociated option values (in field 2). Option names include "mark" (to mark the emails as read) and "delete" (to delete the selected emails).
errStatusError information and details, if any, generated by the request

The function returns the selected message(s); any error information is returned via the errStatus parameter. Multiple messages are returned @RM delimited. The fields returned per message are:

<1> From

<2> Recipient (multiple recipients are @VM delimited)

<3> Subject

<4> Body (@TM replacing CRLF$)

<5> cc (multiple cc's are @VM delimited)

<6> Headers

<7> ReplyTo (multiple reply-to addresses are @VM delimited)

<8> Content type

<9> Attachments

<10> Date

<11> Message Flags

<12> Message ID


$Insert RTI_EMAIL_EQUATES

mailservername = 'pop.mailserver.com'

mailserverPort='995';* use the proper port

mailServer = mailServerName:':':mailserverPort

username = 'my_username'

password = 'my_password'

useSSl = 1

headersOnly = 0

noAttachments = 0

searchParamNames = "" ;* unused with POP

searchParamVals = "" ;* unused with POP

otherOpts = ""

errStatus = ""

mailList = RTI_GetMail( mailserver, EMAIL_SERVER_TYPE_POP$, username, password, useSSl, headersOnly, noAttachments, searchParamVals, searchParamVals, otherOpts, errStatus)

if mailList = "" then

   *Errors in errStatus

end else

   num.messages = dcount(mailList, @RM)

   for each.message = 1 to num.messages

      this.message = field(mailList, @RM, each.message)

      subject = this.message<EMSG_SUBJECT$>

      date = this.message<EMSG_DATE$>

      * perform desired operations with this information

   next each.message

end
  • guides/programming/programmers_reference_manual/rti_getmail.txt
  • Last modified: 2024/10/25 18:53
  • by bshumsky