[Linux] SMTP setting method in Linux environment (host) when sending notification mail with Docker

Introduction

Memo about how to set SMTP in Linux environment (host) when sending notification mail with Docker

Environmental information

SMTP settings

Postfix configuration file changes

Configuration file: /etc/postfix/main.cf

mynetworks = 127.0.0.0/8,[IP used by Docker]
inet_interfaces = all

mynetworks

This item describes a trusted network. Mail from the SMTP server specified in this item is allowed to be relayed. That is, a list of IPs that are allowed to send email. Basically, specify "127.0.0.0/8" which indicates your server (localhost).

Please note that if you carelessly specify the IP in this item, it will be used for "illegal relay" to send spam mail from the outside.

inet_interfaces

Specifies the interface on which postfix listens. By default, it is localhost, and only mail can be exchanged inside the server. Specify all to allow communication with an external SMTP server.

Quote

https://oxynotes.com/?p=4646

postfix reboot

systemctl restart postfix

Recommended Posts

[Linux] SMTP setting method in Linux environment (host) when sending notification mail with Docker
[Linux] Build a jenkins environment with Docker
[Linux] Build a Docker environment with Amazon Linux 2
Hello World with gRPC / go in Docker environment
Japanese can be used with Python in Docker environment
When it is troublesome to set up an SMTP server locally when sending mail with Python.
Build Azure Pipelies with Azure DevOps in a Linux self-hosted environment
Get the host name of the host PC with Docker on Linux