© 2009 OMTP Ltd. All rights reserved. OMTP and OMTP BONDI are registered trademarks of OMTP Ltd.
To access the email, sms and messaging functions of the phone The BONDI messaging API provides access to the messaging device system. With this API, messages (SMS,MMS,EMAIL) can be created and sent. The following methods are used to create messages: All these methods return a specific message object, the object type depends on the method used to create it. -createSMS() - returns an SMS object. -createMMS() - returns an MMS object. -createEmail() - returns an Email object. Each of these methods accepts the object properties as an input parameter in the form of a map. The keys supported are returned by the getxxxSupportedPropertyKey provided by the Communications Log API
MMSSlidesArray
MessagingErrorCallback
MessagingError
MessagingManager
SMSMessage
MMSSlide
MMSMessage
EmailMessage
| Interface | Method |
|---|---|
| MessagingErrorCallback | void onError(MessagingError error) |
| MessagingError | |
| MessagingManager | SMSMessage createSMS(SmsObject smsParams) MMSMessage createMMS(MmsObject mmsParams) EmailMessage createEmail(EmailObject emailParams) PendingOperation sendSMS(SuccessCallback successCallback, MessagingErrorCallback errorCallback, SMSMessage sms) PendingOperation sendMMS(SuccessCallback successCallback, MessagingErrorCallback errorCallback, MMSMessage mms) PendingOperation sendEmail(SuccessCallback successCallback, MessagingErrorCallback errorCallback, EmailMessage email) PendingOperation getAvailableEmailAccounts(SuccessCallback successCallback, ErrorCallback errorCallback) |
| SMSMessage | Object getProperty(DOMString propertyName) void setProperty(DOMString propertyName, DOMString propertyValue) StringArray getRecipients() DOMString getRecipient(unsigned short index) void appendRecipient(DOMString phoneNumber) void clearRecipients() |
| MMSSlide | |
| MMSMessage | Object getProperty(DOMString propertyName) void setProperty(DOMString propertyName, Object propertyValue) StringArray getRecipients() DOMString getRecipient(unsigned long index) void appendRecipient(DOMString phoneNumber) void clearRecipients() FileArray getAttachments() File getAttachment(unsigned short index) void appendAttachment(File myAttachment) void clearAttachments() |
| EmailMessage | DOMString getProperty(DOMString propertyName) void setProperty(DOMString propertyName, DOMString propertyValue) StringArray getToList() DOMString getTo(unsigned short index) StringArray getCCList() DOMString getCC(unsigned short index) StringArray getBCCList() DOMString getBCC(unsigned short index) void appendTo(DOMString emailAddress) void clearTo() void appendCC(DOMString emailAddress) void clearCC() void appendBCC(DOMString emailAddress) void clearBCC() FileArray getAttachments() File getAttachment(unsigned short index) void appendAttachment(File myAttachment) void clearAttachments() |
This API provides the functionality to send messages already created by the methods explained above. The following methods are used to send messages: -sendSMS() -sendMMS() -sendEmail()
The Messaging API exposes classes to manage the messaging objects (SMS,MMS,EMAIL). Multiple recipients can be added to the messages using the appendRecipient method. With the MMS and EMAIL you can attach files using the appendAttachment() method.
This is the list of URIs used to declare this API's features, for use in bondi.requestFeature. For each URL, the list of functions provided is provided.
Call to the sendEmail in the messagingManager
Device capabilities: messaging.email.send
Call to the sendMMS in the messagingManager
Device capabilities: messaging.mms.send
Call to the sendSMS method in the messagingManager
Device capabilities: messaging.sms.send
Call to the getAvailableEmailAccounts method in the messagingManager
Device capabilities: messaging.email.getAccounts
Call to the appendAttachments in the email object
Device capabilities: messaging.email.attach
Call to the appendAttachments in the mms object
Device capabilities: messaging.mms.attach
messaging.email.attach
Add/change attachment on an email
messaging.mms.attach
Add/change attachment on an MMS
messaging.email.getAccounts
Get email accounts
messaging.email.send
Sends an email message
Security parameters:
recipients:
Space-separated list of recipient email addresses.
inContacts:
yes or undefined value depending on whether all
recipients are in contacts list
messaging.mms.send
Sends an mms message
Security parameters:
recipients:
Space-separated list of recipient phone numbers. Any
international phone number must start with a U+002B PLUS SIGN.
inContacts:
yes or undefined value depending on whether all
recipients are in contacts list
messaging.sms.send
Sends an sms message
Security parameters:
recipients:
Space-separated list of recipient phone numbers. Any
international phone number must start with a U+002B PLUS SIGN.
inContacts:
yes or undefined value depending on whether all
recipients are in contacts list
MMSSlidesArray
Array of slides
typedef sequence<MMSSlide> MMSSlidesArray;
MessagingErrorCallback
The messaging API specific error callback.
[Callback] interface MessagingErrorCallback {
void onError(in MessagingError error);
};
This error callback defines the interface to use for all asynchronous methods of the messaging API which are using error callbacks. The callback is invoked with a MessagingError object that describes the ocurred error.
MessagingError
Messaging Errors
interface MessagingError : DeviceAPIError {
const unsigned short OUT_OF_COVERAGE_ERROR = 1;
const unsigned short MMS_VIDEO_SLIDE_ERROR = 2;
const unsigned short MMS_MESSAGE_SIZE_EXCEEDED_ERROR = 3;
};
This interface inherits from: DeviceAPIError
unsigned
short
OUT_OF_COVERAGE_ERROR
There is no coverage
unsigned
short
MMS_VIDEO_SLIDE_ERROR
Media addition is not possible, since the slide already includes a media file that cannot coexist with the others.
unsigned
short
MMS_MESSAGE_SIZE_EXCEEDED_ERROR
Message size would be exceeded by the given operation.
MessagingManager
class for managing all messaging functions
interface MessagingManager {
const unsigned short INBOX_FOLDER = 0;
const unsigned short OUTBOX_FOLDER = 1;
const unsigned short SENT_FOLDER = 2;
const unsigned short DRAFTS_FOLDER = 3;
SMSMessage createSMS([Optional] in SmsObject smsParams)
raises(DeviceAPIError);
MMSMessage createMMS([Optional] in MmsObject mmsParams)
raises(DeviceAPIError);
EmailMessage createEmail([Optional] in EmailObject emailParams)
raises(DeviceAPIError);
PendingOperation sendSMS(in SuccessCallback successCallback,
in MessagingErrorCallback errorCallback,
in SMSMessage sms)
raises(SecurityError, DeviceAPIError, MessagingError);
PendingOperation sendMMS(in SuccessCallback successCallback,
in MessagingErrorCallback errorCallback,
in MMSMessage mms)
raises(SecurityError, DeviceAPIError, MessagingError);
PendingOperation sendEmail(in SuccessCallback successCallback,
in MessagingErrorCallback errorCallback,
in EmailMessage email)
raises(SecurityError, DeviceAPIError, MessagingError);
PendingOperation getAvailableEmailAccounts(in SuccessCallback successCallback,
in ErrorCallback errorCallback)
raises(SecurityError, DeviceAPIError);
};
The messaging manager interface provides methods to create and send messages.
bondi.requestFeature(successCB, errorCB, "messaging");
unsigned
short
INBOX_FOLDER
Constant used to identify the INBOX folder.
unsigned
short
OUTBOX_FOLDER
Constant used to identify the OUTBOX folder.
unsigned
short
SENT_FOLDER
Constant used to identify the SENT folder.
unsigned
short
DRAFTS_FOLDER
Constant used to identify the DRAFTS folder.
createSMS
Creation of an SMS object
SMSMessage createSMS(SmsObject smsParams);
Creates an SMS object and stores it in the Drafts folder.
//This method creates a message in the Drafts folder with the values passed as parameters
bondi.messaging.createSMS({recipients:"+34666666666",body:"Hello from Huesca",store:false});
createMMS
Creates an MMS object and stores it in the Drafts folder.
MMSMessage createMMS(MmsObject mmsParams);
var files=getFiles();
var mms =bondi.messaging.createMMS({recipients:"+34666666666", subject:"Hello from Huesca", body:"How Are You?", attachments:files, store:false});
createEmail
Creates an Email object and stores it in the Drafts folder.
EmailMessage createEmail(EmailObject emailParams);
Supported Associative Array keys are returned by the getEmailSupportedPropertyKeys.
Common properties and associated syntax are:
from: String. The address used to send the
email. It must be configured on the default messaging
application of the phone. Addresses should be of the format
defined in RFC 5322 3.4
to: String. Semicolom(;) separated string containing
the recipients list. Addresses should be of the format
defined in RFC 5322 3.4
cc: String. Semicolom(;) separated string containing
the cc recipients list. Addresses should be of the format
defined in RFC 5322 3.4
bcc: String. Semicolom(;) separated string containing
the bcc recipients list. Addresses should be of the format
defined in RFC 5322 3.4
subject: String. Resume of the email content in the format
defined in RFC 5322 2.2
body: String. Email text in the format defined in RFC 5322 2.3
attachments: File. It's the file attached to the email.
store: Boolean. Indicates if the mms will be stored in the sent messages folder. True -> Stored
var files = getFiles();
var myEmail = bondi.messaging.createEmail({from:"pfracat@corp.vodafone.es",to:"pedro@gmail.com", cc:"pabasa1@corp.vodafone.es",bcc:"guillermo.caudevilla@vodafone.com",subject:"Hello from Huesca",body:"How Are You?",attachments:files,store:false});
sendSMS
Sends an SMS This method sends an SMS object that has been created in Drafts folder. When the message has been sent it is stored in the Sent message folder (if the store property is true). It is an asynchronous method. The success method is executed when the sms has been marked to be sent and stored in the Outgoing messaging folders. After this the OS is forced to sync mail folders.
PendingOperation sendSMS(SuccessCallback successCallback, MessagingErrorCallback errorCallback, SMSMessage sms);
//This method creates a messaging in the Drafts folder with the values passed as parameters
var sms = bondi.messaging.createSMS({body:"Just arrived in Huesca",recipients:"+34666666666"});
//This method sends the prevoius created message
bondi.messaging.sendSMS(successCallback, errorCallback,sms);
function successCallback(response) {
alert("Sent");
}
function errorCallback(response) {
alert( "The following error code: " + response.code);
}
sendMMS
Sends an MMS
PendingOperation sendMMS(SuccessCallback successCallback, MessagingErrorCallback errorCallback, MMSMessage mms);
This method sends an MMS object that has been created in the Drafts folder. When the message has been sent it is stored in the Sent message folder (if the store property is true). It is an asynchronous method. The success method is executed when the mms has been marked to be sent and stored in the Outgoing messaging folders. After this the OS is forced to sync mail folders.
var mms = bondi.messaging.createMMS(null);
mms.setProperty("body", "Just arrived today at...");
mms.subject = "In Huesca!";
mms.appendRecipient ("+34666666666");
bondi.messaging.sendMMS(successCallback, errorCallback,mms);
function successCallback(response) {
alert("Sent");
}
function errorCallback(response) {
alert( "The following error code: " + response.code);
}
sendEmail
Sends and e-mail
PendingOperation sendEmail(SuccessCallback successCallback, MessagingErrorCallback errorCallback, EmailMessage email);
This method sends an Email object that has been created in the Drafts folder. When the message has been sent it is stored in the Sent message folder (if the store property is true). It is an asynchronous method. The success method is executed when the mms has been marked to be sent and stored in the Outgoing messaging folders. After this the OS is forced to sync mail folders.
var email = bondi.messaging.createEmail();
email.setProperty("body", "Just arrived today at...");
email.subject = "In Huesca!";
email.appendTo("ester@vodafone.com");
me.sendEmail(successCallback, errorCallback,email);
function successCallback(response) {
alert("Sent");
}
function errorCallback(response) {
alert( "The following error code: " + response.code);
}
getAvailableEmailAccounts
PendingOperation getAvailableEmailAccounts(SuccessCallback successCallback, ErrorCallback errorCallback);
This method gets available email accounts that can be used (to be included in the From field). These addresses are separated by semicoloms(";"). This is an asyncronous method. Returns null if no email accounts are configured in the terminal.
var accounts = bondi.messaging.getAvailableEmailAccounts(successCallback, errorCallback, null);
function successCallback(response) {
var email = bondi.messaging.createEmail({from:response[0]});
}
function errorCallback(response) {
alert( "The following error code: " + response.code);
}
SMSMessage
SMS Message API
interface SMSMessage {
Object getProperty(in DOMString propertyName)
raises(DeviceAPIError);
void setProperty(in DOMString propertyName, in DOMString propertyValue)
raises(DeviceAPIError);
readonly attribute DOMString id;
readonly attribute Date datetime;
attribute DOMString body
setraises(DeviceAPIError);
attribute boolean store
setraises(DeviceAPIError);
readonly attribute unsigned short folder;
readonly attribute boolean read;
StringArray getRecipients();
DOMString getRecipient(in unsigned short index)
raises(DeviceAPIError);
void appendRecipient(in DOMString phoneNumber)
raises(DeviceAPIError);
void clearRecipients()
raises(DeviceAPIError);
};
The SMS Message interface provides methods to populate and send a message.
bondi.requestFeature(successCB, errorCB, "bondi.messaging");
[readonly]
DOMString
id
Integer that contains the unique identifier assigned to the message in the platform.
This is a readonly property
var sms = bondi.messaging.createSMS();
var id = sms.id;
[readonly]
Date
datetime
Object that contains the datetime where the sms was sent or received or created in draft, depending the storage folder.
var sms = bondi.messaging.createSMS(null);
var dateTime = sms.datetime;
DOMString
body
String that contains the body of the SMS.
var sms = bondi.messaging.createSMS({recipients:"+34666666666",body:"Hello from Huesca",store:false});
...
alert(sms.body);
boolean
store
Boolean that indicates whether the message is going to be stored in the SENT folder once sent.
var sms =bondi.messaging.createSMS({recipients:"+34666666666",body:"Hello from Huesca",store:false});
...
alert(sms.store);
[readonly]
unsigned
short
folder
Integer that indicates the folder in which the message is stored.
T
var sms = bondi.messaging.createSMS({recipients:"+34666666666",body:"Hello from Huesca",store:false});
alert(sms.folder);
[readonly]
boolean
read
Value that indicates if the message has been already read
var sms = bondi.messaging.createSMS(null);
var isRead = sms.read;
getProperty
Returns the value of any of the SMS message object properties.
Object getProperty(DOMString propertyName);
Supported properties
body: String. This represents the body of the sms
recipients: String. Semicolom(;) separated string containing the recipients list
store: Boolean. Indicates if the sms will be stored in the sent messages folder. True -> Stored
id: Integer. Identificator of the SMS
read: Boolean. It indicates if the SMS has been readen (true) or not (false).
folder: Integer. It indicates the folder where the sms is stored (must be one of INBOX_FOLDER, OUTBOX_FOLDER, SENT_FOLDER, DRAFTS_FOLDER defined in MessagingManager).
dateTime: Date. Date object with info about the sms creation or reception date.
var sms = bondi.messaging.createSMS();
sms.folder = bondi.messaging.DRAFTS_FOLDER;
sms.body="Hello!!";
var body = sms.getProperty("body");
setProperty
n Sets the value of any of the SMS message object properties. (body, store).
void setProperty(DOMString propertyName, DOMString propertyValue);
var sms = bondi.messaging.createSMS();
sms.setProperty("body", "Just arrived in Huesca");
getRecipients
This method returns the list of recipients added to the SMS
StringArray getRecipients();
var sms = bondi.messaging.createSMS({recipients:"+34666666666",body:"Hello from Huesca",store:true});
var recipients = sms.getRecipients();
alert(recipients.count + " recipients";
getRecipient
Gets a recipient from the list of recipients.
DOMString getRecipient(unsigned short index);
var sms = bondi.messaging.createSMS({recipients:"+34666666666",body:"Hello from Huesca",store:true});
alert(sms.getRecipient(0));
appendRecipient
Adds (appends) a new recipient to the list. This recipient must be a phone number format.
void appendRecipient(DOMString phoneNumber);
var sms = bondi.messaging.createSMS(null);
sms.appendRecipient("+34666666666");
clearRecipients
Removes the entire recipients list.
void clearRecipients();
var sms = bondi.messaging.createSMS({recipients:"+34666666666",body:"Hello from Huesca",store:true});
sms.clearRecipients();
MMSSlide
MMS Slide is a triplet of an image, audio and text. Optionally it can include a video as a replacement for image and audio.
interface MMSSlide {
attribute unsigned long duration;
attribute File image
setraises(MessagingError);
attribute unsigned long imageBegin;
attribute unsigned long imageEnd;
attribute File audio
setraises(MessagingError);
attribute unsigned long audioBegin;
attribute unsigned long audioEnd;
attribute DOMString text
setraises(MessagingError);
attribute unsigned long textBegin;
attribute unsigned long textEnd;
attribute File video
setraises(MessagingError);
attribute unsigned long videoBegin;
attribute unsigned long videoEnd;
};
http://www.openmobilealliance.org/Technical/release_program/docs/MMS/V1_3-20080128-C/OMA-TS-MMS-CONF-V1_3-20080128-C.pdf section 8: "A slide that contains video SHALL contain only video and text components."
unsigned
long
duration
Duration of the slide presentation, in milliseconds.
File
image
Image
File containing the image
unsigned
long
imageBegin
Beginning of image presentation within a slide, in milliseconds.
unsigned
long
imageEnd
End of image presentation within a slide, in milliseconds.
File
audio
Audio
File containing the audio
unsigned
long
audioBegin
Beginning of audio playback within a slide, in milliseconds.
unsigned
long
audioEnd
End of audio playback within a slide, in milliseconds.
DOMString
text
Audio
unsigned
long
textBegin
Beginning of text presentation within a slide, in milliseconds.
unsigned
long
textEnd
End of text presentation within a slide, in milliseconds.
File
video
Video
File containing the video
unsigned
long
videoBegin
Beginning of video presentation within a slide, in milliseconds.
unsigned
long
videoEnd
End of video presentation within a slide, in milliseconds.
MMSMessage
MMS Message API
interface MMSMessage {
Object getProperty(in DOMString propertyName)
raises(DeviceAPIError);
void setProperty(in DOMString propertyName, in Object propertyValue)
raises(DeviceAPIError);
readonly attribute DOMString id;
readonly attribute Date datetime;
attribute DOMString multipartMixedBody
setraises(DeviceAPIError);
attribute boolean store
setraises(DeviceAPIError);
readonly attribute unsigned long folder;
attribute DOMString subject
setraises(DeviceAPIError);
readonly attribute boolean read;
StringArray getRecipients();
DOMString getRecipient(in unsigned long index)
raises(DeviceAPIError);
void appendRecipient(in DOMString phoneNumber)
raises(DeviceAPIError);
void clearRecipients()
raises(DeviceAPIError);
FileArray getAttachments()
raises(DeviceAPIError);
File getAttachment(in unsigned short index)
raises(DeviceAPIError);
void appendAttachment(in File myAttachment)
raises(SecurityError, DeviceAPIError);
void clearAttachments()
raises(DeviceAPIError);
const unsigned short MULTIPART_MIXED = 0;
const unsigned short MULTIPART_RELATED = 1;
attribute unsigned short messageType;
attribute MMSSlideArray slides;
};
The MMS Message interface provides methods to populate and send a multimedia message.
bondi.requestFeature('bondi.messaging', { id: 'messaging',successCallback: successFunc,errorCallback: failureFunc } );
unsigned
short
MULTIPART_MIXED
Constant used to identify the type of MMS Message as multipart/mixed.
unsigned
short
MULTIPART_RELATED
Constant used to identify the type of MMS Message as multipart/related.
[readonly]
DOMString
id
Unique identifier assigned to the message in the platform.
var MMS = bondi.messaging.createMMS(null);
var id = MMS.id;
[readonly]
Date
datetime
String that contains the datetime where the MMS was sent or received or created in draft, depending the storage folder.
var files=bondi.filesystem.mount("\Huesca.jpg");
var MMS = bondi.messaging.createMMS({recipients:"+34666666666", subject:"Hello from Huesca", body:"How Are You?", attachments:files, store:false});
var dateTime = MMS.datetime;
DOMString
multipartMixedBody
String that contains the multipart/mixed message body.
var files=bondi.filesystem.mount("\Huesca.jpg");
var MMS = bondi.messaging.createMMS({recipients:"+34666666666", subject:"Hello from Huesca", body:"How Are You?", attachments:files, store:false});
alert(MMS.body);
boolean
store
Property that indicates whether the message is going to be stored in the SENT folder once sent.
var files=bondi.filesystem.mount("\Huesca.jpg");
var MMS = bondi.messaging.createMMS({recipients:"+34666666666", subject:"Hello from Huesca", body:"How Are You?", attachments:files, store:true});
alert(MMS.store);
[readonly]
unsigned
long
folder
Folder where the message is stored.
This value will be one of INBOX_FOLDER, OUTBOX_FOLDER, SENT_FOLDER, DRAFTS_FOLDER defined in MessagingManager.
var files=bondi.filesystem.mount("\Huesca.jpg");
// Create the message in the Drafts folder.
var MMS = bondi.messaging.createMMS({folder: bondi.messaging.DRAFTS_FOLDER, recipients:"+34666666666", subject:"Hello from Huesca", body:"How Are You?", attachments:files, store:true});
alert(MMS.folder);
DOMString
subject
String with the subject of the MMS
var files=bondi.filesystem.mount("\Huesca.jpg");
var mms = bondi.messaging.createMMS({recipients:"+34666666666", subject:"Hello from Huesca", body:"How Are You?", attachments:files, store:true});
alert(mms.subject);
[readonly]
boolean
read
Value that indicates if the message has been already read
var files=bondi.filesystem.mount("\Huesca.jpg");
var mms = bondi.messaging.createMMS({recipients:"+34666666666", subject:"Hello from Huesca", body:"How Are You?", attachments:files, store:true});
var isRead = mms.read;
unsigned
short
messageType
Type of message: multipart/mixed or multipart/related
MMSSlideArray
slides
Actual slides
getProperty
Returns the value of any of the MMS message object properties.
Object getProperty(DOMString propertyName);
Supported properties
body: String. This represents the body of the multipart/mixed mms
subject: String. This represents a resume of the mms
recipients: String. Semicolom(;) separated string containing the recipients list
store: Boolean. Indicates if the mms will be stored in the sent messages folder. True -> Stored
id: Integer. Identificator of the MMS
read: Boolean. It indicates if the MMS has been readen (true) or not (false).
folder: Integer. It indicates the folder where the mms is stored.
datetime: Date. Date object with info about the mms creation or reception date.
attachment: File. File object with info about the mms attachment.
var files=bondi.filesystem.mount("\Huesca.jpg");
var mms =bondi.messaging.createMMS({recipients:"+34666666666", subject:"Hello from Huesca", body:"How Are You?", attachments:files, store:false});
var body = mms.getProperty("body");
setProperty
Sets the value of any of the MMS message object properties. (body, subject, store, attachment, recipients).
void setProperty(DOMString propertyName, Object propertyValue);
var MMS = bondi.messaging.createMMS(null);
MMS.setProperty("body", "Just arrived in Huesca");
getRecipients
Gets the list of recipients added to this message.
StringArray getRecipients();
var files=bondi.filesystem.mount("\Huesca.jpg");
var MMS = bondi.messaging.createMMS({recipients:"+34666666666", subject:"Hello from Huesca", body:"How Are You?", attachments:files, store:true});
var recipients = MMS.getRecipients();
alert(recipients.count + " recipients";
getRecipient
Gets a recipient from the list of recienpients.
DOMString getRecipient(unsigned long index);
var files=bondi.filesystem.mount("\Huesca.jpg");
var MMS = bondi.messaging.createMMS({recipients:"+34666666666", subject:"Hello from Huesca", body:"How Are You?", attachments:files, store:true});
alert(MMS.getRecipient(0));
appendRecipient
Adds (appends) a new recipient to the list.
void appendRecipient(DOMString phoneNumber);
var MMS = bondi.messaging.createMMS(null);
MMS.appendRecipient("+34666666666");
clearRecipients
Removes the entire recipients list
void clearRecipients();
var files=bondi.filesystem.mount("\Huesca.jpg");
var MMS = bondi.messaging.createMMS({recipients:"+34666666666", subject:"Hello from Huesca", body:"How Are You?", attachments:files, store:true});
MMS.clearRecipients();
getAttachments
Gets the list of attachments added to this message.
FileArray getAttachments();
var files=bondi.filesystem.mount("\Huesca.jpg");
var mms = bondi.messaging.createMMS({recipients:"+34666666666", subject:"Hello from Huesca", body:"How Are You?", attachments:files, store:true});
var attachments = getAttachments();
alert(attachments[0]);
getAttachment
Gets an attachment from the list of added attachments.
File getAttachment(unsigned short index);
var files=bondi.filesystem.mount("\Huesca.jpg");
var mms = bondi.messaging.createMMS({recipients:"+34666666666", subject:"Hello from Huesca", body:"How Are You?", attachments:files, store:true});
alert(getAttachment(0));
appendAttachment
Adds a file to the attachment list of the message.
void appendAttachment(File myAttachment);
var files=bondi.filesystem.mount("\Huesca.jpg");
var mms = bondi.messaging.createMMS();
mms.appendAttachment(files);
clearAttachments
Removes the entire attachments list
void clearAttachments();
var files=bondi.filesystem.mount("\Huesca.jpg");
var mms = bondi.messaging.createMMS({recipients:"+34666666666", subject:"Hello from Huesca", body:"How Are You?", attachments:files, store:true});
mms.clearAttachments();
EmailMessage
Email Message API
interface EmailMessage {
DOMString getProperty(in DOMString propertyName)
raises(DeviceAPIError);
void setProperty(in DOMString propertyName, in DOMString propertyValue)
raises(DeviceAPIError);
readonly attribute DOMString id;
readonly attribute Date datetime;
attribute DOMString from
setraises(DeviceAPIError);
StringArray getToList()
raises(DeviceAPIError);
DOMString getTo(in unsigned short index)
raises(DeviceAPIError);
StringArray getCCList()
raises(DeviceAPIError);
DOMString getCC(in unsigned short index)
raises(DeviceAPIError);
StringArray getBCCList();
DOMString getBCC(in unsigned short index)
raises(DeviceAPIError);
attribute DOMString body
setraises(DeviceAPIError);
attribute boolean store
setraises(DeviceAPIError);
readonly attribute unsigned short folder;
attribute DOMString subject
setraises(DeviceAPIError);
readonly attribute boolean read;
void appendTo(in DOMString emailAddress)
raises(DeviceAPIError);
void clearTo()
raises(DeviceAPIError);
void appendCC(in DOMString emailAddress)
raises(DeviceAPIError);
void clearCC()
raises(DeviceAPIError);
void appendBCC(in DOMString emailAddress)
raises(DeviceAPIError);
void clearBCC()
raises(DeviceAPIError);
FileArray getAttachments()
raises(DeviceAPIError);
File getAttachment(in unsigned short index)
raises(DeviceAPIError);
void appendAttachment(in File myAttachment)
raises(SecurityError, DeviceAPIError);
void clearAttachments()
raises(DeviceAPIError);
};
The Email Message interface provides methods to populate and send an email message.
bondi.requestFeature('bondi.messaging', { id: 'messaging',successCallback: successFunc,errorCallback: failureFunc } );
[readonly]
DOMString
id
Unique identifier assigned to the message in the platform.
var email = bondi.messaging.createEmail(null);
var id = email.id;
[readonly]
Date
datetime
String that contains the datetime where the Email was sent or received or created in draft, depending the storage folder.
var email = bondi.messaging.createEmail(null);
var dateTime = email.datetime;
DOMString
from
Email account that is being used to send the message.
var files=bondi.filesystem.mount("\Huesca.jpg");
var email = bondi.messaging.createEmail({from:"pfracat@corp.vodafone.es",to:"pedro@gmail.com", cc:"pabasa1@corp.vodafone.es",bcc:"guillermo.caudevilla@vodafone.com",subject:"Hello from Huesca",body:"How Are You?",attachments:files,store:true});
var account = email.from;
DOMString
body
Gets the body of the email
var email = bondi.messaging.createEmail({from:"pfracat@corp.vodafone.es",to:"pedro@gmail.com",subject:"Hello from Huesca",body:"How Are You?",store:true});
alert(email.body);
boolean
store
Property that indicates whether the message is going to be stored in the SENT folder once sent.
var email = bondi.messaging.createEmail({from:"pfracat@corp.vodafone.es",to:"pedro@gmail.com",subject:"Hello from Huesca",body:"How Are You?",store:true});
alert(email.store);
[readonly]
unsigned
short
folder
Folder where the message is stored.
This attribute will be one of INBOX_FOLDER, OUTBOX_FOLDER, SENT_FOLDER, DRAFTS_FOLDER defined in MessagingManager.
var email = bondi.messaging.createEmail({from:"pfracat@corp.vodafone.es",to:"pedro@gmail.com",subject:"Hello from Huesca",body:"How Are You?",store:true});
alert(email.folder);
DOMString
subject
Message subject.
var email = bondi.messaging.createEmail({from:"pfracat@corp.vodafone.es",to:"pedro@gmail.com",subject:"Hello from Huesca",body:"How Are You?",store:true});
alert(email.subject);
[readonly]
boolean
read
Value that indicates if the message has already been read
var email = bondi.messaging.createEmail({from:"pfracat@corp.vodafone.es",to:"pedro@gmail.com",subject:"Hello from Huesca",body:"How Are You?",store:true});
var isRead = email.read;
getProperty
Gets the value of the Email message object properties.
DOMString getProperty(DOMString propertyName);
Supported properties
from: String. It's the address used to send the email. It must be configured on the default messaging application of the phone. Addresses look like xxx@yyy.zzz
recipients: String. Semicolom(;) separated string containing the recipients list. Addresses look like xxx@yyy.zzz
cc: String. Semicolom(;) separated string containing the cc recipients list. Addresses look like xxx@yyy.zzz
bcc: String. Semicolom(;) separated string containing the bcc recipients list. Addresses look like xxx@yyy.zzz
subject: String. Resume of the email content.
body: String. Email text.
store: Boolean. Indicates if the email will be stored in the sent messages folder. True -> Stored
read: Boolean. Indicates if the email has been readen(true) or not(false)
id: String. Identification of the email
datetime: Date object which stores the date when the email was created
folder: Integer. It indicates the folder where the email is stored (must be one of INBOX_FOLDER, OUTBOX_FOLDER, SENT_FOLDER, DRAFTS_FOLDER defined in MessagingManager).
var files=bondi.filesystem.mount("\Huesca.jpg");
var email = bondi.messaging.createEmail({from:"pfracat@corp.vodafone.es",to:"pedro@gmail.com", cc:"pabasa1@corp.vodafone.es",bcc:"guillermo.caudevilla@vodafone.com",subject:"Hello from Huesca",body:"How Are You?",attachments:files,store:true});
var body = email.getProperty("body");
setProperty
Sets the value of any of the Email message object properties.
void setProperty(DOMString propertyName, DOMString propertyValue);
var files=bondi.filesystem.mount("\Huesca.jpg");
var email = bondi.messaging.createEmail({from:"pfracat@corp.vodafone.es",to:"pedro@gmail.com", cc:"pabasa1@corp.vodafone.es",bcc:"guillermo.caudevilla@vodafone.com",subject:"Hello from Huesca",body:"How Are You?",attachments:files,store:true});
email.setProperty("body", "Just arrived in Huesca");
getToList
Gets the list of recipients added to this message in the To field.
StringArray getToList();
var files=bondi.filesystem.mount("\Huesca.jpg");
var email = bondi.messaging.createEmail({from:"pfracat@corp.vodafone.es",to:"pedro@gmail.com", cc:"pabasa1@corp.vodafone.es",bcc:"guillermo.caudevilla@vodafone.com",subject:"Hello from Huesca",body:"How Are You?",attachments:files,store:true});
var recipients = email.getToList();
alert(recipients[0]);
getTo
Gets a recipient from the list of recipients (To).
DOMString getTo(unsigned short index);
var files=bondi.filesystem.mount("\Huesca.jpg");
var email = bondi.messaging.createEmail({from:"pfracat@corp.vodafone.es",to:"pedro@gmail.com", cc:"pabasa1@corp.vodafone.es",bcc:"guillermo.caudevilla@vodafone.com",subject:"Hello from Huesca",body:"How Are You?",attachments:files,store:true});
alert(email.getTo(0));
getCCList
Gets the list of recipients added to this message in the CC field.
StringArray getCCList();
var files=bondi.filesystem.mount("\Huesca.jpg");
var email = bondi.messaging.createEmail({from:"pfracat@corp.vodafone.es",to:"pedro@gmail.com", cc:"pabasa1@corp.vodafone.es",bcc:"guillermo.caudevilla@vodafone.com",subject:"Hello from Huesca",body:"How Are You?",attachments:files,store:true});
var recipients = email.getCCList();
alert(recipients[0]);
getCC
Gets a recipient from the list of recipients (CC).
DOMString getCC(unsigned short index);
var files=bondi.filesystem.mount("\Huesca.jpg");
var email = bondi.messaging.createEmail({from:"pfracat@corp.vodafone.es",to:"pedro@gmail.com", cc:"pabasa1@corp.vodafone.es",bcc:"guillermo.caudevilla@vodafone.com",subject:"Hello from Huesca",body:"How Are You?",attachments:files,store:true});
alert(email.getCC(0));
getBCCList
Gets the list of recipients added to this message in the BCC field.
StringArray getBCCList();
var files=bondi.filesystem.mount("\Huesca.jpg");
var email = bondi.messaging.createEmail({from:"pfracat@corp.vodafone.es",to:"pedro@gmail.com", cc:"pabasa1@corp.vodafone.es",bcc:"guillermo.caudevilla@vodafone.com",subject:"Hello from Huesca",body:"How Are You?",attachments:files,store:true});
var recipients = email.getBCCList();
alert(recipients[0]);
getBCC
Gets a recipient from the list of recipients (BCC).
DOMString getBCC(unsigned short index);
var files=bondi.filesystem.mount("\Huesca.jpg");
var email = bondi.messaging.createEmail({from:"pfracat@corp.vodafone.es",to:"pedro@gmail.com", cc:"pabasa1@corp.vodafone.es",bcc:"guillermo.caudevilla@vodafone.com",subject:"Hello from Huesca",body:"How Are You?",attachments:files,store:true});
alert(email.getBCC(0));
appendTo
Adds (appends) a new recipient to the list.
void appendTo(DOMString emailAddress);
var email = bondi.messaging.createEmail({from:"pfracat@corp.vodafone.es",to:"pedro@gmail.com",subject:"Hello from Huesca",body:"How Are You?",store:true});
email.appendTo("guillermo.caudevilla@vodafone.com");
clearTo
Removes the entire To's list
void clearTo();
var email = bondi.messaging.createEmail({from:"pfracat@corp.vodafone.es",to:"pedro@gmail.com",subject:"Hello from Huesca",body:"How Are You?",store:true});
email.clearTo();
appendCC
Adds (appends) a new recipient to the CC list.
void appendCC(DOMString emailAddress);
var email = bondi.messaging.createEmail({from:"pfracat@corp.vodafone.es",to:"pedro@gmail.com",cc:"ester@gmail.com",subject:"Hello from Huesca",body:"How Are You?",store:true});
email.appendCC("guillermo.caudevilla@vodafone.com");
clearCC
Removes the entire CCs list
void clearCC();
var email = bondi.messaging.createEmail({from:"pfracat@corp.vodafone.es",to:"pedro@gmail.com",cc:"ester@gmail.com",subject:"Hello from Huesca",body:"How Are You?",store:true});
email.clearCC();
appendBCC
Adds (appends) a new recipient to the BCC list.
void appendBCC(DOMString emailAddress);
var email = bondi.messaging.createEmail({from:"pfracat@corp.vodafone.es",to:"pedro@gmail.com",bcc:"ester@gmail.com",subject:"Hello from Huesca",body:"How Are You?",store:true});
email.appendBCC("guillermo.caudevilla@vodafone.com");
clearBCC
Removes the entire BCCs list
void clearBCC();
var email = bondi.messaging.createEmail({from:"pfracat@corp.vodafone.es",to:"pedro@gmail.com",bcc:"ester@gmail.com",subject:"Hello from Huesca",body:"How Are You?",store:true});
email.clearBCC();
getAttachments
Gets the list of attachments added to this message.
FileArray getAttachments();
var files=bondi.filesystem.mount("\Huesca.jpg");
var email = bondi.messaging.createEmail({from:"pfracat@corp.vodafone.es",to:"pedro@gmail.com",bcc:"ester@gmail.com",subject:"Hello from Huesca",body:"How Are You?",attachment: files,store:true});
var attachments = getAttachments();
alert(attachments[0]);
getAttachment
Gets an attachment from the list of added attachments.
File getAttachment(unsigned short index);
var files=bondi.filesystem.mount("\Huesca.jpg");
var email = bondi.messaging.createEmail({from:"pfracat@corp.vodafone.es",to:"pedro@gmail.com",bcc:"ester@gmail.com",subject:"Hello from Huesca",body:"How Are You?",attachment: files,store:true});
alert(getAttachment(0));
appendAttachment
Adds a file to the attachment list of the message.
void appendAttachment(File myAttachment);
var files=bondi.filesystem.mount("\Huesca.jpg");
var email = bondi.messaging.createEmail({from:"pfracat@corp.vodafone.es",to:"pedro@gmail.com",bcc:"ester@gmail.com",subject:"Hello from Huesca",body:"How Are You?",attachment: files,store:true});
var files2=bondi.filesystem.mount("\Huesca2.jpg");
email.appendAttachment(files2);
clearAttachments
Removes the entire attachments list
void clearAttachments();
var files=bondi.filesystem.mount("\Huesca.jpg");
var email = bondi.messaging.createEmail({from:"pfracat@corp.vodafone.es",to:"pedro@gmail.com",bcc:"ester@gmail.com",subject:"Hello from Huesca",body:"How Are You?",attachment: files,store:true});
email.clearAttachments();