diff --git a/README.md b/README.md index cb37b641..b1340965 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,11 @@ ## Docker Run If you want to use MailDev with [Docker](https://www.docker.com/), you can use the -[**soulteary/maildev** image on Docker Hub](https://hub.docker.com/r/soulteary/maildev). +[**maildev/maildev** image on Docker Hub](https://hub.docker.com/r/maildev/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 soulteary/maildev + $ docker run -p 1080:1080 -p 1025:1025 maildev/maildev ## Usage @@ -23,22 +23,22 @@ Usage: maildev [options] | Options | Environment variable | Description | | -------------------------------- | -------------------------- | ----------------------------------------------------------------------------------------- | -| `-s, --smtp ` | `MAILDEV_SMTP_PORT` | SMTP port to catch mail | +| `-s, --smtp ` | `MAILDEV_SMTP_PORT` | SMTP port to catch mail | | `-w, --web ` | `MAILDEV_WEB_PORT` | Port to run the Web GUI | -| `--mail-directory ` | `MAILDEV_MAIL_DIRECTORY` | Directory for persisting mail | +| `--mail-directory ` | `MAILDEV_MAIL_DIRECTORY` | Directory for persisting mail | | `--https` | `MAILDEV_HTTPS` | Switch from http to https protocol | | `--https-key ` | `MAILDEV_HTTPS_KEY` | The file path to the ssl private key | | `--https-cert ` | `MAILDEV_HTTPS_CERT` | The file path to the ssl cert file | | `--ip ` | `MAILDEV_IP` | IP Address to bind SMTP service to | -| `--outgoing-host ` | `MAILDEV_OUTGOING_HOST` | SMTP host for outgoing mail | -| `--outgoing-port ` | `MAILDEV_OUTGOING_PORT` | SMTP port for outgoing mail | -| `--outgoing-user ` | `MAILDEV_OUTGOING_USER` | SMTP user for outgoing mail | -| `--outgoing-pass ` | `MAILDEV_OUTGOING_PASS` | SMTP password for outgoing mail | -| `--outgoing-secure` | `MAILDEV_OUTGOING_SECURE` | Use SMTP SSL for outgoing mail | +| `--outgoing-host ` | `MAILDEV_OUTGOING_HOST` | SMTP host for outgoing mail | +| `--outgoing-port ` | `MAILDEV_OUTGOING_PORT` | SMTP port for outgoing mail | +| `--outgoing-user ` | `MAILDEV_OUTGOING_USER` | SMTP user for outgoing mail | +| `--outgoing-pass ` | `MAILDEV_OUTGOING_PASS` | SMTP password for outgoing mail | +| `--outgoing-secure` | `MAILDEV_OUTGOING_SECURE` | Use SMTP SSL for outgoing mail | | `--auto-relay [email]` | `MAILDEV_AUTO_RELAY` | Use auto-relay mode. Optional relay email address | | `--auto-relay-rules ` | `MAILDEV_AUTO_RELAY_RULES` | Filter rules for auto relay mode | -| `--incoming-user ` | `MAILDEV_INCOMING_USER` | SMTP user for incoming mail | -| `--incoming-pass ` | `MAILDEV_INCOMING_PASS` | SMTP password for incoming mail | +| `--incoming-user ` | `MAILDEV_INCOMING_USER` | SMTP user for incoming mail | +| `--incoming-pass ` | `MAILDEV_INCOMING_PASS` | SMTP password for incoming mail | | `--web-ip ` | `MAILDEV_WEB_IP` | IP Address to bind HTTP service to, defaults to --ip | | `--web-user ` | `MAILDEV_WEB_USER` | HTTP user for GUI | | `--web-pass ` | `MAILDEV_WEB_PASS` | HTTP password for GUI | @@ -48,7 +48,7 @@ Usage: maildev [options] | `-o, --open` | | Open the Web GUI after startup | | `-v, --verbose` | | | | `--silent` | | | -| `--log-mail-contents` | | Log a JSON representation of each incoming mail | +| `--log-mail-contents` | | Log a JSON representation of each incoming mail | ## API diff --git a/docker-compose.yml b/docker-compose.yml index 7eac994a..8d52bbbc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ version: '3' services: maildev: - image: soulteary/maildev + image: maildev/maildev restart: always environment: - TZ=Asia/Shanghai diff --git a/docs/docker.md b/docs/docker.md index 0b931e4f..ff0df69b 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -21,12 +21,16 @@ Now the MailDev UI will be running at port `1080` on your virtual machine running at `192.168.99.100`, you can head over to `http://192.168.99.100:1080` to visit the interface. +## Linking containers + +> This is for using [Docker's legacy container links](https://docs.docker.com/network/links/). + Let's say you're using [nodemailer](https://github.com/nodemailer/nodemailer) in your Node.js app running in another container. Let's link your app's container with MailDev: ``` -$ docker run -p 8080:80 --link maildev yourimage +$ docker run -p 8080:1080 --link maildev yourimage ``` From within your app's container, Docker will expose some helpful environment @@ -35,28 +39,34 @@ used to send your emails. Sending them here will result in them being captured by MailDev. Here's an example of using these with Nodemailer: To pass parameters, because the Dockerfile uses CMD, you need to specify the executable again. -The Dockerfile specifically EXPOSES port 80 and 25, therefor you need to tell maildev to use them. +The Dockerfile specifically EXPOSES port 1080 and 1025, therefor you need to tell maildev to use them. This example adds the base-pathname parameter. ``` $ docker run -p 1080:1080 -p 1025:1025 maildev/maildev bin/maildev --base-pathname /maildev -w 1080 -s 1025 ``` - ```js // We add this setting to tell nodemailer the host isn't secure during dev process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; -const nodemailer = require('nodemailer') +const nodemailer = require("nodemailer"); const transporter = nodemailer.createTransport({ // In Node, environment variables are available on process.env host: process.env.MAILDEV_PORT_25_TCP_ADDR, // ex. 172.17.0.10 - port: process.env.MAILDEV_PORT_25_TCP_PORT, // ex. 25 -}) + port: process.env.MAILDEV_PORT_25_TCP_PORT, // ex. 1025 +}); // Now when your send an email, it will show up in the MailDev interface -transporter.sendMail({ /* from, to, etc... */ }, (err, info) => { /* ... */ }); +transporter.sendMail( + { + /* from, to, etc... */ + }, + (err, info) => { + /* ... */ + } +); ``` The above example could apply for any app in any language using the available @@ -64,7 +74,7 @@ environment variables to configure how to send email. ## Advanced usage -*Needs documentation for how to use cli arguments* +_Needs documentation for how to use cli arguments_ ## Docker Compose @@ -72,10 +82,10 @@ To use MailDev with Docker Compose, add the following to your `docker-compose.yml` file in the `services` section: ```yaml - maildev: - image: maildev/maildev - ports: - - "1080:80" +maildev: + image: maildev/maildev + ports: + - "1080:1080" ``` Here's an example using Nodemailer: @@ -84,15 +94,22 @@ Here's an example using Nodemailer: // We add this setting to tell nodemailer the host isn't secure during dev process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; -const nodemailer = require('nodemailer'); +const nodemailer = require("nodemailer"); const transporter = nodemailer.createTransport({ - host: 'maildev', - port: 25, + host: "maildev", + port: 1025, }); // Now when your send an email, it will show up in the MailDev interface -transporter.sendMail({ /* from, to, etc... */ }, (err, info) => { /* ... */ }); +transporter.sendMail( + { + /* from, to, etc... */ + }, + (err, info) => { + /* ... */ + } +); ``` Note that the host name, `maildev`, is the name of the service in your