首页 > 技术文章 > centos8.1,本地发送邮件

weiweirui 2020-05-23 09:33 原文

[root@centos8 ~]# mail
bash: mail: command not found...
Failed to search for file: Cannot update read-only repo
[root@centos8 ~]# dnf -y install postfix     安装软件

[root@centos8 ~]# systemctl start postfix
[root@centos8 ~]# ss -ntl

[root@centos8 ~]# mail -s test wei
bash: mail: command not found...
Failed to search for file: Cannot update read-only repo
[root@centos8 ~]# dnf -y install mailx      没发现bash须安装mailx

[root@centos8 ~]# mail -s test wei       发送邮件给普通用户
I am root
how are you
EOT
[root@centos8 ~]#

[wei@centos8 ~]$ pwd               查看所在目录
/home/wei

[wei@centos8 ~]$ mail              查看邮件
Heirloom Mail version 12.5 7/5/10. Type ? for help.
"/var/spool/mail/wei": 1 message 1 new
>N 1 root Sat May 23 09:29 19/571 "test"
& 1
Message 1:
From root@centos8.1.aris Sat May 23 09:29:57 2020
Return-Path: <root@centos8.1.aris>
X-Original-To: wei
Delivered-To: wei@centos8.1.aris
Date: Sat, 23 May 2020 09:29:56 +0800
To: wei@centos8.1.aris
Subject: test
User-Agent: Heirloom mailx 12.5 7/5/10
Content-Type: text/plain; charset=us-ascii
From: root <root@centos8.1.aris>
Status: R

I am root
how are you

推荐阅读