Titanium 3.X

Titanium.UI.EmailDialog

> Titanium.UI.EmailDialog

An email dialog is a modal window that allows users to compose and send an email.

The Email Dialog is created by Titanium.UI.createEmailDialog.

On Mobile Web and Tizen, the to addresses, cc addresses, bcc addresses, subject, and body are appended together and formatted into a mailto: URL. This URL typically has a limit of approximately 2000 characters.

Examples

Simple Email Dialog with Attachment

Create and send an email with a file attachment.

var emailDialog = Ti.UI.createEmailDialog()
emailDialog.subject = "Hello from Titanium";
emailDialog.toRecipients = ['foo@yahoo.com'];
emailDialog.messageBody = '<b>Appcelerator Titanium Rocks!</b>';
var f = Ti.Filesystem.getFile('cricket.wav');
emailDialog.addAttachment(f);
emailDialog.open();

Alloy XML Markup

Previous example as an Alloy view.

emaildialog.xml:

<Alloy>
    <EmailDialog id="emailDialog" subject="Hello from Titanium" messageBody="<b>Appcelerator Titanium Rocks!</b>" />
</Alloy>

emaildialog.js:

$.emailDialog.toRecipients = ['foo@yahoo.com'];
var f = Ti.Filesystem.getFile('cricket.wav');
$.emailDialog.addAttachment(f);

  • 0.8
  • 0.8
  • 0.8
  • 1.8
  • 3.1
  • 3.1.2
Defined By

Properties

Titanium.UI.EmailDialog
: Numberreadonly
Constant for the CANCELLED status result. ...

Constant for the CANCELLED status result. On Android, this property exists but is not used.

  • 0.8
  • 0.8
  • 3.1
Titanium.UI.EmailDialog
FAILED : Numberreadonly

Constant for the FAILED status result.

Constant for the FAILED status result.

  • 0.8
  • 0.8
  • 0.8
  • 1.8
  • 3.1
Titanium.UI.EmailDialog
: Numberreadonly
Constant for the SAVED status result. ...

Constant for the SAVED status result. On Android, this property exists but is not used.

  • 0.8
  • 0.8
  • 0.8
  • 1.8
Titanium.UI.EmailDialog
SENT : Numberreadonly

Constant for the SENT status result.

Constant for the SENT status result.

  • 0.8
  • 0.8
  • 0.8
  • 1.8
  • 3.1
apiName : Stringreadonly

The name of the API that this proxy corresponds to.

The name of the API that this proxy corresponds to.

The value of this property is the fully qualified name of the API. For example, Button returns Ti.UI.Button.

  • 3.2
  • 3.2
  • 3.2
  • 3.2
  • 3.2
  • 3.2
Titanium.UI.EmailDialog
barColor : String

Bar color of the email dialog window, as a color name or hex triplet.

Bar color of the email dialog window, as a color name or hex triplet.

For information about color values, see the "Colors" section of Titanium.UI.

  • 0.8
  • 0.8
Titanium.UI.EmailDialog
bccRecipients : String[]

Recipients of the email included via the BCC (Blind Carbon Copy) field.

Recipients of the email included via the BCC (Blind Carbon Copy) field.

Indicates if the proxy will bubble an event to its parent. ...

Indicates if the proxy will bubble an event to its parent.

Some proxies (most commonly views) have a relationship to other proxies, often established by the add() method. For example, for a button added to a window, a click event on the button would bubble up to the window. Other common parents are table sections to their rows, table views to their sections, and scrollable views to their views. Set this property to false to disable the bubbling to the proxy's parent.

Default: true

  • 3.0
  • 3.0
  • 3.0
Titanium.UI.EmailDialog
ccRecipients : String[]

Recipients of the email included via the CC (Carbon Copy) field.

Recipients of the email included via the CC (Carbon Copy) field.

Titanium.UI.EmailDialog
: Boolean
Determines whether the email message, specifically the contents of messageBody, should be sent as HTML content type ...

