An open API service indexing awesome lists of open source software.

https://github.com/threespot/mailto

Replaces obscured element with a mailto link
https://github.com/threespot/mailto

Last synced: 7 months ago
JSON representation

Replaces obscured element with a mailto link

Awesome Lists containing this project

README

          

# MailTo

[![npm](https://badge.fury.io/js/%40threespot%2Fmailto.svg)](https://www.npmjs.com/package/@threespot/mailto)
[![Build Status](https://travis-ci.org/Threespot/mailto.svg?branch=master)](https://travis-ci.org/Threespot/mailto) [![Coverage Status](https://coveralls.io/repos/github/Threespot/mailto/badge.svg)](https://coveralls.io/github/Threespot/mailto)

Replaces obscured element with a mailto link

## Install

```bash
npm install @threespot/mailto
```

Mailto uses the `data-email` attribute of an element and converts them to mailto links. It uses the value of that attribute as the email address. Inner HTML is preserved and any occurrences of `[at]` are converted to `@`.

**Exmaple:**

```html
Contact Us
```

**Becomes:**

```html
Contact Us
```

Works with inner HTML

**Exmaple:**

```html

hello[at]threespot.com

```

**Becomes:**

```html

hello@threespot.com

```

## Usage

**html**

```html
Contact Us
```

**js**

```js
import MailToLink from "@threespot/mailto";

const linkElem = document.getElementById("mailtoLink");

new MailToLink(linkElem);
```

## License

Mailto is free software, and may be redistributed under the terms of the [MIT license](https://github.com/Threespot/frontline-sass/blob/master/LICENSE.md).

## About Threespot

Threespot is a design and development agency from Washington, DC. We work for organizations that we believe are making a positive change in the world. Find out more [about us](https://www.threespot.com), [our projects](https://www.threespot.com/work) or [hire us](https://www.threespot.com/agency/hire-us)!

[![Threespot](https://avatars3.githubusercontent.com/u/370822?v=3&s=100)](https://www.threespot.com)