Xbasic

EMAIL_RECEIVE Function

Syntax

Count as N = email_receive([L display_inbox [,L strip_headers [,C profile [,C inbox [,C filter [,L lSilent ]]]]]])

Arguments

display_inboxLogical

Defines whether to display the Inbox when email is received. If .T., Display inbox. If .F., Do not display inbox.

strip_headersLogical

Default = .T. Defines whether to strip headers from the message body and store in separate field (called Headers) in the A_EMAIL.DBF table. If .T., Strip headers. If .F., Do not strip headers

profileCharacter

The name of your email profile as found on the View > Settings > Email > Profiles tab.

inboxCharacter

The name of a different in box. The function will create a table with this name.

filterCharacter

Default = no filter. A character filter expression that evaluates to a logical value and selects email messages to download. The filter applies to header fields.

lSilentLogical

Default = .F.

Returns

CountNumeric

Description

Receive email messages using Alpha Anywhere's built-in e-mail facility.

Discussion

EMAIL_RECEIVE() receives an email message using Alpha Anywhere's built-in email features. The function does not require that you have a third party email client (such as Eudora, or Outlook) installed on the computer. Email is received into a table called A_EMAIL.DBF in the Alpha Anywhere program folder.

EMAIL_RECEIVE() does not check to see if it is downloading duplicate messages.

You can control how many messages Alpha Anywhere will try to retrieve from the mail server, and whether Alpha Anywhere should leave the messages on the server after reading them by adjusting your email settings. To set email settings, select the View > Settings command from the menu, and navigate to the Email category.

Attachments will be stored in the "Attachments" folder off the Alpha Anywhere program folder.

The A_EMAIL.DBF table now has two new fields, receive_date and receive_time. If you have an existing A_EMAIL.DBF table (in the Alpha Anywhere program folder), you must delete this file. Then, the next time you use the EMAIL_RECEIVE() function, Alpha Anywhere will recreate this table with the necessary additional fields.

If you put a filter in, EMAIL_RECEIVE() will download all the headers, filter based on the criteria you have specified, and then download only the messages that match the criteria. Any valid RFC822 message header field can be sorted on ( from, to, date, subject, contenttype, etc). If the header field name contains any special characters or spaces, they will be removed. An example of that is "content-type" which would be contenttype. There is also a reserved word, size, that is the size in bytes of the entire message including headers.

Example 

Receives an email message using Alpha Anywhere's internal email facility.

email_receive(.T.)

Download only messages less than 1KB.

email_receive(.T., .T., "", "", "Size < 1024")

Other sample filters.

email_receive(.T., .T., "", "", "\"viagra\"" $ subject")
email_receive(.T., .T., "", "", "\"[email protected]\" $ from")
email_receive(.T., .T., "", "", "Contenttype = "\"text/plain\"")

See Also