composeMail

Invokes the user's default mail application for a new mail to send.

Syntax

ui.Interface.frontCall("mobile", "composeMail",
   [to, subject, content, cc, bcc, attachments ...],
   [result])
  • to - A list of recipients, separated by commas. While the list uses commas to separate the recipients in the list, the list itself is enclosed in a single set of quotes.
  • subject - The subject of the email.
  • content - The body of the email.
  • cc - (optional) A list of recipients for the carbon-copy email field, separated by commas. While the list uses commas to separate the recipients in the list, the list itself is enclosed in a single set of quotes.
  • bcc - (optional) A list of recipients for the blind carbon-copy email field, separated by commas. While the list uses commas to separate the recipients in the list, the list itself is enclosed in a single set of quotes.
  • attachments ... - (optional) All remaining arguments are treated as paths to attachment files. Each attachment file name is enclosed in its own set of quotes. The comma is used to separate the attachments in the list.
  • result - Holds a status message.

Usage

The "composeMail" front call invokes the user's default mail application and sets up a new mail to send.

The returned result string takes one of the following values:
  • "ok": The email was send.
  • "cancel": The email was canceled.
  • "saved": The email was saved.
  • "failed: reason": The email was not sent.

This example opens an email and populates the To, CC, and BCC fields, the Subject line, the message body, and it specifies two attachments..

DEFINE result STRING
CALL ui.Interface.frontCall("mobile", "composeMail",
 ["john.doe@4js.com,jane.doe@4js.com", "Hello world",
  "This is the hello world text", "john.doe@4js.com,jane.doe@4js.com", "hidden@4js.com",
  "/sdcard/Pictures/photo1.jpg", "/sdcard/Pictures/photo2.jpg" ], [result])

The next example opens an email and populates the To field, the Subject line, and the message body. No CC or BCC recipients and no attachments are specified.

DEFINE result STRING
CALL ui.Interface.frontCall("mobile","composeMail",
 ["huhu@haha.com","test mail","sent from my device"],[result])