Email Composer

The Email Composer API provides the ability to programmatically create and send emails from within an app.

Usage
EmailComposer.open({
    to:      'max@mustermann.de',
    cc:      'erika@mustermann.de',
    bcc:     ['john@doe.com', 'jane@doe.com'],
    subject: 'Greetings',
    body:    'How are you? Nice greetings from Leipzig'
});
window.EmailComposer.open({
    to: "max@mustermann.de",
    cc: "erika@mustermann.de",
    bcc: ["john@doe.com", "jane@doe.com"],
    subject: "Greetings",
    body: "How are you? Nice greetings from Leipzig",
});
window.EmailComposer.open({
    to: "max@mustermann.de",
    cc: "erika@mustermann.de",
    bcc: ["john@doe.com", "jane@doe.com"],
    subject: "Greetings",
    body: "How are you? Nice greetings from Leipzig",
});
(<any>window).EmailComposer.open({
    to: "max@mustermann.de",
    cc: "erika@mustermann.de",
    bcc: ["john@doe.com", "jane@doe.com"],
    subject: "Greetings",
    body: "How are you? Nice greetings from Leipzig",
});
EmailComposer.open({
    to: "max@mustermann.de",
    cc: "erika@mustermann.de",
    bcc: ["john@doe.com", "jane@doe.com"],
    subject: "Greetings",
    body: "How are you? Nice greetings from Leipzig"
});

Classes


EmailComposer

addAlias
addAlias(alias: string, packageName: string): void

Adds a new mail app alias.


PARAMETERS
alias: string
packageName: string

RETURN
returns: void
getClients
getClients(): Promise<string>

Returns an array of email clients installed on the device.


RETURN
returns: Promise <string>
hasAccount
hasAccount(): Promise<any>

Verifies if an email account is configured on the device.


RETURN
returns: Promise <any>
hasClient
hasClient(app: string): Promise<any>

Verifies if a specific email client is installed on the device.


PARAMETERS
app: string

RETURN
returns: Promise <any>
hasPermission
hasPermission(app: string): Promise<boolean>

Checks if the app has a permission to access email accounts information.


RETURN
returns: Promise <boolean>
isAvailable
isAvailable(app?: string): Promise<any>

Verifies if sending emails is supported on the device.


PARAMETERS
[optional] app: string

RETURN
returns: Promise <any>
open
open(options: EmailComposerOptions, scope?: any): Promise<any>

Displays the email composer pre-filled with data.


PARAMETERS
options: EmailComposerOptions
[optional] scope: any

RETURN
returns: Promise <any>
requestPermission
requestPermission(): Promise<boolean>

Request permission to access email accounts information.


RETURN
returns: Promise <boolean>

Interfaces

nameOrOptions
interface nameOrOptions {
    // App to send the email with
    app ? : string;
    // File paths or base64 data streams
    attachments ? : string[]
    // Email address(es) for BCC field
    bcc ? : string | string[]
    // Email body (for HTML, set isHtml to true)
    body ? : string
    // Email address(es) for CC field
    cc ? : string | string[]
    // Indicates if the body is HTML or plain text
    isHtml ? : boolean
    // Subject of the email
    subject ? : string
    // Email address(es) for To field
    to ? : string | string[]
    // Content type of the email
    type ? : string
}