Titanium.UI.EmailDialog

Object of Titanium.UI.
Platform Since
Android 0.8
iPhone 0.8
iPad 0.8

Summary

The Email Dialog is created by Titanium.UI.createEmailDialog and allows you to send in application emails on behalf of the application user.

Code Examples

Simple Email Dialog with Attachment

In this example, we send an email with a file attachment.

var emailDialog = Titanium.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();

Methods

Name Summary
addAttachment

add an attachment to the email. The attachment can either be a Blob or File object. Note: Versions before 1.7.1 will only support one attachment in Android. Since version 1.7.1, our Android implementation will accept multiple attachments, but multiple attachments will only work if the user chooses to send via the Android Gmail app; the Android "Mail" app (which is anyway not available on some handsets) will only accept one attachment from a Titanium app. K9 has also been tested successfully with multiple attachments.

addEventListener

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

fireEvent

Fires a synthesized event to any registered listeners.

getBarColor

Gets the value of the barColor property.

getBccRecipients

Gets the value of the bccRecipients property.

getCcRecipients

Gets the value of the ccRecipients property.

getHtml

Gets the value of the html property.

getMessageBody

Gets the value of the messageBody property.

getSubject

Gets the value of the subject property.

getToRecipients

Gets the value of the toRecipients property.

isSupported

return whether or not sending email is supported

open

open the email dialog. the email dialog itself is a modal window

removeEventListener

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

setBarColor

Sets the value of the barColor property.

setBccRecipients

Sets the value of the bccRecipients property.

setCcRecipients

Sets the value of the ccRecipients property.

setHtml

Sets the value of the html property.

setMessageBody

Sets the value of the messageBody property.

setSubject

Sets the value of the subject property.

setToRecipients

Sets the value of the toRecipients property.

Properties

Name Type Summary
CANCELLED Number

constant for the CANCELLED status result read-only

FAILED Number

constant for the FAILED status result read-only

SAVED Number

constant for the SAVED status result read-only

SENT Number

constant for the SENT status result read-only

barColor String

the bar color of the email dialog window when opened

bccRecipients Array<Object>

array of email BCC: recipients

ccRecipients Array<Object>

array of email CC: recipients

html Boolean

boolean to indicate whether the email messageBody should be sent as HTML content type. defaults to false. (Android note: you should not use html messages in 1.6: after that is okay.)

messageBody String

the email message body

subject String

the subject line for the email

toRecipients Array<Object>

array of email recipients

Events

Name Summary
complete

fired when the email dialog has completed sending the email