はじめに
http://blogs.yahoo.co.jp/dk521123/36230453.htmlで、Windows環境にて、ダミーSMTPサーバとして、smtp4dev を利用した。 今回は、Linux環境で、ダミーSMTPサーバを立てる
[1] FakeSMTP
* Java Ver1.6以上
設定手順
[1] 以下のサイトの「Download」からモジュール「fakeSMTP-latest.zip」を落としてくるhttp://nilhcem.github.io/FakeSMTP/index.html
[2] [1]のモジュール「fakeSMTP-latest.zip」を解凍する => 解凍すると「fakeSMTP-2.0.jar」が出てくる # Windowsの場合、JARファイルをダブルクリックするだけ [3] コマンドで「java -jar fakeSMTP-2.0.jar 【オプション】」で起動する [Options] -s : 自動立ち上げモード -b : GUIでの立ち上げをオフ -p : ポート番号の指定(-p xxxx) / デフォルトは、port 25 -a : アドレス -o : 特定の場所にメールを格納(-o directory) -m : メモリモード(メールを保存しない場合に使用) [例] java -jar fakeSMTP-2.0.jar -s -b -p 2525 -a 127.0.0.1
公式サイト
http://nilhcem.github.io/FakeSMTP/index.html参考文献
http://www.moongift.jp/2013/05/20130507-3/http://propg.ee-mall.info/it/%E3%83%A1%E3%83%BC%E3%83%AB%E9%80%81%E4%BF%A1%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%A0%E3%81%AE%E7%A2%BA%E8%AA%8D%E7%94%A8%E3%81%AB%EF%BC%81%EF%BC%81-%E3%80%8Cfakesmtp%E3%80%8D/
[2] MailCatcher
設定手順
[1] 以下のコマンドを入力 sudo yum update sudo yum groupinstall "Development Tools" sudo yum install ruby-devel ruby19-devel sqlite-devel openssl openssl-devel sudo yum install rubygems # インストール gem install mailcatcher # 起動 mailcatcher [2] ブラウザで以下のURLにアクセスする[[http://localhost:1080/]]
補足:mailcatcherのオプション
# ヘルプ mailcatcher --help # ポート変更 mailcatcher --smtp-port 20025 --http-port 20080構文
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 --no-quit Don't allow quitting the process -f, --foreground Run in the foreground -b, --browse Open web browser -v, --verbose Be more verbose -h, --help Display this help information
【任意設定】Apacheとの連携
* なお、Apacheの設定は、以下の関連記事を参照のこと。http://blogs.yahoo.co.jp/dk521123/36072244.html
[1] /etc/httpd/conf.d 配下に、以下のMailCatcher.confを新規作成する/etc/httpd/conf.d/MailCatcher.conf
ProxyPass /mailcatcher http://localhost:1080
【任意設定】Mailcatcherの自動起動
* systemd を使って、Mailcatcherを自動起動させる # systemd については、以下の関連記事を参照のこと。http://blogs.yahoo.co.jp/dk521123/36255225.html
[1] /etc/systemd/system 配下に、以下のMailCatcher.service を新規作成 [2] 以下のコマンドを入力し、サービスの自動起動ONにし、OS再起動。 systemctl enable MailCatcher.service reboot/etc/systemd/system/MailCatcher.service
[Unit] Description=Mailcatcher Service [Service] Type=simple ExecStart=/usr/local/bin/mailcatcher --foreground --smtp-port 20025 --http-port 20080 [Install] WantedBy=multi-user.target
公式サイト
https://mailcatcher.me/参考文献
http://rriifftt.hatenablog.com/entry/2014/09/09/155055http://tech.respect-pal.jp/mail_debug_with_mailcatcher/
http://www.d-wood.com/blog/2013/05/22_3674.html
gem について
http://qiita.com/pb_tmz08/items/269c43418894071dc0b1
Apacheとの連携
http://www.chlab.ch/blog/archives/tools/setup-mailcatcher-vagrant-box
Mailcatcherの自動起動
http://tech-blog.gc-story.com/%E3%82%B9%E3%83%86%E3%83%BC%E3%82%B8%E3%83%B3%E3%82%B0%E3%82%B5%E3%83%BC%E3%83%90%E3%81%A7%E3%80%81mailcatcher-%E3%82%92mta%E3%81%A8%E3%81%97%E3%81%A6%E4%BD%BF%E7%94%A8%E3%81%99%E3%82%8B%E8%A8%AD
https://gist.github.com/jamiejackson/a195a97a1b9f20b2d179