Menggunakan mailcatcher sebagai dummy smtp server di localhost untuk local development.
$ sudo gem install mailcatcher
...
$ mailcatcher
Starting MailCatcher
==> smtp://127.0.0.1:1025
==> http://127.0.0.1:1080
*** MailCatcher runs as a daemon by default. Go to the web interface to quit.
Start mailcather dengan menjalankan command mailcatcher
di cli
$ php --ini
Configuration File (php.ini) Path: /usr/local/etc/php/7.1
Loaded Configuration File: /usr/local/etc/php/7.1/php.ini
Scan for additional .ini files in: /usr/local/etc/php/7.1/conf.d
Additional .ini files parsed: /usr/local/etc/php/7.1/conf.d/ext-mcrypt.ini,
/usr/local/etc/php/7.1/conf.d/php-memory-limits.ini
# Edit file php.ini menggunakan nano / vim
# Edit direktif mengenail SMTP Port dan sendmail_path
$ vim /usr/local/etc/php/7.1/php.ini
; http://php.net/smtp-port
smtp_port = 1025
smtp_porsendmail_path = /usr/bin/env catchmail -f mail@localhost.devt = 1025
# Save dan Exit file
# Check config
$ php -i | grep "sendmail"
..
Path to sendmail => /usr/bin/env catchmail -f mail@localhost.dev
$ curl -v --insecure "smtp://localhost:1025" --mail-from "localmail@localhost.dev" --mail-rcpt "tajid.yakub@gmail.com" -T email-contents.txt
...
< 220 EventMachine SMTP Server
> EHLO email-contents.txt
< 250-Ok EventMachine SMTP Server
< 250-NO-SOLICITING
< 250 SIZE 20000000
> MAIL FROM:<localmail@localhost.dev> SIZE=167
< 250 Ok
> RCPT TO:<tajid.yakub@gmail.com>
< 250 Ok
> DATA
< 354 Send it
} [167 bytes data]
* We are completely uploaded and fine
< 250 Message accepted
100 167 0 0 100 167 0 766 --:--:-- --:--:-- --:--:-- 766
* Connection #0 to host localhost left intact
Kemudian periksa di browser http://localhost:1080