# emails

## Table of Contents

- [Options](#options)
- [Examples](#examples)

---

Scans the whole document — `mailto:` links and plain text — and returns every address found as a bare string, with any `mailto:` prefix stripped:

```js
constemails=awaitmicrolink.emails('https://microlink.io')

console.log(emails)

// => ['hello@microlink.io']
```

## Options

Override the default rule of `selector: 'html'`, `attr: 'html'`, and `type: 'email'` with [selectorAll](https://microlink.io/docs/sdk/methods/extract/selectorAll), [selector](https://microlink.io/docs/sdk/methods/extract/selector), [attr](https://microlink.io/docs/sdk/methods/extract/attr), or [type](https://microlink.io/docs/sdk/methods/extract/type). The `'email'` type is what turns the swept HTML into addresses, so keep it when changing the scope.

## Examples

Only the addresses in the footer:

```js
constemails=awaitmicrolink.emails('https://example.com',{

selector:'footer'

})
```

Addresses on a contact page rendered on the client:

```js
constemails=awaitmicrolink.emails('https://example.com/contact',{

prerender:true,

waitForSelector:'main'

})
```

Obfuscated addresses — `name [at] domain [dot] com`, images, or JavaScript-assembled links — are not detected. For those, run your own logic against the rendered page with [function](https://microlink.io/docs/sdk/methods/function).