Determines whether the email message, specifically the contents of messageBody, should be sent as HTML content type rather than plain text.

On Mobile Web and Tizen, while iPhone and iPad properly interpret HTML messages, some email clients, especially those for the desktop, do not support them.

Default: false

  • 0.8
  • 0.8
  • 0.8
  • 1.8
  • 3.1.2
Titanium.UI.EmailDialog
messageBody : String

Email message body.

Email message body.

Titanium.UI.EmailDialog
subject : String

Subject line for the email.

Subject line for the email.

Titanium.UI.EmailDialog
toRecipients : String[]

Recipients of the email included via the main TO field.

Recipients of the email included via the main TO field.

Defined By

Methods

Titanium.UI.EmailDialog
( attachment ) : void
Adds an attachment. ...

Adds an attachment.

On Android, multiple attachments may be added, but will only work if the user chooses to send via the Android Gmail or K9 mail clients.

The Android "Mail" app, which is only available on some handsets, will only accept one attachment from a Titanium app.

  • 0.8
  • 0.8
  • 0.8
  • 3.1.2

Parameters

Returns

  • void
( name, callback ) : void
Adds the specified callback as an event listener for the named event. ...

Adds the specified callback as an event listener for the named event.

Parameters

  • name : String

    Name of the event.

  • callback : Callback<Object>

    Callback function to invoke when the event is fired.

Returns

  • void
Applies the properties to the proxy. ...

Applies the properties to the proxy.

Properties are supplied as a dictionary. Each key-value pair in the object is applied to the proxy such that myproxy[key] = value.

  • 3.0
  • 3.0
  • 3.0

Parameters

  • props : Dictionary

    A dictionary of properties to apply.

Returns

  • void
( name, event ) : void
Fires a synthesized event to any registered listeners. ...

Fires a synthesized event to any registered listeners.

Parameters

  • name : String

    Name of the event.

  • event : Dictionary

    A dictionary of keys and values to add to the Titanium.Event object sent to the listeners.

Returns

  • void
Gets the value of the apiName property. ...

Gets the value of the apiName property.

  • 3.2
  • 3.2
  • 3.2
  • 3.2
  • 3.2
  • 3.2

Returns

  • String
Titanium.UI.EmailDialog
( ) : String
Gets the value of the barColor property. ...

Gets the value of the barColor property.

  • 0.8
  • 0.8

Returns

  • String
Titanium.UI.EmailDialog
( ) : String[]
Gets the value of the bccRecipients property. ...

Gets the value of the bccRecipients property.

Returns

  • String[]
Gets the value of the bubbleParent property. ...

Gets the value of the bubbleParent property.

  • 3.0
  • 3.0
  • 3.0

Returns

  • Boolean
Titanium.UI.EmailDialog
( ) : String[]
Gets the value of the ccRecipients property. ...

Gets the value of the ccRecipients property.

Returns

  • String[]
Titanium.UI.EmailDialog
( ) : Boolean
Gets the value of the html property. ...

Gets the value of the html property.

  • 0.8
  • 0.8
  • 0.8
  • 1.8
  • 3.1.2

Returns

  • Boolean
Titanium.UI.EmailDialog
( ) : String
Gets the value of the messageBody property. ...

Gets the value of the messageBody property.

Returns

  • String
Titanium.UI.EmailDialog
( ) : String
Gets the value of the subject property. ...

Gets the value of the subject property.

Returns

  • String
Titanium.UI.EmailDialog
( ) : String[]
Gets the value of the toRecipients property. ...

Gets the value of the toRecipients property.

Returns

  • String[]
Titanium.UI.EmailDialog
( ) : Boolean
Indicates whether sending email is supported by the system. ...

Indicates whether sending email is supported by the system.

  • 0.8
  • 0.8
  • 0.8
  • 1.8
  • 3.1

Returns

  • Boolean
Titanium.UI.EmailDialog
( properties ) : void
Opens this email dialog. ...

Opens this email dialog.

To use this method on Tizen, you must include the following privilege in the tiapp.xml file of your Titanium application:

  • http://tizen.org/privilege/application.launch

