# mailx

> simple and complete email client library (pop, imap and smtp) for nodejs

Latest version **0.0.11** (published 2016-09-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install mailx
pnpm add mailx
yarn add mailx
bun add mailx
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.11 |
| Published | 2016-09-29 |
| First published | 2015-01-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 (+16 in 2 direct dependencies) |
| Install scripts | no |
| Author | Atlantis Software |
| Maintainers | atiertant |
| Keywords | mail, email, pop, pop3, imap, smtp |

## Links

- npm: https://www.npmjs.com/package/mailx
- Repository: https://github.com/Atlantis-Software/mailx
- Issues: https://github.com/Atlantis-Software/mailx/issues
- npm.io page: https://npm.io/package/mailx

## Dependencies (6)

- [imap](https://npm.io/package/imap.md) ~0.8.16
- [asynk](https://npm.io/package/asynk.md) ~0.0.9
- [optimist](https://npm.io/package/optimist.md) *
- [mailparser](https://npm.io/package/mailparser.md) ~0.6.0
- [nodemailer](https://npm.io/package/nodemailer.md) ~2.6.4
- [underscore](https://npm.io/package/underscore.md) >=1.8.3

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 0.0.11 (latest) — 2016-09-29
- 0.0.10 — 2016-07-26
- 0.0.9 — 2015-12-17
- 0.0.8 — 2015-02-03
- 0.0.7 — 2015-01-23
- 0.0.6 — 2015-01-23
- 0.0.5 — 2015-01-23
- 0.0.4 — 2015-01-22
- 0.0.3 — 2015-01-15
- 0.0.2 — 2015-01-15
- 0.0.1 — 2015-01-15

## README

Mailx
-------

mailx is a simple and complete email client library (pop, imap and smtp) for nodejs. 

----------

<i class="icon-pencil"></i> Write and send an Email
---------------------------------------------------

#### <i class="icon-file"></i> Message objet
the message object is used to write or read a message.

**Sample:** write a new message
```javascript
var message = mailx.message();
message.setFrom('me', 'me@example.net');
message.addTo('you', 'you@example.net');
message.setSubject('hello');
message.setText('hi ! how are u?'); 
message.setHtml('hi ! how are u? <b>hugs</b>');
```
#### <i class="icon-upload"></i> Transport object
the transport objet is used to send a predefined message.

**Sample:** sending a message
```javascript
var transport = mailx.transport('smtp.example.net', 25, 'login', 'password');
transport.send(message, function(err,result) {
    console.log(result);
});
```

<i class="icon-download"></i> Receive Email
-------------------------------------------

<i class="icon-download"></i> Store object

**Sample:** get all messages from server, log their subjets and delete the last one
```javascript
var store = mailx.store('pop3', 'pop.example.net', 110, 'login', 'password');
store.connect(function(err) {
  if (err) {
    return console.log('connect error', err);
  }
  store.getInboxMessages(0, function(err, messages) {
    if (err) {
      return console.log('inbox error', err);
    }
    messages.forEach(function(message,index) {
      console.log(message.subject);
      if (index === messages.length - 1) {
        message.delete(function(err, data) {
          console.log('message deleted!', data);
          store.close(function(err, data) {
            console.log('store.close err:', err);
          });
        });
      }
    });
  });
});
```

**Sample:** get message by message from server and log their subjets
```javascript
var store = mailx.store('imap', 'imap.example.net', 143, 'login', 'password');
store.connect(function(err) {
  if (err) {
    return console.log('err connect: ', err);
  }
  var inbox = store.getInbox(1);
  inbox.fail(function(err){
    console.log('fail get messages: ', err);
  });
  inbox.done(function(status){  
    console.log('end of inbox');
  });
  (function recursiveRcpt() {
    inbox.getNextMessage(function(err, message) {
      if (err) {
        return console.log('fail get message: ', err);
      }
      if (message === null) {
        return console.log('no more message to read');
      }
      console.log(message.subject);
      recursiveRcpt();
    });
  })();
});
```

---
_Source: https://npm.io/package/mailx · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
