How to set up a simple SMTP server that can be tested locally in Python

Introduction

There are quite a few needs to test the skipped part of development and software installation.

If you already have an SMTP server, everything is OK if you use it, but you can't bother to set up Postfix or Sendmail when you start the server yourself and do various things!

Set up a test SMTP server

So let's set up a test SMTP server quickly! For Linux, just hit the code below. Even on Windows, it works if you install Python. Python nice!

python -m smtpd -n -c DebuggingServer localhost:8025

The port number may be a number that does not conflict with others.

important point

Since it is a test SMTP, the content sent is displayed on the terminal instead of actually delivering the mail. When you send a Japanese message, it is encoded in Base64, so if you want to check the contents, decode it in Base64.

Recommended Posts

How to set up a simple SMTP server that can be tested locally in Python
Set up a simple SMTP server in Python
Set up a simple HTTPS server in Python 3
Set up a test SMTP server in Python.
Set up an FTP server that can be created and destroyed immediately (in Python)
How to start a simple WEB server that can execute cgi of php and python
How to set up a local development server
Send mail with mailx to a dummy SMTP server set up with python.
How to set up a Python environment using pyenv
I want to create a priority queue that can be updated in Python (2.7)
How to install a Python library that can be used by pharmaceutical companies
[Vagrant] Set up a simple API server with python
A mechanism to call a Ruby method from Python that can be done in 200 lines
How to import Python library set up in EFS to Lambda
How to specify a public directory Python simple HTTP server
[Python Kivy] How to create a simple pop up window
When it is troublesome to set up an SMTP server locally when sending mail with Python.
How to get a stacktrace in python
How to make a rock-paper-scissors bot that can be easily moved (commentary)
Set up a local web server in 30 seconds using python 3's http.server
Set up a dummy SMTP server in Python and check the operation of sending from Action Mailer
Introduction and usage of Python bottle ・ Try to set up a simple web server with login function
How to embed a variable in a python string
How to create a JSON file in Python
Set up a UDP server in C language
How to notify a Discord channel in Python
[Python] How to draw a histogram in Matplotlib
A solution to the problem that the Python version in Conda cannot be changed
I tried to create a class that can easily serialize Json in Python
I made a familiar function that can be used in statistics with Python
[Python3] Code that can be used when you want to cut out an image in a specific size
How to set up public key authentication in ssh
How to convert / restore a string with [] in python
Set up a simple local server on your Mac
A simple Python HTTP server that supports Range Requests
[Python] How to expand variables in a character string
Set up a free server on AWS in 30 minutes
[Python] How to write a docstring that conforms to PEP8
How to create a simple TCP server / client script
How to execute a command using subprocess in Python
[Mac] I want to make a simple HTTP server that runs CGI with Python
I want to set up a mock server for python-flask in seconds using swagger-codegen.
Hello World is a simple web server that follows WSGI (Web Server Gateway Interface) in Python.
Notes on how to use StatsModels that can use linear regression and GLM in python
How to create a property of relations that can be prefetch_related by specific conditions
How to host web app backend processing in Python using a rental server subdomain
How to find the first element that matches your criteria in a Python list
How to test that Exception is raised in python unittest
How to slice a block multiple array from a multiple array in Python
A story about how to specify a relative path in python.
How to use the __call__ method in a Python class
Processing of python3 that seems to be usable in paiza
Launch a simple WEB server that can check the header
How to import a file anywhere you like in Python
A simple way to avoid multiple for loops in Python
How to define multiple variables in a python for statement
I tried "How to get a method decorated in Python"
How to develop in a virtual environment of Python [Memo]
How to get the last (last) value in a list in Python
How to get a list of built-in exceptions in python
[Python3] Code that can be used when you want to resize images in folder units