<commit_before># NativeScript Email

An Email plugin for use in your NativeScript app.

You can use it to compose emails, edit the draft manually, and send it.

## Installation
Make sure you're running NativeScript 2.3.0 or up. Do `npm install -g nativescript` if not.

The run the following command from the root of your project:

```
tns plugin add nativescript-email
```

## API

To use this plugin you must first require/import it:

#### TypeScript

```typescript
import * as email from "nativescript-email";
// or
import { compose } from "nativescript-email";
// or even
import { compose as composeEmail } from "nativescript-email";
```

#### JavaScript

```js
var email = require("nativescript-email");
```

### `available`

#### TypeScript

```typescript
  email.available((avail: boolean) => {
      console.log("Email available? " + avail);
  })
```

#### JavaScript

```js
  email.available().then(function(avail) {
      console.log("Email available? " + avail);
  })
```

### `compose`

#### JavaScript

```js
  // let's first create a File object using the tns file module
  var fs = require("file-system");
  var appPath = fs.knownFolders.currentApp().path;
  var logoPath = appPath + "/res/telerik-logo.png";

  email.compose({
      subject: "Yo",
      body: "Hello <strong>dude</strong> :)",
      to: ['<EMAIL>', '<EMAIL>'],
      cc: ['<EMAIL>'],
      bcc: ['<EMAIL>', '<EMAIL>'],
      attachments: [
        {
            fileName: 'arrow1.png',
            path: 'base64://iVBORw0KGgoAAAANSUhEUgAAABYAAAAoCAYAAAD6xArmAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAHGlET1QAAAACAAAAAAAAABQAAAAoAAAAFAAAABQ<KEY>',
            mimeType: 'image/png'
        },
        {
            fileName: 'telerik-logo.png',
            path: logoPath,
            mimeType: 'image/png'
      }]
  }).then(
    function() {
      console.log("Email composer closed");
    }, function(err) {
      console.log("Error: " + err);
    });
```

Full attachment support has been added to 1.3.0 per the example above.

Since 1.4.0 the promise will be rejected in case a file can't be found.

## Usage with Angular
Check out [this tutorial (YouTube)](https://www.youtube.com/watch?v=fSnQb9-Gtdk) to learn how to use this plugin in a NativeScript-Angular app.

## Known issues
On iOS you can't use the simulator to test the plugin because of an iOS limitation.
To prevent a crash this plugin returns `false` when `available` is invoked on the iOS sim.
<commit_msg>Added badges<commit_after># NativeScript Email

[![NPM version][npm-image]][npm-url]
[![Downloads][downloads-image]][npm-url]
[![Twitter Follow][twitter-image]][twitter-url]

[npm-image]:http://img.shields.io/npm/v/nativescript-email.svg
[npm-url]:https://npmjs.org/package/nativescript-email
[downloads-image]:http://img.shields.io/npm/dm/nativescript-email.svg
[twitter-image]:https://img.shields.io/twitter/follow/eddyverbruggen.svg?style=social&label=Follow%20me
[twitter-url]:https://twitter.com/eddyverbruggen

You can use thsi plugin to compose emails, edit the draft manually, and send it.

## Installation
Make sure you're running NativeScript 2.3.0 or up. Do `npm install -g nativescript` if not.

The run the following command from the root of your project:

```
tns plugin add nativescript-email
```

## API

To use this plugin you must first require/import it:

#### TypeScript

```typescript
import * as email from "nativescript-email";
// or
import { compose } from "nativescript-email";
// or even
import { compose as composeEmail } from "nativescript-email";
```

#### JavaScript

```js
var email = require("nativescript-email");
```

### `available`

#### TypeScript

```typescript
  email.available((avail: boolean) => {
      console.log("Email available? " + avail);
  })
```

#### JavaScript

```js
  email.available().then(function(avail) {
      console.log("Email available? " + avail);
  })
```

### `compose`

#### JavaScript

```js
  // let's first create a File object using the tns file module
  var fs = require("file-system");
  var appPath = fs.knownFolders.currentApp().path;
  var logoPath = appPath + "/res/telerik-logo.png";

  email.compose({
      subject: "Yo",
      body: "Hello <strong>dude</strong> :)",
      to: ['<EMAIL>', '<EMAIL>'],
      cc: ['<EMAIL>'],
      bcc: ['<EMAIL>', '<EMAIL>'],
      attachments: [
        {
            fileName: 'arrow1.png',
            path: 'base64://iVBORw0KGgoAAAANSUhEUgAAABYAAAAoCAYAAAD6xArmAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAHGlET1QAAA<KEY>',
            mimeType: 'image/png'
        },
        {
            fileName: 'telerik-logo.png',
            path: logoPath,
            mimeType: 'image/png'
      }]
  }).then(
    function() {
      console.log("Email composer closed");
    }, function(err) {
      console.log("Error: " + err);
    });
```

Full attachment support has been added to 1.3.0 per the example above.

Since 1.4.0 the promise will be rejected in case a file can't be found.

## Usage with Angular
Check out [this tutorial (YouTube)](https://www.youtube.com/watch?v=fSnQb9-Gtdk) to learn how to use this plugin in a NativeScript-Angular app.

## Known issues
On iOS you can't use the simulator to test the plugin because of an iOS limitation.
To prevent a crash this plugin returns `false` when `available` is invoked on the iOS sim.

{'fraction_non_alphanumeric': 0.14477414477414477, 'fraction_numerical': 0.006426006426006426, 'mean_word_length': 3.413678065054212, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, 'https://': 5, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1932354', 'n_tokens_mistral': 1798, 'n_tokens_neox': 1703, 'n_words': 491}