温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Linux中如何安装postfix

发布时间:2021-11-16 11:28:29 来源:亿速云 阅读:689 作者:小新 栏目:建站服务器

这篇文章主要介绍Linux中如何安装postfix,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

安装postfix

postfix是一个快速、易于管理、安全性高的邮件发送服务,可以配合dovecot实现一个完美的邮箱服务器

1、安装postfix 

[root@localhost ~]# rpm -qa | grep postfix

[root@localhost ]# yum install -y postfix

Loaded plugins: fastestmirror, refresh-packagekit, security                                                 

Complete!

[root@localhost]#

2、配置postfix,编辑配置文件“/etc/postfix/main.cf”

[root@localhost ~]# gedit /etc/postfix/main.cf

mydomain = david.cn      //dns中的域名

myhostname = mailsrv.david.cn  //dns中的域名

mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

inet_interfaces = all   //允许处理所有网路信息

inet_protocols = all    //允许ipv4ipv6

mynetworks = 192.168.0.0/24, 127.0.0.0/8     //允许接入的ip

3、设置防火墙,postfix使用25端口 

[root@localhost ~]# gedit /etc/sysconfig/iptables

-A INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT

 

[root@localhost ~]# service iptables restart

iptables:将链设置为政策 ACCEPTfilter nat                [确定]

iptables:清除防火墙规则:                                 [确定]

iptables:正在卸载模块:                                   [确定]

iptables:应用防火墙规则:                                 [确定]

iptables:载入额外模块:nf_conntrack_ftp                   [确定]

4、启动服务

[root@localhost ~]# service postfix start

启动postfix                                             [确定]

[root@localhost ~]#

5、连接测试

[root@localhost ~]# telnet 192.168.0.113 25    //ip是本机地址,25是端口号

Trying 192.168.0.113...

Connected to 192.168.0.113.

Escape character is '^]'.

220 mailsrv.david.cn ESMTP Postfix

6、发信

[root@localhost ~]# mail david     //david发信,确保此用户存在Linux系统中。发信人是当前登录的用户root

Subject: test04       //标题

hello david           //内容

.                       //结束

EOT

[root@localhost ~]# mail -u david      //查看用户david的信件

Heirloom Mail version 12.4 7/29/08.  Type ? for help.

"/var/mail/david": 5 messages 1 new

    1 root                  Thu Aug 16 17:07  21/692   "test"

    2 root                  Thu Aug 16 17:08  20/631   "test"

    3 root                  Thu Aug 16 17:10  20/602   "test"

    4 root                  Fri Aug 17 08:15  20/570   "test3"

>N  5 root                  Fri Aug 17 09:46  18/539   "test04"    //此信件是刚才收到的,由root用户发出

&

以上是“Linux中如何安装postfix”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注亿速云行业资讯频道!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI