SMTP Preview is a tool for testing and inspecting email sending. It allows you to preview the layout and notification appearance of emails on different clients, as well as detecting potential SPAM warnings. It can be integrated into the development process for SMTP sending tests.
SMTP Preview is maintained by restsend.com.
SMTP Preview is written in Golang, and running smtppreview requires the Golang development environment. If you do not have the Golang development environment, you can refer to the official documentation of golang.
- Run
smtppreivew
via docker, the default smtp serve port is9025
docker run -ti --rm -p 9025:9025 -p 8000:8000 restsend/smtppreview
-
Visit web console,
http://localhost:8000
-
Send test mail via python code:
import smtplib
from email.mime.text import MIMEText
from email.header import Header
message = MIMEText('Hello SMTP Preview', 'plain', 'utf-8')
message['From'] = Header("[email protected]", 'utf-8')
message['To'] = Header("[email protected]", 'utf-8')
subject = 'Hello SMTP Preview'
message['Subject'] = Header(subject, 'utf-8')
conn = smtplib.SMTP('localhost', port=9025)
# Mock login
conn.login('[email protected]', 'smtppreview')
r = conn.sendmail('[email protected]',
['[email protected]', '[email protected]'],
message.as_string())
print('send ok, result:', r)