-
Notifications
You must be signed in to change notification settings - Fork 512
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'api-with-compression' into enable_compression
- Loading branch information
Showing
134 changed files
with
35,769 additions
and
16,747 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Test | ||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
# Node LTS https://nodejs.org/en/about/releases/ | ||
node-version: [12.22.11, 14.19.1, 16.x] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{matrix.node-version}} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{matrix.node-version}} | ||
- run: npm ci | ||
- run: npm test | ||
- run: bash <(curl -s https://codecov.io/bash) # Upload to Codecov |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,32 @@ | ||
# Base | ||
FROM node:10-alpine as base | ||
FROM node:16-alpine as base | ||
MAINTAINER "Dan Farrelly <[email protected]>" | ||
|
||
ENV NODE_ENV production | ||
|
||
|
||
# Build | ||
FROM base as build | ||
|
||
WORKDIR /root | ||
COPY package*.json ./ | ||
|
||
RUN apk add --no-cache curl \ | ||
&& npm install \ | ||
# In order to ensure the normal operation of Node v12/v14, | ||
# the current project uses the old version of npm lock | ||
# TODO: Save node v16 dependency locks separately | ||
RUN rm package-lock.json | ||
RUN npm install --production \ | ||
&& npm prune \ | ||
&& npm cache clean --force \ | ||
&& rm package*.json | ||
|
||
|
||
# Prod | ||
FROM base as prod | ||
|
||
USER node | ||
WORKDIR /home/node | ||
|
||
COPY --chown=node:node . /home/node | ||
COPY --chown=node:node --from=build /root/node_modules /home/node/node_modules | ||
|
||
EXPOSE 1080 1025 | ||
|
||
ENTRYPOINT ["/home/node/bin/maildev"] | ||
CMD ["--web", "1080", "--smtp", "1025"] | ||
|
||
ENV MAILDEV_WEB_PORT 1080 | ||
ENV MAILDEV_SMTP_PORT 1025 | ||
ENTRYPOINT ["bin/maildev"] | ||
HEALTHCHECK --interval=10s --timeout=1s \ | ||
CMD curl -k -f -v http://localhost:1080/healthz || exit 1 | ||
CMD wget -O - http://localhost:1080/healthz || exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,82 @@ | ||
# MailDev | ||
|
||
[![Build Status](https://api.travis-ci.org/maildev/maildev.svg)](https://travis-ci.org/maildev/maildev) | ||
[![codecov](https://codecov.io/gh/maildev/maildev/branch/master/graph/badge.svg)](https://codecov.io/gh/maildev/maildev) | ||
[![NPM Version](https://img.shields.io/npm/v/maildev.svg)](https://www.npmjs.com/package/maildev) | ||
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) | ||
|
||
**MailDev** is a simple way to test your project's generated emails during development with an easy to use web interface that runs on your machine built on top of [Node.js](http://www.nodejs.org). | ||
**MailDev** is a simple way to test your project's generated emails during development with an easy to use web interface that runs on your machine. Built on top of [Node.js](http://www.nodejs.org). | ||
|
||
![MailDev Screenshot](https://github.com/maildev/maildev/blob/gh-pages/images/screenshot-2015-03-29.png?raw=true) | ||
![MailDev Screenshot](https://github.com/maildev/maildev/blob/gh-pages/images/screenshot-2021-01-03.png?raw=true) | ||
|
||
## Install & Run | ||
|
||
$ npm install -g maildev | ||
$ maildev | ||
## Docker Run | ||
|
||
If you want to use MailDev with [Docker](https://www.docker.com/), you can use the | ||
[**maildev/maildev** image on Docker Hub](https://hub.docker.com/r/maildev/maildev). | ||
[**soulteary/maildev** image on Docker Hub](https://hub.docker.com/r/soulteary/maildev). | ||
For a guide for usage with Docker, | ||
[checkout the docs](https://github.com/maildev/maildev/blob/master/docs/docker.md). | ||
|
||
$ docker run -p 1080:1080 -p 1025:1025 maildev/maildev | ||
|
||
For convenient use with Grunt, try [grunt-maildev](https://github.com/xavierpriour/grunt-maildev). | ||
$ docker run -p 1080:1080 -p 1025:1025 soulteary/maildev | ||
|
||
## Usage | ||
|
||
``` | ||
Usage: maildev [options] | ||
``` | ||
|
||
|Options|Environment variable|Description| | ||
|---|---|---| | ||
|`-s, --smtp <port>`|`MAILDEV_SMTP_PORT`|SMTP port to catch emails| | ||
|`-w, --web <port>`|`MAILDEV_WEB_PORT`|Port to run the Web GUI| | ||
|`--https`|`MAILDEV_HTTPS`|Switch from http to https protocol| | ||
|`--https-key <file>`|`MAILDEV_HTTPS_KEY`|The file path to the ssl private key| | ||
|`--https-cert <file>`|`MAILDEV_HTTPS_CERT`|The file path to the ssl cert file| | ||
|`--ip <ip address>`|`MAILDEV_IP`|IP Address to bind SMTP service to| | ||
|`--outgoing-host <host>`|`MAILDEV_OUTGOING_HOST`|SMTP host for outgoing emails| | ||
|`--outgoing-port <port>`|`MAILDEV_OUTGOING_PORT`|SMTP port for outgoing emails| | ||
|`--outgoing-user <user>`|`MAILDEV_OUTGOING_USER`|SMTP user for outgoing emails| | ||
|`--outgoing-pass <password>`|`MAILDEV_OUTGOING_PASS`|SMTP password for outgoing emails| | ||
|`--outgoing-secure`|`MAILDEV_OUTGOING_SECURE`|Use SMTP SSL for outgoing emails| | ||
|`--auto-relay [email]`|`MAILDEV_AUTO_RELAY`|Use auto-relay mode. Optional relay email address| | ||
|`--auto-relay-rules <file>`|`MAILDEV_AUTO_RELAY_RULES`|Filter rules for auto relay mode| | ||
|`--incoming-user <user>`|`MAILDEV_INCOMING_USER`|SMTP user for incoming emails| | ||
|`--incoming-pass <pass>`|`MAILDEV_INCOMING_PASS`|SMTP password for incoming emails| | ||
|`--web-ip <ip address>`|`MAILDEV_WEB_IP`|IP Address to bind HTTP service to, defaults to --ip| | ||
|`--web-user <user>`|`MAILDEV_WEB_USER`|HTTP user for GUI| | ||
|`--web-pass <password>`|`MAILDEV_WEB_PASS`|HTTP password for GUI| | ||
|`--base-pathname <path>`|`MAILDEV_BASE_PATHNAME`|base path for URLs| | ||
|`--disable-web`|`MAILDEV_DISABLE_WEB`|Disable the use of the web interface. Useful for unit testing| | ||
|`--hide-extensions <extensions>`|`MAILDEV_HIDE_EXTENSIONS`|Comma separated list of SMTP extensions to NOT advertise (SMTPUTF8, PIPELINING, 8BITMIME)| | ||
|`-o, --open`||Open the Web GUI after startup| | ||
|`-v, --verbose`||| | ||
|`--silent`||| | ||
| Options | Environment variable | Description | | ||
| -------------------------------- | -------------------------- | ----------------------------------------------------------------------------------------- | | ||
| `-s, --smtp <port>` | `MAILDEV_SMTP_PORT` | SMTP port to catch emails | | ||
| `-w, --web <port>` | `MAILDEV_WEB_PORT` | Port to run the Web GUI | | ||
| `--mail-directory <path>` | `MAILDEV_MAIL_DIRECTORY` | Directory for persisting mails | | ||
| `--https` | `MAILDEV_HTTPS` | Switch from http to https protocol | | ||
| `--https-key <file>` | `MAILDEV_HTTPS_KEY` | The file path to the ssl private key | | ||
| `--https-cert <file>` | `MAILDEV_HTTPS_CERT` | The file path to the ssl cert file | | ||
| `--ip <ip address>` | `MAILDEV_IP` | IP Address to bind SMTP service to | | ||
| `--outgoing-host <host>` | `MAILDEV_OUTGOING_HOST` | SMTP host for outgoing emails | | ||
| `--outgoing-port <port>` | `MAILDEV_OUTGOING_PORT` | SMTP port for outgoing emails | | ||
| `--outgoing-user <user>` | `MAILDEV_OUTGOING_USER` | SMTP user for outgoing emails | | ||
| `--outgoing-pass <password>` | `MAILDEV_OUTGOING_PASS` | SMTP password for outgoing emails | | ||
| `--outgoing-secure` | `MAILDEV_OUTGOING_SECURE` | Use SMTP SSL for outgoing emails | | ||
| `--auto-relay [email]` | `MAILDEV_AUTO_RELAY` | Use auto-relay mode. Optional relay email address | | ||
| `--auto-relay-rules <file>` | `MAILDEV_AUTO_RELAY_RULES` | Filter rules for auto relay mode | | ||
| `--incoming-user <user>` | `MAILDEV_INCOMING_USER` | SMTP user for incoming emails | | ||
| `--incoming-pass <pass>` | `MAILDEV_INCOMING_PASS` | SMTP password for incoming emails | | ||
| `--web-ip <ip address>` | `MAILDEV_WEB_IP` | IP Address to bind HTTP service to, defaults to --ip | | ||
| `--web-user <user>` | `MAILDEV_WEB_USER` | HTTP user for GUI | | ||
| `--web-pass <password>` | `MAILDEV_WEB_PASS` | HTTP password for GUI | | ||
| `--base-pathname <path>` | `MAILDEV_BASE_PATHNAME` | Base path for URLs | | ||
| `--disable-web` | `MAILDEV_DISABLE_WEB` | Disable the use of the web interface. Useful for unit testing | | ||
| `--hide-extensions <extensions>` | `MAILDEV_HIDE_EXTENSIONS` | Comma separated list of SMTP extensions to NOT advertise (SMTPUTF8, PIPELINING, 8BITMIME) | | ||
| `-o, --open` | | Open the Web GUI after startup | | ||
| `-v, --verbose` | | | | ||
| `--silent` | | | | ||
| `--log-mail-contents` | | Log a JSON representation of each incoming mail | | ||
|
||
## API | ||
|
||
MailDev can be used in your Node.js application. For more info view the | ||
[API docs](https://github.com/maildev/maildev/blob/master/docs/api.md). | ||
|
||
```javascript | ||
const MailDev = require('maildev') | ||
const MailDev = require("maildev"); | ||
|
||
const maildev = new MailDev() | ||
const maildev = new MailDev(); | ||
|
||
maildev.listen() | ||
maildev.listen(); | ||
|
||
maildev.on('new', function (email) { | ||
maildev.on("new", function (email) { | ||
// We got a new email! | ||
}) | ||
}); | ||
``` | ||
|
||
MailDev also has a **REST API**. For more info | ||
[view the docs](https://github.com/maildev/maildev/blob/master/docs/rest.md). | ||
|
||
## Outgoing email | ||
|
||
Maildev optionally supports selectively relaying email to an outgoing SMTP server. If you configure outgoing | ||
Maildev optionally supports selectively relaying email to an outgoing SMTP server. If you configure outgoing | ||
email with the --outgoing-* options you can click "Relay" on an individual email to relay through MailDev out | ||
to a real SMTP service that will *actually* send the email to the recipient. | ||
to a real SMTP service that will *actually\* send the email to the recipient. | ||
|
||
Example: | ||
Example: | ||
|
||
$ maildev --outgoing-host smtp.gmail.com \ | ||
--outgoing-secure \ | ||
|
@@ -103,7 +98,7 @@ Additionally, you can pass a valid json file with additional configuration for | |
what email addresses you would like to `allow` or `deny`. The last matching | ||
rule in the array will be the rule MailDev will follow. | ||
|
||
Example: | ||
Example: | ||
|
||
$ maildev --outgoing-host smtp.gmail.com \ | ||
--outgoing-secure \ | ||
|
@@ -112,18 +107,20 @@ rule in the array will be the rule MailDev will follow. | |
--auto-relay \ | ||
--auto-relay-rules file.json | ||
|
||
Rules example file: | ||
Rules example file: | ||
|
||
```javascript | ||
[ | ||
{ "allow": "*" }, | ||
{ "deny": "*@test.com" }, | ||
{ "allow": "[email protected]" }, | ||
{ "deny": "*@utah.com" }, | ||
{ "allow": "[email protected]" } | ||
] | ||
{ allow: "*" }, | ||
{ deny: "*@test.com" }, | ||
{ allow: "[email protected]" }, | ||
{ deny: "*@utah.com" }, | ||
{ allow: "[email protected]" }, | ||
]; | ||
``` | ||
This would allow `[email protected]`, `[email protected]`, `[email protected]`, but deny | ||
`[email protected]`. | ||
|
||
This would allow `[email protected]`, `[email protected]`, `[email protected]`, but deny | ||
`[email protected]`. | ||
|
||
## Configure your project | ||
|
||
|
@@ -132,11 +129,13 @@ Configure your application to send emails via port `1025` and open `localhost:10 | |
**Nodemailer (v1.0+)** | ||
|
||
```javascript | ||
// We add this setting to tell nodemailer the host isn't secure during dev | ||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; | ||
|
||
const transport = nodemailer.createTransport({ | ||
port: 1025, | ||
ignoreTLS: true, | ||
// other settings... | ||
}) | ||
}); | ||
``` | ||
|
||
**Django** -- Add `EMAIL_PORT = 1025` in your settings file [[source]](https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-EMAIL_PORT) | ||
|
@@ -156,12 +155,12 @@ config.action_mailer.delivery_method = :smtp | |
|
||
## Features | ||
|
||
* Toggle between HTML, plain text views as well as view email headers | ||
* Test Responsive Emails w/ resizeable preview pane available for 320/480/600px screen sizes | ||
* Ability to receive and view email attachments | ||
* Websockets keep the interface in sync once emails are received | ||
* Command line interface for configuring SMTP and Web interface ports | ||
* Ability to relay email to an upstream SMTP server | ||
- Toggle between HTML, plain text views as well as view email headers | ||
- Test responsive emails with resizable preview pane available for various screen sizes | ||
- Ability to receive and view email attachments | ||
- WebSocket integration keeps the interface in sync once emails are received | ||
- Command line interface for configuring SMTP and web interface ports | ||
- Ability to relay email to an upstream SMTP server | ||
|
||
## Ideas | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Security Policy | ||
|
||
## Supported Versions | ||
|
||
|
||
| Version | Supported | | ||
| ------- | ------------------ | | ||
| 2.x.x | :white_check_mark: | | ||
| 1.x.x | :x: | | ||
|
||
## Reporting a Vulnerability | ||
|
||
We take security issues very seriously. | ||
|
||
Usually, feedback on security issues provided in ISSUE will be corrected within 3 days. |
Oops, something went wrong.