# Titanium.UI.EmailDialog
An email dialog is a modal window that allows users to compose and send an email.
# Overview
Android | iOS | Windows |
---|---|---|
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>Appcelerator Titanium Rocks!</b>';
var f = Ti.Filesystem.getFile('cricket.wav');
emailDialog.addAttachment(f);
emailDialog.open();
# Properties
# barColor
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
Recipients of the email included via the BCC
(Blind Carbon Copy) field.
# ccRecipients
Recipients of the email included via the CC
(Carbon Copy) field.
# html
Determines whether the email message, specifically the contents of messageBody, should be sent as HTML content type rather than plain text.
Default: false
# Methods
# addAttachment
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
Name | Type | Description |
---|---|---|
attachment | Titanium.Blob | Titanium.Filesystem.File | Attachment to include in the email. |
Returns
- Type
- void
# isSupported
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
- Type
- Boolean
# open
Opens this email dialog.
Parameters
Name | Type | Description |
---|---|---|
options | AnimatedOptions | Supported on iOS only. Simple object to override animation. Note that the default here is equivalent to passing in |
Returns
- Type
- void
# Events
# complete
Fired when this email dialog has completed sending an email.
Properties
Name | Type | Description |
---|---|---|
success | Boolean | Indicates if the email was handled successfully.
Returns |
error | String | Error message, if any returned. Will be undefined if |
code | Number | Error code.
Error code will be 0 if |
result | Number | Status of the email send process. The On Android, this property will return |
source | Object | Source object that fired the event. |
type | String | Name of the event fired. |
bubbles | Boolean | True if the event will try to bubble up if possible. |
cancelBubble | Boolean | Set to true to stop the event from bubbling. |