npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

eelmail

v1.5.1

Published

email server

Downloads

13

Readme

eelmail

email server providing imap and smtp

quick start

Let's set up an email server that sounds like a fun thing to do why not.

start a server as root

We can start a server as root so that it can listen on low ports (25 and 143) used by smtp and imap:

$ sudo eelmail server -d ./maildb

This isn't so great for security, so you probably want to drop privileges inside the server with --uid and --gid:

$ sudo eelmail server -d ./maildb --uid=$UID --gid=$GROUPS

add accounts

Once the server is running, create a user account:

$ eelmail -d ./maildb users create substack \
  --login.basic.username=substack --login.basic.password=beepboop

You can also pass in the datadir with $EELMAIL_DATADIR.

If it worked, eelmail users list should now show your username:

$ eelmail users list
substack

Repeat for additional user accounts you wish to configure.

sanity check

Now that the server is running and accounts are configured, let's send a test email. Here I'm using substack.net but you should replace that with your own domain.

Make sure you have netcat installed then do:

$ nc substack.net 25 <<END
> helo localhost
> mail from: [email protected]
> rcpt to: [email protected]
> data
> subject: yo
> 
> beep boop
> .
> quit
> END
220 beep
250 localhost
250
250
354
250
221 Bye!

Now make sure you have an email server (like postfix on linux) running locally and do:

$ fetchmail -p imap -u substack substack.net
Enter password for [email protected]: 
1 message for substack at substack.net.
reading message [email protected]:1 of 1 (17 header octets) (9 body octets) flushed

Enter the password that you configured and if it worked, you should now have mail in your local inbox.

Type mail to read your email:

$ mail
"/var/mail/substack": 1 message 1 new
>N   1 [email protected] Fri Sep 26 09:51  18/728   yo
? n
Return-Path: <[email protected]>
X-Original-To: [email protected]
Delivered-To: [email protected]
Received: from beep (beep [IPv6:::1])
    by beep (Postfix) with ESMTP id 5C06D740061
    for <[email protected]>; Fri, 26 Sep 2014 09:51:41 -0700 (PDT)
Received: from localhost.localdomain [::1]
    by beep with IMAP (fetchmail-6.3.21)
    for <[email protected]> (single-drop); Fri, 26 Sep 2014 19:51:41 +0300 (IDT)
Received: from localhost.localdomain [::1]
    by beep with IMAP (fetchmail-6.3.21)
    for <[email protected]> (single-drop); Fri, 26 Sep 2014 19:47:56 +0300 (IDT)
subject: yo
Message-Id: <20140926165141.5C06D740061@beep>
Date: Fri, 26 Sep 2014 09:51:41 -0700 (PDT)
From: [email protected]

beep boop
? 

api example

You can also create your own server from the api:

var eelmail = require('eelmail');
var level = require('level-party');

var db = level('./data/db');
var em = eelmail(db, { dir: './data' });

em.createServer('smtp').listen(25);
em.createServer('imap').listen(143);

Here we use level-party so that the user accounts can be modified while the server is running with the eelmail users command. Just make sure that -d matches the data dir.

usage

Usage: eelmail COMMAND...

  eelmail {OPTIONS} users ...

    Manage eelmail user accounts.
    Run `eelmail users -h` for the list of commands.

  eelmail server {OPTIONS}

    Start an imap and smtp server.

    --ports.smtp  port to use for smtp (default: 25)
    --ports.imap  port to use for imap (default: 143)

    To use ssl for imap, specify one of:

    --imap.cert / --imap.key  paths of tls cert and key files
    --imap.pfx                path of pfx file

  eelmail help

    Show this message.

Global options:

  -d, --dir  directory to use to store data
             default: $EELMAIL_DATADIR or ./eelmail.db

methods

var eelmail = require('eelmail')

var em = eelmail(db, opts)

Create an eelmail instance em from a db and opts.

var server = em.createServer(type, opts)

Create a server for type:

  • 'imap' - service to fetch saved emails
  • 'imaps' - imap over ssl
  • 'smtp' - service to receive emails
  • 'smtps' - smtp over ssl

For 'imaps', 'smtp', and 'smtps' you'll need to supply opts.key/opts.cert or opts.pfx.

em.close()

Close the database.

install

With npm, to get the eelmail command, do:

npm install -g eelmail

and to get the library, do:

npm install eelmail

license

MIT