Skip to content

SMTP Preview and test tools, view outgoing email in a web UI, build withVue3 + Tailwind

License

Notifications You must be signed in to change notification settings

restsend/smtppreview

Repository files navigation

SMTP Preview - SMTP Test tools

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.

Screenshot

Quick start

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 is 9025
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("unittest@restsend.com", 'utf-8')
message['To'] = Header("oss@restsend.com", 'utf-8')

subject = 'Hello SMTP Preview'
message['Subject'] = Header(subject, 'utf-8')

conn = smtplib.SMTP('localhost', port=9025)
# Mock login
conn.login('you@restsend.com', 'smtppreview')

r = conn.sendmail('you@restsend.com',
                  ['oss@restsend.com', 'hello@restsend.com'],
                  message.as_string())

print('send ok, result:', r)

How SMTP Preview work?