ref: http://6ftdan.com/allyourdev/2015/05/12/fake-a-smtp-server-with-python-for-rails-testing/
➜ ~ sudo python -m smtpd -n -c DebuggingServer localhost:25
Password:
---------- MESSAGE FOLLOWS ----------
From: [email protected]
Subject: test dayo
hello, world.
------------ END MESSAGE ------------
➜ ~ telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 PMAC056S.local Python SMTP proxy version 0.2
HELO
501 Syntax: HELO hostname
HELO localhost
250 PMAC056S.local
MAIL FROM: [email protected]
250 Ok
RCPT TO: [email protected]
250 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
From: [email protected]
Subject: test dayo
hello, world.
.
250 Ok
QUIT
221 Bye
Connection closed by foreign host.