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
- Host: GitHub
- URL: https://github.com/threespot/mailto
- Owner: Threespot
- License: mit
- Created: 2017-12-20T21:43:18.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-09-04T20:43:57.000Z (almost 6 years ago)
- Last Synced: 2025-01-28T18:39:08.657Z (over 1 year ago)
- Language: JavaScript
- Homepage: https://threespot.github.io/mailto/index.html
- Size: 637 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MailTo
[](https://www.npmjs.com/package/@threespot/mailto)
[](https://travis-ci.org/Threespot/mailto) [](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)!
[](https://www.threespot.com)