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 🙏

© 2026 – Pkg Stats / Ryan Hefner

imapforward

v1.0.0

Published

Simple IMAP email forwarder for syncing multiple email accounts into one

Readme

📬 imapforward

Build Status npm version Docker License

Simple real-time IMAP email forwarder for syncing multiple email accounts into one. Built to replace deprecated gmailify tool for Gmail.

Features · Installation · Configuration · Docker

Features

  • Real-time sync — Uses IMAP IDLE for instant email forwarding
  • Multiple sources — Forward from multiple email accounts to a single Gmail
  • Original headers preserved — Emails arrive with their original From, Reply-To, and other headers intact
  • Selective folders — Choose which folders to sync (e.g. only INBOX)
  • Auto cleanup — Optionally delete messages after successful forwarding
  • Production-grade — Auto reconnect with exponential backoff, health check endpoint
  • Minimal footprint — Only 1 runtime dependency (imapflow)
  • Docker ready — Alpine-based image with built-in health checks

Installation

npm

npm install -g imapforward

Docker

docker pull ghcr.io/sinedied/imapforward:latest

Configuration

Create a config.json file:

{
  "target": {
    "host": "imap.gmail.com",
    "port": 993,
    "secure": true,
    "auth": {
      "user": "[email protected]",
      "pass": "your-app-password"
    }
  },
  "sources": [
    {
      "name": "Work Email",
      "host": "imap.work.com",
      "port": 993,
      "secure": true,
      "auth": {
        "user": "[email protected]",
        "pass": "password"
      },
      "folders": ["INBOX"],
      "deleteAfterForward": false
    }
  ],
}

Configuration Reference

| Field | Type | Required | Default | Description | |-------|------|----------|---------|-------------| | target.host | string | yes | — | Target IMAP server hostname | | target.port | number | yes | — | Target IMAP server port | | target.secure | boolean | no | port-based | Use TLS (defaults to true for ports 465/993) | | target.auth.user | string | yes | — | Target IMAP username | | target.auth.pass | string | yes | — | Target IMAP password or app password | | target.folder | string | no | "INBOX" | Target mailbox folder to append messages to | | sources[].name | string | yes | — | Display name for the source | | sources[].host | string | yes | — | IMAP server hostname | | sources[].port | number | yes | — | IMAP server port | | sources[].secure | boolean | yes | — | Use TLS | | sources[].auth.user | string | yes | — | IMAP username | | sources[].auth.pass | string | yes | — | IMAP password | | sources[].folders | string[] | no | ["INBOX"] | Folders to monitor | | sources[].deleteAfterForward | boolean | no | false | Delete messages after forwarding | | healthCheck.port | number | no | 8080 | HTTP health check server port |

[!TIP] For Gmail, you need to have 2FA enabled and use an App Password instead of your regular password.

Usage

CLI

# Using default config.json in current directory
imapforward

# Custom config path
imapforward --config /path/to/config.json

# Set log level
imapforward --log-level debug

CLI Options

| Option | Short | Description | |--------|-------|-------------| | --config <path> | -c | Config file path (default: config.json) | | --log-level <level> | -l | Log level: debug, info, warn, error (default: info) | | --version | -v | Show version | | --help | -h | Show help |

Environment Variables

| Variable | Description | |----------|-------------| | IMAPFORWARD_CONFIG | Override config file path | | LOG_LEVEL | Override log level |

Docker

Run with Docker

docker run -d \
  --name imapforward \
  -v $(pwd)/config.json:/app/config.json:ro \
  ghcr.io/sinedied/imapforward:latest

Docker Compose

services:
  imapforward:
    image: ghcr.io/sinedied/imapforward:latest
    restart: unless-stopped
    volumes:
      - ./config.json:/app/config.json:ro

Health Check

The health check server is always enabled (default port 8080). You can customize the port in your config:

{
  "healthCheck": {
    "port": 9090
  }
}

The HTTP health endpoint is available at:

curl http://localhost:8080/health

Response:

{
  "status": "ok",
  "sources": [
    {
      "name": "Work Email",
      "connected": true,
      "lastSync": "2026-02-25T10:30:00.000Z",
      "error": null
    }
  ]
}

Status values: ok (all connected), degraded (some connected), error (none connected).

How It Works

  1. Connects to each configured IMAP source account
  2. Scans for unseen messages that haven't been forwarded yet
  3. Appends each message to the target mailbox via IMAP preserving all original headers (raw RFC822)
  4. Marks forwarded messages with a $Forwarded IMAP flag
  5. Enters IMAP IDLE mode to watch for new messages in real-time
  6. Automatically reconnects with exponential backoff on connection loss