RHCE(postfix——单发)

25 篇文章 0 订阅

一、Linux本地邮件收发

1、安装相关软件

[root@kittod ~]#dnf install postfix mailx -y

2、新建用户lll

[root@kittod ~]#useradd lll

3、启动服务

[root@kittod ~]# systemctl restart postfix

4、用root用户给lll发邮件

[root@B lll]# mail to lll
Subject: asd
asd
EOT
[root@B lll]# send-mail: warning: /etc/postfix/main.cf, line 135: overriding earlier entry: inet_interfaces=all
postdrop: warning: /etc/postfix/main.cf, line 135: overriding earlier entry: inet_interfaces=all

注意:进入邮件服务后,要按**“ctrl+D”**才能退出

5、进入lala用户,查看邮件

[root@B lll]# su - lll
Last login: Mon Nov 29 14:20:16 CST 2021 on pts/0
[lll@B ~]$ mail
Heirloom Mail version 12.5 7/5/10.  Type ? for help.
"/var/spool/mail/lll": 2 messages 2 new
>N  1 root                  Mon Nov 29 14:20  18/530   "asd"
 N  2 root                  Mon Nov 29 14:21  18/530   "asd"
& 1
Message  1:
From root@text.com  Mon Nov 29 14:20:55 2021
Return-Path: <root@text.com>
X-Original-To: lll
Delivered-To: lll@text.com
Date: Mon, 29 Nov 2021 14:20:12 +0800
To: lll@text.com, to@text.com
Subject: asd
User-Agent: Heirloom mailx 12.5 7/5/10
Content-Type: text/plain; charset=us-ascii
From: root <root@text.com>
Status: R

asd

& Held 2 messages in /var/spool/mail/lll

二、启用域名邮件收发

1、编辑postfix服务的主配置文件

[root@kittod ~]# vim /etc/postfix/main.cf

1、
 91 # from gethostname(). $myhostname is used as a default value for many
 92 # other configuration parameters.
 93 #
 94 myhostname = mail.text.com
 95 #myhostname = virtual.domain.tld
 96 
 97 # The mydomain parameter specifies the local internet domain name.

2、
 99 # $mydomain is used as a default value for many other configuration
100 # parameters.
101 #
102 mydomain = text.com
103 
104 # SENDING MAIL

3、
115 # to recipient addresses that have no @domain part.
116 #
117 #myorigin = $myhostname
118 myorigin = $mydomain
119 
120 # RECEIVING MAIL
121 
122 # The inet_interfaces parameter specifies the network interface

4、
130 # Note: you need to stop/start Postfix when this parameter changes.
131 #
132 inet_interfaces = all
133 #inet_interfaces = $myhostname
134 #inet_interfaces = $myhostname, localhost

5、
181 # See also below, section "REJECTING MAIL FOR UNKNOWN LOCAL USERS".
182 #
183 mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
184 #mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

6、
281 # (the value on the table right-hand side is not used).
282 #
283 mynetworks = 192.168.254.0/24, 127.0.0.0/8
284 #mynetworks = $config_directory/mynetworks

7、313 # permit_mx_backup restriction description in postconf(5).
314 #
315 relay_domains = $mydestination
316 
317 # INTERNET OR INTRANET

2、 重新启动服务

[root@kittod ~]# systemctl restart postfix 

3、通过root用户发邮件给lll用户

[root@kittod lll]# mail lll@text.com
Subject: qweqwe
qweqwe
EOT
[root@kittod lll]# send-mail: warning: /etc/postfix/main.cf, line 135: overriding earlier entry: inet_interfaces=all
postdrop: warning: /etc/postfix/main.cf, line 135: overriding earlier entry: inet_interfaces=all

4、进入lll用户,查看邮件

[root@kittod lll]# su lll
[lll@kittod ~]$ mail
Heirloom Mail version 12.5 7/5/10.  Type ? for help.
"/var/spool/mail/lll": 4 messages 2 new 3 unread
    1 root                  Mon Nov 29 14:20  19/541   "asd"
 U  2 root                  Mon Nov 29 14:21  19/540   "asd"
>N  3 root                  Mon Nov 29 14:37  17/523   
 N  4 root                  Mon Nov 29 14:37  18/532   "qweqwe"
& 4
Message  4:
From root@text.com  Mon Nov 29 14:37:07 2021
Return-Path: <root@text.com>
X-Original-To: lll@text.com
Delivered-To: lll@text.com
Date: Mon, 29 Nov 2021 14:37:07 +0800
To: lll@text.com
Subject: qweqwe
User-Agent: Heirloom mailx 12.5 7/5/10
Content-Type: text/plain; charset=us-ascii
From: root <root@text.com>
Status: qweqwe

qweqwe

& Held 4 messages in /var/spool/mail/lll
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值