postfix

1.配置好两台主机的DNS    nm-connecction-editor

2.基本配置

postfix是通过SMTP简单邮件传输协议接收和转发邮件的软件

端口  25

服务日志文件  /var/log/maillog


3.修改配置   vim  /etc/postfix/main.cf(76 myhostname  =  www.mail.westos.com   设置主机名

                                                                  83  mydomain  =westos.com   设置域名

                                                                  99  myorigin  =  westos.com   设置发信源主机名

                                                                  116 inet_interfaces = all   25端口开启对外接口,默认只在127.0.0.1上开启

                                                                  164  mydestination = $myhostname,$mydomain,localhost    接收邮件结尾字符的指定)   

另一台主机也做相同修改,将westos换位qq即可




测试

westos主机向qq主机发送邮件    mail  root@qq.com

(mail  查看邮件来源

 mailq查看邮件队列

 postqueue  -f 重新处理邮件队列)



qq主机向westos主机发送邮件   mail  root@wwestos.com

(发送内容以.结尾

  mail 在本机查看是按q退出)



4.邮件别名和群发

(1)

修改配置文件     vim  /etc/aliases  (admin:             root   别名:真名

                                                              moreuser:    :include:/etc/postfix/moreuser   别名:记录群发到的用户文件)                  

                             vim  /etc/postfix/moreuser(root

                                                                             student)

创建文件        postalias   /etc/aliases

重启服务         systemctl  restart  postfix


结果:给amin用户发邮件,root用户收到

(2)群发   mail   moreuser@westos.com

(3)指定用户   mail  -u  student

结果:root用户和student用户都收到邮件



5.限制客户端发送    postconf   -e   "smtpd_client_restrictions = check_client_access hash:/etc/postfix/access"

打开主配置文件     vim  /etc/pstfix/main.cn



添加配置文件   vim  /etc/postfix/access(172.25.254.97    REJECT   客户端IP   拒绝访问)

文件加密   postmap   /etc/postfix/access

重启服务    systemctl    restart  postfix




6.限制用户发送     postconf   -e   "smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/sender"

打开主配置文件     vim  /etc/pstfix/main.cn




添加配置文件    vim   /etc/postfix/sender(student@wewstos.com   REJECT  用户邮箱   拒绝)

文件加密   postmap   /etc/postfix/sender

重启服务    systemctl    restart    postfix



7.限制用户接受     postconf   -e   "smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/recip

打开主配置文件   vim  /etc/postfix/main.cn




添加配置文件   vim  /etc/postfix/recip(westos@wesos.com   REJECT  用户邮箱  拒绝)

文件加密   postmap  /etc/postfix/recip

重启服务   systemctl   restart   postfix



8.出站地址伪装    

postconf   -e   "smtpd_generic_maps =  hash:/etc/postfix/generic"

打开主配置文件   vim  /etc/postfix/main.cn


修改配置文件   vim  /etc/postfix/generic(westos@westos.com   hello@haha.com  真实名字   虚拟名字)

文件加密   postmap  /etc/postfix/generic

重启服务   systemctl   restart   postfix



结果:westos@westos.com发出的邮件,root@qq.com显示为时hello@haha.com发出的


9.入站地址转换    

配置DNS   dig  -t  mx  haha.com



postconf   -e   "virtual_alias_maps = hash:/etc/postfix/virtual"

vim  /etc/postfix/virtual(hello@hah.com  westos@westos.com   虚拟名字   真实名字)



结果:发送给hello@haha.com的邮件,westos@westos.com收到


10.dovecot

(1)基本知识:dovecot是接受邮件服务器

支持协议    协议端口

pop3            110

pop3s          995

imap            143

imaps          993


配置好yum并安装服务    yum  install  dovecot  -y



修改配置文件   vim  /etc/dovecot/dovecot.conf(24  protocols = imap  pop3 lmtp  加密协议是imap、pop3、lmtp

                                                                                  48  login_trusted_networks = 0.0.0.0/0  允许任何IP连接

                                                                                  49   disable_plaintext_auth = no   允许明文登录)



修改配置文件   vim  /etc/dovecot/conf.d/10-mail.conf( 30 mail_location = mbox:~/mail:INBOX=/var/mail/%u   指定查看的用户文件)

重启服务   systemctl  restart  dovecot



测试步骤:在westos用户下  建立邮件目录    mkdir  mail/.imap  -p

                                                   建立查看的邮件文件位置   touch   mail/.imap/INBOX

                     在root用户下    自动建立邮件目录   mkdir   /etc/skel/mail/.imap  -p

                                                自动建立查看的邮件文件位置   touch  /etc/skel/mail/.imap/INBOX


mutt   -f  pop://westos@172.25.254.143    


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值