Parameters

  • properties : Object

    Animation properties. Set animated Boolean property to true to animate dialog on open. (iPhone, iPad only)

Returns

  • void
( name, callback ) : void
Removes the specified callback as an event listener for the named event. ...

Removes the specified callback as an event listener for the named event.

Multiple listeners can be registered for the same event, so the callback parameter is used to determine which listener to remove.

When adding a listener, you must save a reference to the callback function in order to remove the listener later:

var listener = function() { Ti.API.info("Event listener called."); }
window.addEventListener('click', listener);

To remove the listener, pass in a reference to the callback function:

window.removeEventListener('click', listener);

Parameters

  • name : String

    Name of the event.

  • callback : Callback<Object>

    Callback function to remove. Must be the same function passed to addEventListener.

Returns

  • void
Titanium.UI.EmailDialog
( barColor ) : void
Sets the value of the barColor property. ...

Sets the value of the barColor property.

  • 0.8
  • 0.8

Parameters

  • barColor : String

    New value for the property.

Returns

  • void
Titanium.UI.EmailDialog
( bccRecipients ) : void
Sets the value of the bccRecipients property. ...

Sets the value of the bccRecipients property.

Parameters

  • bccRecipients : String[]

    New value for the property.

Returns

  • void
( bubbleParent ) : void
Sets the value of the bubbleParent property. ...

Sets the value of the bubbleParent property.

  • 3.0
  • 3.0
  • 3.0

Parameters

  • bubbleParent : Boolean

    New value for the property.

Returns

  • void
Titanium.UI.EmailDialog
( ccRecipients ) : void
Sets the value of the ccRecipients property. ...

Sets the value of the ccRecipients property.

Parameters

  • ccRecipients : String[]

    New value for the property.

Returns

  • void
Titanium.UI.EmailDialog
( html ) : void
Sets the value of the html property. ...

Sets the value of the html property.

  • 0.8
  • 0.8
  • 0.8
  • 1.8
  • 3.1.2

Parameters

  • html : Boolean

    New value for the property.

Returns

  • void
Titanium.UI.EmailDialog
( messageBody ) : void
Sets the value of the messageBody property. ...

Sets the value of the messageBody property.

Parameters

  • messageBody : String

    New value for the property.

Returns

  • void
Titanium.UI.EmailDialog
( subject ) : void
Sets the value of the subject property. ...

Sets the value of the subject property.

Parameters

  • subject : String

    New value for the property.

Returns

  • void
Titanium.UI.EmailDialog
( toRecipients ) : void
Sets the value of the toRecipients property. ...

Sets the value of the toRecipients property.

Parameters

  • toRecipients : String[]

    New value for the property.

Returns

  • void
Defined By

Events

Titanium.UI.EmailDialog
Fired when this email dialog has completed sending an email. ...

Fired when this email dialog has completed sending an email.

On Mobile Web and Tizen, as the platform cannot determine whether a message has been sent or not, this event fires immediately after calling open() and always reports success.

  • 0.8
  • 0.8
  • 0.8
  • 1.8
  • 3.1

Properties

  • bubbles : Boolean

    True if the event will try to bubble up if possible.

    •  
    •  
    •  
  • cancelBubble : Boolean

    Set to true to stop the event from bubbling.

    •  
    •  
    •  
  • code : Number

    Error code. Error code will be 0 if success is true, nonzero otherwise. If the error was generated by the operating system, that system's error value is used. Otherwise, this value will be -1.

  • error : String

    Error message, if any returned. Will be undefined if success is true.

  • result : Number

    Status of the email send process. One of SENT, FAILED, SAVED (iOS only) or CANCELLED (iOS only).

    Note that on Android this property will return SENT when the user discards or saves a message.

  • source : Object

    Source object that fired the event.

  • success : Boolean

    Indicates if the email was handled successfully. Returns true if request succeeded, false otherwise. Note that emails being deleted or saved for later do count as success.

  • type : String

    Name of the event fired.