[LINUX] Send mail with mailx to a dummy SMTP server set up with python.

A dummy SMTP server using python can be easily started with the following command.

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

However, when I tried to send an email to this server by mailx, it was awkward, so I will write the procedure instead of a memorandum. Because mailx sends mail to MTAs such as sendmail or postfix It is good to specify the above dummy SMTP server as the relay server of sendmail or postfix. Since postfix was working in my environment The following settings have been added to /etc/postfix/main.cf.

relayhost = [127.0.0.1]:8025

Then restart postfix.

sudo systemctl restart postfix.service

Send with this

echo "test" | mail -v -s "test" [email protected]

The mail should arrive at the dummy SMTP server.

Recommended Posts

Send mail with mailx to a dummy SMTP server set up with python.
Set up a test SMTP server in Python.
Set up a simple SMTP server in Python
When it is troublesome to set up an SMTP server locally when sending mail with Python.
[Vagrant] Set up a simple API server with python
Set up a Samba server with Docker
Set up a mail server using Twisted
How to set up a simple SMTP server that can be tested locally in Python
Send a message from Slack to a Python server
Set up a simple HTTPS server with asyncio
Send a message to LINE with Python (LINE Notify)
Set up a local server with Go-File upload-
Send an email to a specific email address with python without SMTP settings
Set up a local server with Go-File download-
How to set up a local development 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 set up a Python environment using pyenv
Set up a Python development environment with Sublime Text 2
How to install NPI + send a message to line with python
I tried various methods to send Japanese mail with Python
Set up a Python development environment with Visual Studio Code
Set up a web server with CentOS7 + Anaconda + Django + Apache
Try to bring up a subwindow with PyQt5 and Python
I want to set up a GUI development environment with Python or Golang on Mac
How to send a request to the DMM (FANZA) API with python
HTML email with image to send with python
Create a dummy image with Python + PIL.
Send a message from Python to Slack
I tried to communicate with a remote server by Socket communication with Python.
Set up reverse proxy to https server with CentOS Linux 8 + Apache mod_ssl
Try to set up a Vim test environment quite seriously (for Python)
Set up a local web server in 30 seconds using python 3's http.server
Try to solve a set problem of high school math with Python
How to read a CSV file with Python 2/3
How to send a message to LINE with curl
ODBC connection to FileMaker 11 Server Advanced with Python 3
I tried to make a simple mail sending application with tkinter of Python
Send an email to Spushi's address with python
Try to draw a life curve with python
I want to make a game with Python
Start a simple Python web server with Docker
Try to make a "cryptanalysis" cipher with Python
Pretend to be a server with two PCs
Set up a UDP server in C language
Decide to assign a laboratory with Python (fiction)
Sample to send slack notification with python lambda
Steps to create a Twitter bot with python
Launch a web server with Python and Flask
Try to make a dihedral group with Python
Set up a Python development environment on Marvericks
I want to write to a file with Python
A layman wants to get started with Python
[Python] How to create a local web server environment with SimpleHTTPServer and CGIHTTPServer
How to set up a Google Colab environment with Coursera's advanced machine learning courses
I want to set up a mock server for python-flask in seconds using swagger-codegen.
[Python] I tried to automatically create a daily report of YWT with Outlook mail
python note: What does it mean to set a seed with random number generation?
How to convert / restore a string with [] in python
A memo connected to HiveServer2 of EMR with python
[Python] How to draw a line graph with Matplotlib