Skip to content
Titanium SDK
Version12.7.0

You are reading 12.7.0. See this page in 13.4.1.

Titanium.UI.EmailDialog

viewAndroidiPhoneiPadmacOSsince 0.8

Extends Titanium.UI.ViewTitanium.Proxy

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

Android iOS
Android iOS

The Email Dialog is created with the Titanium.UI.createEmailDialog method. The user needs to register an e-mail account on the device in order to open the dialog. The dialog will not open when there is not a registered e-mail account.

iOS Platform Notes

On iOS, you cannot test the e-mail dialog on the iOS Simulator. Test the email dialog on device.

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>Titanium SDK Rocks!</b>';
var f = Ti.Filesystem.getFile('cricket.wav');
emailDialog.addAttachment(f);
emailDialog.open();

Properties 34

apiName

Stringsince Android 3.2.0, iPhone 3.2.0, iPad 3.2.0, macOS 9.2.0read-only

Inherited from Titanium.Proxy

The name of the API that this proxy corresponds to.

barColor

String | Titanium.UI.ColoriPhoneiPadmacOS

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.

bccRecipients

Array<String>

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

bubbleParent

Booleansince Android 3.0.0, iPhone 3.0.0, iPad 3.0.0, macOS 9.2.0

Inherited from Titanium.Proxy

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

Default: true

CANCELLED

NumberiPhoneiPadmacOSread-only

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

ccRecipients

Array<String>

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

elevation

NumberAndroidsince 5.0.0Android 5+

Inherited from Titanium.UI.View

Base elevation of the view relative to its parent in pixels.

FAILED

Numberread-only

Constant for the FAILED status result.

html

Boolean

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

Default: false

rotation

NumberAndroidiPhoneiPadsince Android 5.4.0, iPhone 12.3.0, iPad 12.3.0

Inherited from Titanium.UI.View

Clockwise 2D rotation of the view in degrees.

SAVED

Numberread-only

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

SENT

Numberread-only

Constant for the SENT status result.

subject

String

Subject line for the email.

tooltip

Stringsince 12.1.0iOS 15.0+

Inherited from Titanium.UI.View

The default text to display in the control's tooltip.

toRecipients

Array<String>

Recipients of the email included via the main TO field.

touchFeedback

BooleanAndroidsince 6.1.0

Inherited from Titanium.UI.View

A material design visual construct that provides an instantaneous visual confirmation of touch point.

Default: false

translationX

NumberAndroidsince 5.0.0

Inherited from Titanium.UI.View

Horizontal location of the view relative to its left position in pixels.

Methods 14

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.

Parameters
ParametersTypeDescription
attachmentTitanium.Blob | Titanium.Filesystem.File

Attachment to include in the email.

Inherited from Titanium.Proxy

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

Parameters
ParametersTypeDescription
nameString

Name of the event.

callbackCallback<Titanium.Event>

Callback function to invoke when the event is fired.

4 fields
bubbles Boolean

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

cancelBubble Boolean

Set to true to stop the event from bubbling.

source Object

Source object that fired the event.

type String

Name of the event fired.

Inherited from Titanium.Proxy

Fires a synthesized event to any registered listeners.

Parameters
ParametersTypeDescription
nameString

Name of the event.

event?Dictionary

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

getViewById

since 6.1.0

Inherited from Titanium.UI.View

Returns the matching view of a given view ID.

Parameters
ParametersTypeDescription
idString

The ID of the view that should be returned. Use the id property in your views to enable it for indexing in this method.

Inherited from Titanium.UI.View

Hides this view.

Parameters
ParametersTypeDescription
options?AnimatedOptions

Animation options for Android only. Since SDK 5.1.0 and used only on Android 5.0+

Determines whether to enable a circular reveal animation. Note that the default here is equivalent to passing in { animated: false }

insertAt

since 3.3.0

Inherited from Titanium.UI.View

Inserts a view at the specified position in the children array.

Parameters
ParametersTypeDescription
paramsViewPositionOptions

Pass an object that specifies the view to insert and optionally at which position (defaults to end)

2 fields
position? Number

Position in the children array of the view element to replace.

view Titanium.UI.View

View to insert. Required.

Indicates whether sending email is supported by the system.

On iOS 10, the user is able to uninstall the built-in applications including Mail. Because of that, you should ensure to check if the email dialog is supported on the current device.

Returns Boolean

Opens this email dialog.

Parameters
ParametersTypeDescription
options?AnimatedOptions

Supported on iOS only. Simple object to override animation. Note that the default here is equivalent to passing in { animated: true } (while typically the default for AnimatedOptions is false)

Inherited from Titanium.Proxy

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

Parameters
ParametersTypeDescription
nameString

Name of the event.

callbackCallback<Titanium.Event>

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

4 fields
bubbles Boolean

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

cancelBubble Boolean

Set to true to stop the event from bubbling.

source Object

Source object that fired the event.

type String

Name of the event fired.

replaceAt

since 3.3.0

Inherited from Titanium.UI.View

Replaces a view at the specified position in the children array.

Parameters
ParametersTypeDescription
paramsViewPositionOptions

Pass an object with the view to insert and the position of the view to replace. In this case the position property is required.

2 fields
position? Number

Position in the children array of the view element to replace.

view Titanium.UI.View

View to insert. Required.

Inherited from Titanium.UI.View

Makes this view visible.

Parameters
ParametersTypeDescription
options?AnimatedOptions

Animation options for Android only. Since SDK 5.1.0 and only used on Android 5.0+

Determines whether to enable a circular reveal animation. Note that the default here is equivalent to passing in { animated: false }

Events 2

Fired when this email dialog has completed sending an email.

Event properties
Event propertiesTypeDescription
successBoolean

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.

errorString

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

codeNumber

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.

resultNumber

Status of the email send process.

The SAVED and CANCELLED constants are iOS only.

On Android, this property will return SENT when the user discards or saves a message.

rotate

since 12.7.0

Inherited from Titanium.UI.View

Fired when the device detects a two finger rotation.

Event properties
Event propertiesTypeDescription
rotateNumber

Rotation in degrees.