UNPKG

2.44 kBTypeScriptView Raw
1export interface EmailComposerOptions {
2 app?: string;
3 to?: string | Array<string>;
4 cc?: string | Array<string>;
5 bcc?: string | Array<string>;
6 attachments?: Array<any>;
7 subject?: string;
8 body?: string;
9 isHtml?: boolean;
10}
11/**
12 * @beta
13 * @name Email Composer
14 * @description
15 *
16 * Requires Cordova plugin: cordova-plugin-email-composer. For more info, please see the [Email Composer plugin docs](https://github.com/hypery2k/cordova-email-plugin).
17 *
18 * DISCLAIMER: This plugin is experiencing issues with the latest versions of Cordova. Use at your own risk. Functionality is not guaranteed. Please stay tuned for a more stable version.
19 * A good alternative to this plugin is the social sharing plugin.
20 *
21 * @usage
22 * ```typescript
23 * import { EmailComposer } from 'ionic-native';
24 *
25 *
26 * EmailComposer.isAvailable().then((available: boolean) =>{
27 * if(available) {
28 * //Now we know we can send
29 * }
30 * });
31 *
32 * let email = {
33 * to: 'max@mustermann.de',
34 * cc: 'erika@mustermann.de',
35 * bcc: ['john@doe.com', 'jane@doe.com'],
36 * attachments: [
37 * 'file://img/logo.png',
38 * 'res://icon.png',
39 * 'base64:icon.png//iVBORw0KGgoAAAANSUhEUg...',
40 * 'file://README.pdf'
41 * ],
42 * subject: 'Cordova Icons',
43 * body: 'How are you? Nice greetings from Leipzig',
44 * isHtml: true
45 * };
46 *
47 * // Send a text message using default options
48 * EmailComposer.open(email);
49 *
50 * ```
51 * @interfaces
52 * EmailComposerOptions
53 */
54export declare class EmailComposer {
55 /**
56 * Verifies if sending emails is supported on the device.
57 *
58 * @param app {string?} An optional app id or uri scheme.
59 * @returns {Promise<any>} Resolves if available, rejects if not available
60 */
61 static isAvailable(app?: string): Promise<any>;
62 /**
63 * Adds a new mail app alias.
64 *
65 * @param alias {string} The alias name
66 * @param packageName {string} The package name
67 */
68 static addAlias(alias: string, packageName: string): void;
69 /**
70 * Displays the email composer pre-filled with data.
71 *
72 * @param options {EmailComposerOptions} Email
73 * @param scope {any?} An optional scope for the promise
74 * @returns {Promise<any>} Resolves promise when the EmailComposer has been opened
75 */
76 static open(options: EmailComposerOptions, scope?: any): Promise<any>;
77}