从零开始几步搭建好自己邮件通知服务器

sudo apt install mailutils -y
sudo vim /etc/postfix/main.cf

# /etc/postfix/main.cf
myhostname = {domain}
mydestination = {domain}, $hostname, localhost.localdomain, localhost
net_interfaces = loopback-only

sudo hostnamectl set-hostname {domain}

sudo vim /etc/mailname
# /etc/mailname
{domain}

sudo service postfix restart

echo "This is the body of email" | mail -s "This is the subject line" <收件人地址>