使用MailCatcher作为开发环境邮件服务器

MailCatcher 运行一个超级简单的 SMTP 服务器,它可以捕获发送到它的任何消息并在 web 界面中显示。

运行 mailcatcher,将你最喜欢的应用程序设置为 smtp://127.0.0.1:1025,而不是默认的 SMTP 服务器,然后检查 http://127.0.0.1:1080,查看到目前为止的邮件。

file

ubuntu安装MailCatcher

sudo apt install ruby ruby-dev libsqlite3-dev build-essential
sudo gem install mailcatcher

运行

默认运行即可,更多参数如下

mailcatcher -h
Usage: mailcatcher [options]
        --ip IP                      Set the ip address of both servers
        --smtp-ip IP                 Set the ip address of the smtp server
        --smtp-port PORT             Set the port of the smtp server
        --http-ip IP                 Set the ip address of the http server
        --http-port PORT             Set the port address of the http server
        --http-path PATH             Add a prefix to all HTTP paths
        --no-quit                    Don't allow quitting the process
    -f, --foreground                 Run in the foreground
    -v, --verbose                    Be more verbose
    -h, --help                       Display this help information