Mail Application Development Platform API Reference

Class Mail

Openmail functions that are related to the host application (Yahoo! Mail).

Methods

compose

int compose ( msg )
This method opens a compose tab. Every field is optional. The "body" field accepts both plain text and HTML. If it's HTML, the html flag should be set to true.

HTML content is processed by a Web service to avoid XSS vulnerabilities.

Sample Use:

As used by the "Hello World" sample application.
...
Compose an email to joe:
<input id="msgbody">
<button onclick="openmail.Mail.compose({to: 'joe@joe.joe', subject: 'hi joe',
body: document.getElementById('msgbody').value})">
Compose </button> ...
Parameters:
msg <Object> Optional object used to pre-populate the new message.


msg may include the following:
to: String A comma-separated list of valid email addresses
subject: String An email subject
body: String A plain-text or HTML email body
cc: String A comma-separated list of valid email addresses
bcc: String A comma-separated list of valid email addresses
html: boolean Set to true if the body is HTML, false if the body is plain text

Returns: int
An error code.

refreshApplications

int refreshApplications ( )
Requests the mail container to refetch the list of applications and redraw the application folders.
Returns: int
An error code.

search

int search ( query )
This method is the strict equivalent of having the user type the query in the search box, then pressing "go". The search will open in a new tab.

Sample Use:

As used by the "Saved Searches" sample application.
var state = [
{label:"Sample 1", query:"test"},
{label:"Sample 2", query:"openmail"}
]; function buttonClick(btn) {
var a = btn.id.split("_");
var action=a[0], index=a[1];
switch (action)
{
case "run":
openmail.Mail.search(state[index].query);
break;
...
Parameters:
query < Object >
query includes the following member:
query: String The query to execute (Required)

Returns: int
An error code.


Copyright © 2009 Yahoo! Inc. All rights reserved.