{"id":13428443,"url":"https://github.com/katzer/cordova-plugin-email-composer","last_synced_at":"2025-05-14T08:09:34.305Z","repository":{"id":10017887,"uuid":"12056613","full_name":"katzer/cordova-plugin-email-composer","owner":"katzer","description":"Edit and send email messages","archived":false,"fork":false,"pushed_at":"2025-01-28T14:59:13.000Z","size":57770,"stargazers_count":343,"open_issues_count":16,"forks_count":331,"subscribers_count":31,"default_branch":"master","last_synced_at":"2025-04-09T11:01:39.718Z","etag":null,"topics":["composer","cordova-android-plugin","cordova-ios-plugin","cordova-plugin","email","email-draft"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/katzer.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-08-12T13:34:09.000Z","updated_at":"2025-01-28T14:59:18.000Z","dependencies_parsed_at":"2025-03-12T03:01:46.986Z","dependency_job_id":"3f3b941b-98a4-4461-a2ad-31e7579cea26","html_url":"https://github.com/katzer/cordova-plugin-email-composer","commit_stats":null,"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katzer%2Fcordova-plugin-email-composer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katzer%2Fcordova-plugin-email-composer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katzer%2Fcordova-plugin-email-composer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katzer%2Fcordova-plugin-email-composer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/katzer","download_url":"https://codeload.github.com/katzer/cordova-plugin-email-composer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254101558,"owners_count":22014908,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["composer","cordova-android-plugin","cordova-ios-plugin","cordova-plugin","email","email-draft"],"created_at":"2024-07-31T01:00:57.320Z","updated_at":"2025-05-14T08:09:29.291Z","avatar_url":"https://github.com/katzer.png","language":"Objective-C","funding_links":["https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=L3HKQCD9UA35A"],"categories":["Plugins"],"sub_categories":[],"readme":"# Cordova Email Plugin \u003cbr\u003e [![npm version](https://badge.fury.io/js/cordova-plugin-email-composer.svg)](http://badge.fury.io/js/cordova-plugin-email-composer) [![Code Climate](https://codeclimate.com/github/katzer/cordova-plugin-email-composer/badges/gpa.svg)](https://codeclimate.com/github/katzer/cordova-plugin-email-composer) [![PayPayl donate button](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=L3HKQCD9UA35A \"Donate once-off to this project using Paypal\")\n\n\u003cimg width=\"260px\" align=\"right\" hspace=\"10\" vspace=\"5\" src=\"https://github.com/katzer/cordova-plugin-email-composer/blob/example/images/ios_iphone5s_spacegrey_portrait.png\"\u003e\n\nThe plugin provides access to the standard interface that manages the editing and sending an email message. You can use this view controller to display a standard email view inside your application and populate the fields of that view with initial values, such as the subject, email recipients, body text, and attachments. The user can edit the initial contents you specify and choose to send the email or cancel the operation.\n\nUsing this interface does not guarantee immediate delivery of the corresponding email message. The user may cancel the creation of the message, and if the user does choose to send the message, the message is only queued in the Mail application outbox. This allows you to generate emails even in situations where the user does not have network access, such as in airplane mode. This interface does not provide a way for you to verify whether emails were actually sent.\u003cbr\u003e\u003cbr\u003e\n\n\n## Supported Platforms\n\n- __Android__\n- __Browser__\n- __iOS__\n- __OSX__\n- __Windows__\n\n\n## Installation\n\nThe plugin can be installed via [Cordova-CLI][CLI] and is publicly available on [NPM][npm].\n\nExecute from the projects root folder:\n\n    $ cordova plugin add cordova-plugin-email-composer\n\nOr install a specific version:\n\n    $ cordova plugin add cordova-plugin-email-composer@VERSION\n\nOr install the latest master version:\n\n    $ cordova plugin add https://github.com/katzer/cordova-plugin-email-composer.git\n\nOr install from local source:\n\n    $ cordova plugin add \u003cpath\u003e --nofetch --nosave\n\n\n## Usage\n\nThe plugin creates the object `cordova.plugins.email` and is accessible after the *deviceready* event has been fired.\n\n```js\ndocument.addEventListener('deviceready', function () {\n    // cordova.plugins.email is now available\n}, false);\n```\n\nAll properties are optional. After opening the draft the user may have the possibilities to edit the draft from the UI. The callback comes without arguments.\n\n```javascript\ncordova.plugins.email.open({\n    from:       String, // sending email account (iOS only)\n    to:          Array, // email addresses for TO field\n    cc:          Array, // email addresses for CC field\n    bcc:         Array, // email addresses for BCC field\n    attachments: Array, // file paths or base64 data streams\n    subject:    String, // subject of the email\n    body:       String, // email body\n    isHtml:    Boolean  // indicats if the body is HTML or plain text (primarily iOS)\n}, callback, scope);\n```\n\nThe following example shows how to create and show an email draft pre-filled with different kind of properties:\n\n```javascript\ncordova.plugins.email.open({\n    to:      'max@mustermann.de',\n    cc:      'erika@mustermann.de',\n    bcc:     ['john@doe.com', 'jane@doe.com'],\n    subject: 'Greetings',\n    body:    'How are you? Nice greetings from Leipzig'\n});\n```\n\nOf course its also possible to open a blank draft:\n\n```javascript\ncordova.plugins.email.open();\n```\n\nIts possible to specify the email client. If the phone isn´t able to handle the specified scheme it will fallback to the system default:\n\n```javascript\ncordova.plugins.email.open({ app: 'mailto', subject: 'Sent with mailto' });\n```\n\nOn Android the app can be specified by either an alias or its package name. The alias _gmail_ is available by default.\n\n```javascript\n// Add app alias\ncordova.plugins.email.addAlias('gmail', 'com.google.android.gm');\n\n// Specify app by name or alias\ncordova.plugins.email.open({ app: 'gmail', subject: 'Sent from Gmail' });\n```\n\n#### Issues with AndroidX\n\nIf you have issues with AndroidX, simply install the extra plugin\n\n```\ncordova plugin add cordova-plugin-androidx-adapter\n```\n\nFor Ionic/Capacitor you can also try\n\n```bash\nnpm install jetifier\nnpx jetify\nnpx cap sync android\n```\n\n#### HTML and CSS\n\nOnly the built-in email app for iOS does support HTML and CSS. Some Android clients support rich formatted text.\n\nUse `isHtml` with caution! It's disabled by default.\n\n#### Attach Base64 encoded content\nThe code below shows how to attach an base64 encoded image which will be added as a image with the name *icon.png*.\n\n```javascript\ncordova.plugins.email.open({\n    subject:     'Cordova Icon',\n    attachments: ['base64:icon.png//iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6...']\n});\n```\n\n#### Attach files from the device storage\nThe path to the files must be defined absolute from the root of the file system. On Android the user has to allow the app first to read from external storage!\n\n```javascript\ncordova.plugins.email.open({\n    attachments: 'file:///storage/sdcard/icon.png', //=\u003e storage/sdcard/icon.png (Android)\n});\n```\n\n#### Attach native app resources\nEach app has a resource folder, e.g. the _res_ folder for Android apps or the _Resource_ folder for iOS apps. The following example shows how to attach the app icon from within the app's resource folder.\n\n```javascript\ncordova.plugins.email.open({\n    attachments: 'res://icon.png' //=\u003e res/mipmap/icon (Android)\n});\n```\n\n#### Attach assets from the www folder\nThe path to the files must be defined relative from the root of the mobile web app folder, which is located under the _www_ folder.\n\n```javascript\ncordova.plugins.email.open({\n    attachments: [\n        'file://img/logo.png', //=\u003e assets/www/img/logo.png (Android)\n        'file://css/index.css' //=\u003e www/css/index.css (iOS)\n    ]\n});\n```\n\n#### Attach files from the internal app file system\nThe path must be defined relative from the directory holding application files.\n\n```javascript\ncordova.plugins.email.open({\n    attachments: [\n        'app://databases/db.db3', //=\u003e /data/data/\u003capp.package\u003e/databases/db.db3 (Android)\n        'app://databases/db.db3', //=\u003e /Applications/\u003cAppName.app\u003e/databases/db.db3 (iOS, OSX)\n        'app://databases/db.db3', //=\u003e ms-appdata:///databases/db.db3 (Windows)\n    ]\n});\n```\n\n### Device Configuration\n\nThe email service is only available on devices which have configured an email account. On Android the user has to allow the app first to access account informations.\n\n```javascript\ncordova.plugins.email.hasAccount(callbackFn);\n```\n\nTo check for a specific mail client, just pass its uri scheme on iOS, or the package name on Android as first parameter:\n\n```javascript\ncordova.plugins.email.hasClient('gmail', callbackFn);\n```\n\nFor Android only, it's possible to get a list of all installed email clients:\n\n```javascript\ncordova.plugins.email.getClients(function (apps) {\n    cordova.plugins.email.open({ app: apps[0] });    \n});\n```\n\n## Permissions\n\nSome functions require permissions on __Android__. The plugin itself does not add them to the manifest nor does it ask for by itself at runtime.\n\n| Permission | Description |\n| ---------- | ----------- |\n| `cordova.plugins.email.permission.READ_EXTERNAL_STORAGE` | Is needed to attach external files `file:///` located outside of the app's own file system. |\n| `cordova.plugins.email.permission.GET_ACCOUNTS` | Without the permission the `hasAccount()` function wont be able to look for email accounts. |\n\nTo check if a permission has been granted:\n\n```javascript\ncordova.plugins.email.hasPermission(permission, callbackFn);\n```\n\nTo request a permission:\n\n```javascript\ncordova.plugins.email.requestPermission(permission, callbackFn);\n```\n\n__Note:__ The author of the app has to make sure that the permission is listed in the manifest.\n\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n\n## License\n\nThis software is released under the [Apache 2.0 License][apache2_license].\n\nMade with :yum: from Leipzig\n\n© 2013 [appPlant GmbH][appplant]\n\n\n[cordova]: https://cordova.apache.org\n[CLI]: http://cordova.apache.org/docs/en/edge/guide_cli_index.md.html#The%20Command-line%20Interface\n[npm]: https://www.npmjs.com/package/cordova-plugin-email-composer\n[email_app]: #specify-email-app\n[apache2_license]: http://opensource.org/licenses/Apache-2.0\n[appplant]: http://appplant.de\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatzer%2Fcordova-plugin-email-composer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkatzer%2Fcordova-plugin-email-composer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatzer%2Fcordova-plugin-email-composer/lists"}