-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(plugin): add email composer plugin
- Loading branch information
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import {Plugin, Cordova} from './plugin'; | ||
|
||
/** | ||
* Email object for Opening Email Composer | ||
*/ | ||
export interface email { | ||
to: string | Array<string>, | ||
cc: string | Array<string>, | ||
bcc: string | Array<string>, | ||
attachments: Array<any>, | ||
subject: string, | ||
body: string, | ||
isHtml: boolean | ||
} | ||
|
||
/** | ||
* @name Email Composer | ||
* @description | ||
* | ||
* Requires Cordova plugin: cordova-plugin-email-composer. For more info, please see the [Email Composer plugin docs](https://github.com/katzer/cordova-plugin-email-composer). | ||
* | ||
* @usage | ||
* ```ts | ||
* import {EmailComposer} from 'ionic-native'; | ||
* | ||
* | ||
* let email = { | ||
* to: 'max@mustermann.de', | ||
* cc: 'erika@mustermann.de', | ||
* bcc: ['john@doe.com', 'jane@doe.com'], | ||
* attachments: [ | ||
* 'file://img/logo.png', | ||
* 'res://icon.png', | ||
* 'base64:icon.png//iVBORw0KGgoAAAANSUhEUg...', | ||
* 'file://README.pdf' | ||
* ], | ||
* subject: 'Cordova Icons', | ||
* body: 'How are you? Nice greetings from Leipzig', | ||
* isHtml: true | ||
* }; | ||
* | ||
* // Send a text message using default options | ||
* EmailComposer.send(email); | ||
* | ||
* ``` | ||
*/ | ||
@Plugin({ | ||
plugin: 'cordova-plugin-email-composer', | ||
pluginRef: 'emailComposer', | ||
repo: 'https://github.com/katzer/cordova-plugin-email-composer.git', | ||
platforms: ['Android', 'iOS', 'Windows Phone 8'] | ||
}) | ||
export class EmailComposer { | ||
|
||
/** | ||
* Opens Email Composer with email contents | ||
* @param email {email} Email | ||
* @returns {Promise<any>} Resolves promise when the EmailComposer has been opened | ||
*/ | ||
@Cordova() | ||
static open(email: email): Promise<any> { return } | ||
|
||
} |