email

本文涉及的产品
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,高可用系列 2核4GB
简介:

################email#######
基本电子邮件发送

电子邮件发送
1 .服务器使用SMTP协议将电子邮件提交至TCP端口25,或由本地客户端通过/usr/bin/sendmail程序进行提交。如果该MTA是最终目标位置,邮件将传递至MDA。否则,将使用MX记录在DNS中查找下一个MTA,并使用SMTP进行转发。
2 .MDA:“邮件发送代理”。MDA将邮件发送至收件人的本地邮件存储位置(默认情况下是/var/spool/mail/user)。Postfix提供自己的MDA,以发送至基于文件的本地默认邮件存储位置/usr/libexec/postfix/local.
3 .转发:电子邮件服务器(MTA)将提交的邮件转发至另一个服务器,以进行发送
4 .排队:失败的发送或转发尝试排队等待,并由MTA定义重试。(默认情况下,Postfix每小时执行此操作一次)
5 .拒绝:在首次提交期间,电子邮件被电子邮件服务器拒绝
6 .退回:远程服务器接受电子邮件以进行发送以后,又将该电子邮件退回给始发电子邮件服务器和/或用户
7 .电子邮件以进行发送以后,又将该电子邮件退回给始发电子邮件服务器和/或用户准备:

########################准备:#####
一: desktop虚拟机(westos-mail.westos.com)

#######配置网络。yum源。修改主机名称

   88  cd /etc/sysconfig/network-scripts/
   89 ls
   90 vim ifcfg-eth0 
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
IPADDR=172.25.254.144
NETMASK=255.255.255.0
  104  hostnamectl set-hostnamewestos-mail.westos.com
  105 logout
  107 vim /etc/yum.repos.d/rhel_dvd.repo 
  108 yum clean all

wKiom1kkQ7Pz9ZUVAADOblmWp4E678.png-wh_50

#####配置DNS
  109 yum install bind -y
  111 systemctl start named
  114 vim /etc/named.conf 

wKiom1kkQ66jswUaAAB-GujP9is414.png-wh_50

wKioL1kkQ6_jP-cQAABt7POQpeg549.png-wh_50

  115 vim /etc/named.rfc1912.zones 

wKiom1kkQ7DAhKHbAACY6wlRyq0003.png-wh_50

  116 cd /var/named
  117 ls
  118 cp -p  named.localhostwestos.com.zone
  119 vim westos.com.zone

wKioL1kkQ7DDj_0XAABIUOFTIl0321.png-wh_50

  120 cp -p  westos.com.zoneqq.com.zone
  121 vim qq.com.zone

wKiom1kkQ7CQ9CNSAABNIQkdaT0111.png-wh_50

  122 systemctl restart named
  131 systemctl stop firewalld
####测试:
  123 vim /etc/resolv.conf 

wKioL1kkQ7GS8QCBAABqSQ79LOw854.png-wh_50

  124 cd 
  126 dig dns.westos.com
  136 dig  -t mx westos.com

wKioL1kkQ7KwQ__XAAEAH0NXyBk878.png-wh_50

wKiom1kkQ7LRV63sAADGux4TD6U330.png-wh_50

二:server虚拟机(qq-mail.qq.com)
######配置网络。yum源。修改主机名称

     1 cd/etc/sysconfig/network-scripts/
     2 ls
     3 vim ifcfg-eth0 
     4 vim /etc/yum.repos.d/rhel_dvd.repo 
     5  yumclean all
     6 hostnamectl set-hostname qq-mail.qq.com
     7 logout
#######测试:
   20 vim /etc/resolv.conf 
   21 dig dns.qq.com
   22 dig -t mx qq.com

wKioL1kkRLaSessoAACiZd8UTnA288.png-wh_50

wKiom1kkRLax-N8WAACf126WeZI005.png-wh_50


#######################
#### postfix ##########
1.

postfix提供smtp协议用来投递邮件
默认端口25
/var/log/maillog    ##服务日志
mail root@westos.com
Subject: hello
hello world 
.       #用"."来结束录入内容并发送
mailq       ##查看邮件队列
postqueue -f    ##重新处理邮件队列

默认情况下邮件端口只在127.0.0.1上开启

2.配置 两个虚拟机都配置
可以在/etc/postfix/main.cf文件中找到以下所有指令。
(1)myorigin
重写本地发布的电子邮件,使其显示为来自该域。这样有助于确保响应返回入站邮件服务器默认:myorigin = $myhostname
(2)inet_interfaces
控制Postfix侦听传入电子邮件的网络接口。如果设置为loopback-only,仅侦听127.0.0.1和::1,
如果设置为all,则侦听所有网络接口。还可以指定特定地址。
默认:inet_interfaces = localhost
(3)mydestination
收到地址为这些域的电子邮件将传递至MDA,以进行本地发送。
默认:mydestination = $myhostname, localhost.$mydomain,localhost
(4)mynetworks
IP地址和网络的逗号分隔列表(采用CIDR表示法)。这些地址和网络可以通过此MTA转发至
任何位置,无需进一步身份验证。
默认:mynetworks = 127.0.0.0/8
(5)relayhost
relayhost转发所有通过的出站邮件。通常用方括号指定,以阻止MX记录查找。
默认:relayhost =local_transport
收件地址为$mydestination的邮件的发送方式。默认情况下,设置为local:$myhostname(使用Local MDA将传入电子邮件发送到/var/spool/mail中的本地邮件存储位置)
默认:local_transport = local:$myhostname
(6)postconf -d 显示默认值。
(7)postconf -n显示不同于默认值的更改。

####westos.com:

vim /etc/postfix/main.cf
116 inet_interfaces = all       ##25端口开启的网络接口 
76 myhostname = westos-mail.westos.com  ##指定mta主机名称
83 mydomain = westos.com        ##指定mta的域名
99 myorigin = westos.com/$mydomain  ##指定邮件来源结尾(@后面的字符内容)
164 mydestination = $myhostname, $mydomain, localhost   ##接收邮件结尾字符的指定

systemctl restart postfix.service
systemctl stop firewalld 

   28 vim /etc/postfix/main.cf

wKioL1kkRSrhmk60AAB_azdSsIw785.png-wh_50

wKioL1kkRSvjvK3HAADBHQNmZ8k010.png-wh_50

wKiom1kkRSrTiYzaAACN4dag6JA416.png-wh_50

   29 systemctl restart postfix.service
   30 systemctl stop firewalld 

####qq.com:

vim /etc/postfix/main.cf
116 inet_interfaces = all       ##25端口开启的网络接口 
76 myhostname = qq-mail.qq.com  ##指定mta主机名称
83 mydomain = qq.com        ##指定mta的域名
99 myorigin = qq.com/$mydomain  ##指定邮件来源结尾(@后面的字符内容)
164 mydestination = $myhostname, $mydomain, localhost   ##接收邮件结尾字符的指

systemctl restart postfix.service
systemctl stop firewalld 


   8 vim /etc/postfix/main.cf 

wKiom1kkRSvS-T5oAACIf8mxIY8571.png-wh_50

wKiom1kkRSyz57YVAADJqf-YScg368.png-wh_50

wKioL1kkRSzgLJKUAACLsD9FoJ4516.png-wh_50

   9   systemctl restartpostfix.service 
   10 systemctl stop firewalld

测试: 可以互相发邮件

        31 mail root@qq.com
        32 mailq
        33 mail

wKiom1kkRS2i8enRAACo94aDDls091.png-wh_50


   11 mail
   12 mail root@westos.com
   13 mailq

wKioL1kkRS3zaA3oAACU_WOd16I558.png-wh_50


3.邮件别名
[root@qq-mail ~]# vim /etc/aliases
别名:  真名            ##邮件别名
别名:  :include:filename   ##邮件群发
vim filename
user1
user2
postalias /etc/aliases
mail 别名

   39  vim /etc/aliases   ####配置文件

wKioL1kkR2SAn-eFAAA4lPLMzK8672.png-wh_50

   40 vim /etc/postfix/qun

wKioL1kkR2TCz0C5AAAcmJ53fUA636.png-wh_50

   41 postalias /etc/aliases   ###加密
   42 systemctl restart postfix.service
   43  mail qun@westos.com   #####邮件群发
   44 mailq
   45 mail                
   46 mail -u student
   47  mail admin@westos.com  #####root别名admin
   48 mailq
   49 mail
   50  mail admiin@westos.com  ####student别名admiin
   51 mailq
   52 mail -u student

wKiom1kkR2WyuvFdAADXpdDOf_k199.png-wh_50

wKiom1kkR2XzjLPWAADpBnxjm1o896.png-wh_50

wKioL1kkR2aQ4P0rAACQ0bFjqyc204.png-wh_50



4.通过远程主机测试邮件服务
真机:

[root@foundation44 ~]# yum install telnet.x86_64 -y
[root@foundation44 ~]# telnet 172.25.254.144 25
Trying 172.25.254.144...
Connected to 172.25.254.144.
Escape character is '^]'.
220 westos-mail.westos.com ESMTP Postfix
ehlo hello ####确定软件是否装好
250-westos-mail.westos.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from:root@westos.com  #####发送方
250 2.1.0 Ok
rcpt to:root@qq.com  #####接收方
250 2.1.5 Ok
data                     ####编辑邮件内容
354 End data with <CR><LF>.<CR><LF>
fhylkhhiplu.kj
.

250 2.0.0 Ok: queued as 4CF3617E86E
quit                     #####退出
221 2.0.0 Bye
Connection closed by foreign host.
[root@foundation44 yum.repos.d]# 
检测:
(1)westos.com  发送方

[root@westos-mail ~]# mailq
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
52431246202      194 Tue May 2301:48:23  root@westos.com
              (connect to172.25.254.244[172.25.254.244]:25: No route to host)
                                        root@qq.com

-- 0 Kbytes in 1 Request.
[root@westos-mail ~]# postqueue -f    ##重新处理邮件队列
[root@westos-mail ~]# mailq
Mail queue is empty
[root@westos-mail ~]# 

(2)qq.com 接收方

[root@qq-mail ~]# mail
Heirloom Mail version 12.5 7/5/10.  Type? for help.
"/var/spool/mail/root": 3 messages 2 new 3 unread
 U 1 root                  Tue May 2300:05  22/734   "qqqq"
>N  2 root@westos.com       Tue May 23 01:52  14/494  
 N 3 root@westos.com       Tue May 2301:53  15/497   
& quit
Held 3 messages in /var/spool/mail/root
You have mail in /var/spool/mail/root
[root@qq-mail ~]# 


5.邮件客户端的访问控制


#########限制客户端

在westos.com:

postconf -e "smtpd_client_restrictions = check_client_accesshash:/etc/postfix/access" ###生成/etc/postfix/main.cf文件中的内容

vim /etc/postfix/main.cf
wKioL1kkSWzAnYvwAACDWNKMrAQ951.png-wh_50

vim /etc/postfix/access
172.25.254.44   REJECT
wKiom1kkSWzCzozJAABwKl0oQz4884.png-wh_50

postmap /etc/postfix/access  ####加密/etc/postfix/access

systemctl restart postfix     ####重启postfix 

测试:真机
[root@foundation44 ~]# telnet 172.25.254.144 25
Trying 172.25.254.144...
Connected to 172.25.254.144.
Escape character is '^]'.
220 westos-mail.westos.com ESMTP Postfix
mail from:root@westos.com   #####发送方
250 2.1.0 Ok
rcpt to:root@qq.com    ####接受方
554 5.7.1 <unknown[172.25.254.44]>: Client host rejected: Accessdenied


#####限制用户发送

[root@westos-mail ~]#  postconf -e"smtpd_sender_restrictions = check_sender_accesshash:/etc/postfix/sender"
[root@westos-mail ~]# vim /etc/postfix/main.cf

wKiom1kkSWyxYB1OAABb1tViXnI990.png-wh_50

[root@westos-mail ~]# vim /etc/postfix/sender
  student@westos.com   REJECT
wKiom1kkSW2xmPqZAAAwVrmt7P8259.png-wh_50

[root@westos-mail ~]# cd /etc/postfix
[root@westos-mail postfix]# ls
access     canonical  header_checks master.cf  relocated  sender.db virtual
access.db  generic    main.cf        qun        sender     transport
[root@westos-mail postfix]# systemctl start named
[root@westos-mail postfix]# systemctl restart postfix

测试:
[root@foundation44 ~]# telnet 172.25.254.144 25
Trying 172.25.254.144...
Connected to 172.25.254.144.
Escape character is '^]'.
220 westos-mail.westos.com ESMTP Postfix
mail from:student@westos.com
250 2.1.0 Ok
rcpt to:root@qq.com
554 5.7.1 <student@westos.com>: Sender address rejected: Accessdenied
wKioL1kkSW2TARfTAABfli-WTl8576.png-wh_50


############限制用户接收


[root@westos-mail ~]# postconf -e "smtpd_recipient_restrictions =check_sender_access hash:/etc/postfix/recip"
[root@westos-mail ~]# vim /etc/postfix/main.cf

wKiom1kkSvKRZDqXAABlHwwDAYo289.png-wh_50

[root@westos-mail ~]# vim /etc/postfix/recip
   westos@westos.com   REJECT

wKiom1kkSvKiBmKFAAAxCyTzZkk501.png-wh_50

[root@westos-mail ~]# postmap /etc/postfix/recip
[root@westos-mail ~]# systemctl restart postfix
[root@westos-mail ~]# useradd westos
[root@westos-mail ~]# 


wKioL1kkSvOAm0r4AAB9lIffSls056.png-wh_50
测试:
[root@foundation44 ~]# telnet 172.25.254.144 25
Trying 172.25.254.144...
Connected to 172.25.254.144.
Escape character is '^]'.
220 westos-mail.westos.com ESMTP Postfix
mail from:westos@westos.com
250 2.1.0 Ok
rcpt to:westos@westos.com      
554 5.7.1 <westos@westos.com>: Sender address rejected: Accessdenied
quit
221 2.0.0 Bye
Connection closed by foreign host.




wKioL1kkSvOhe2wgAACjulIe0Bw712.png-wh_50


#########企业邮箱
####出栈地址转换

    1 postconf -d | grep generic
    2 postconf -e "smtp_generic_maps = hash:/etc/postfix/generic"
    3 vim  /etc/postfix/main.cf

wKiom1kkSvTQR9sxAABnEpl8iE4471.png-wh_50

    4 vim /etc/postfix/generic
westos@westos.com   hello@sb.com
真域名                   假域名


    5 postmap /etc/postfix/generic
    6 systemctl restart postfix
    7 su - westos

wKioL1kkTCXDM652AAD77wr45No630.png-wh_50


测试:[westos@westos-mail ~]$ history
     1 mail root@qq.com
     2 mailq
[root@qq-mail ~]# mail
wKioL1kkTCayXRbSAAD6G9E-7O4260.png-wh_50



##入战地址转换
1. dns mx 记录解析先做好

   17 vim /etc/named.rfc1912.zones

wKiom1kkTCaCPQmCAAAwhnZBPxk630.png-wh_50

   18  cp-p qq.com.zone sb.com.zone
   19 vim sb.com.zone

wKiom1kkTZizNVLWAABPFhszIlI246.png-wh_50

   20 systemctl restart named
   21 dig -t mx sb.com
wKiom1kkTCfTHxg_AADbp0DnoW8566.png-wh_50

2

   26  postconf -e"virtual_alias_maps = hash:/etc/postfix/virtual"
   27 vim /etc/postfix/main.cf 

wKioL1kkTZmCrxyJAACZSr8F0Pg672.png-wh_50

   28  vim /etc/postfix/virtual
虚拟名字        真实用户
hello@sb.com        westos@westos.com

wKioL1kkTxmQWhzqAAB9DCB7X2w406.png-wh_50

   29 postmap /etc/postfix/virtual
   30 systemctl restart postfix
   31 su - westos
测试:
[root@qq-mail ~]# mail hello@sb.com

wKiom1kkTxqzu5f-AAA38ZHhIzo772.png-wh_50

[westos@westos-mail ~]$ mail
wKiom1kkTZnDfKX_AAC0MqQKRBU172.png-wh_50




##########################

####### dovecot ##########
##########################

1.
dovecot 用来提供收件协议
pop3        110
imap        143
imaps       993
pop3s       995

给定用户名称,用户密码,dovecot程序代我们去看这个用户的邮件文件

###############收邮件######
2.
yum install dovecot -y
systemctl start dovecot
netstat -antlpe | grep dovecot
wKioL1kkUkCj8AcSAACpJ0IVrp4632.png-wh_50

3.
vim /etc/dovecot/dovecot.conf
24 protocols = imap pop3 lmtp
48 login_trusted_networks = 0.0.0.0/0
49 disable_plaintext_auth = no
wKiom1kkUkCB-Ud3AABmdNAIzvM908.png-wh_50

 wKioL1kkUkDgnFJgAAB2G229Y3U334.png-wh_50

vim /etc/dovecot/conf.d/10-mail.conf

30 mail_location = mbox:~/mail:INBOX=/var/mail/%u ##防止别人收到你的邮件
passwd westos   ####

wKiom1kkUkGCdbvbAABXJObnY9o689.png-wh_50

mail westos

wKioL1kkU-_xYC1FAAC9wD674rY679.png-wh_50

4.

 [root@westos-mail ~]# su - westos
[westos@westos-mail ~]$ mkdir mail/.imap/ -p
[westos@westos-mail ~]$ touch mail/.imap/INBOX
[westos@westos-mail ~]$ logout
wKiom1kkU--z0xp-AABGwxJ_zZE344.png-wh_50

5.自动撰写 mail/.imap
mkdir /etc/skel/mail/.imap/ -p
touch /etc/skel/mail/.imap/INBOX
/etc/skel  #####骨架目录

   14  mkdir /etc/skel/mail/.imap/ -p
   15 touch /etc/skel/mail/.imap/INBOX
   16 useradd lee
   17 cd /home/lee
   18 ll
   19 ls mail/ -a
   20 ls mail/.imap/INBOX
   21 passwd lee
   22  mail lee

wKiom1kkVNrBS1z9AACJQ5naqvU367.png-wh_50

wKiom1kkVNuimpIOAAB7s639SWg896.png-wh_50
测试

真机:
[root@foundation44 ~]# yum install mutt -y
[root@foundation44 ~]#  mutt -fpop://westos@172.25.254.144
2 kept, 0 deleted.

[root@foundation44 ~]#  mutt -fpop://lee@172.25.254.144
1 kept, 0 deleted.

wKioL1kkU_CSECWsAADA0Vhbc_Q967.png-wh_50wKiom1kkUkKhAj3lAAD_IJF5pFg768.png-wh_50

选择O

wKioL1kkVNuiK08DAADSG_4IhSI697.png-wh_50

输入密码

wKiom1kkU-7CQqzPAABalZnjr_Y098.png-wh_50

按Enter

wKiom1kkU--QiZxpAABqQv5ooGM239.png-wh_50wKioL1kkVNvB7UWQAABRPYXn1-Y078.png-wh_50





######雷鸟######
1 下载 thunderbird-31.2.0-1.el7.x86_64.rpm
2 安装
yum install /home/kiosk/Desktop/thunderbird-31.2.0-1.el7.x86_64.rpm -y
3 (1)打开雷鸟

wKiom1kkVeaD5TSWAAPK6oEL8Ao856.png-wh_50

wKioL1kkVefD-cpjAAPLMrXJenw641.png-wh_50

(2)

wKioL1kkVefSq4ofAAB7VYWSB98810.png-wh_50

wKiom1kkVejS-Hd7AAC8yBybNNA595.png-wh_50

wKioL1kkVeiyllYxAACpaGsjHLE032.png-wh_50

wKioL1kkVemgCVZxAAET75LWjd8784.png-wh_50

wKiom1kkVeniT9j6AAEf5TMnr8I458.png-wh_50


4验证:
[root@qq-mail ~]# mail

wKioL1kkVerAbS14AAEl55uC_ms392.png-wh_50



##########mariadb;dovecot;postfix########

准备工作:
(1)#####postfix###

westos.com:
  201 mv  /etc/postfix/main.cf  /mnt/
  202 yum reinstall postfix -y

wKioL1kkVxmD3j4bAACFFbn3T5w122.png-wh_50

  203 vim /etc/postfix/main.cf
116 inet_interfaces = all       ##25端口开启的网络接口 
76 myhostname = qq-mail.qq.com  ##指定mta主机名称
83 mydomain = qq.com        ##指定mta的域名
99 myorigin = qq.com/$mydomain  ##指定邮件来源结尾(@后面的字符内容)
164 mydestination = $myhostname, $mydomain, localhost   ##接收邮件结尾字符的指定
  204 systemctl restart postfix

wKiom1kkV_ejA5LSAAC18Eo7BaI844.png-wh_50


(2)######mariadb####
  205 yum install http php php-mysql mariadb-server -y
  206 systemctl start mariadb
  208 vim /etc/my.cnf          ###mysqul的配置文件
         14  skip-networking=1

wKioL1kkVxniXUFtAABYWGblOOY748.png-wh_50


  209 systemctl restart mariadb  ###重启mariadb服务

  210 mysql_secure_installation  ###mysql安全内容配置
       所有都按Enter键

wKioL1kkV_fDtR-uAADXSuJL-Jk907.png-wh_50


下载 
  215 scproot@172.25.254.44:/home/kiosk/Desktop/phpMyAdmin-3.4.0-all-languages.tar.bz2  /var/www/html
   ###########下载 压缩包
  216 cd /var/www/html
  217 ls
  218 tar jxf phpMyAdmin-3.4.0-all-languages.tar.bz2
  ####解压压缩包到/var/www/html
  219 ls
  220 rm -fr *.bz2
  221 ls

wKiom1kkWQ_Bk55dAAEdVvutqd4175.png-wh_50

  222 mv phpMyAdmin-3.4.0-all-languages/ mysqladmain #### 将安装包下的所有文件移动到 mysqladmin
  223 cd mysqladmain/
  224 ls

wKioL1kkWQ7wfUr7AACUY2qi_mI599.png-wh_50

  225 cp config.sample.inc.php config.inc.php  ###复制配置文件
  226 vim config.inc.php   ###写配置文件
$cfg['blowfish_secret'] = 'mysql'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH!*/
wKioL1kkV_igrJf8AABE6b6LGO0504.png-wh_50

  227 systemctl restart httpd


wKiom1kkV_jAkYefAACUBptn6Uc847.png-wh_50


真机:
打开浏览器访问:http://172.25.254.144/myadmin/

wKioL1kkWRCiiwvlAAB1B59msWk713.png-wh_50

wKiom1kkWRDQC0DqAAEzl_iku20486.png-wh_50

wKioL1kkWRDC9-BDAACEKX4ASh4100.png-wh_50

westos.com:

  228 mysql -uroot -pqwer
    MariaDB [(none)]> create userpostuser@localhost identified by 'postuser';  ####建立postuser用户 ,本地登陆
    MariaDB [(none)]> grantselect,update,insert on email.* to postuser@localhost; ####### 本机登陆postuser,授权
    MariaDB [(none)]> select * fromemail.emailuser;###查询email.emailuser表中的所有内容
    MariaDB [(none)]> quit
wKiom1kkWsnA73aeAAEi5bDJKPA317.png-wh_50
测试:
    32 cd /etc/postfix
    34 vim mailuser.cf  ####用户名称查询
hosts = localhost  #####数据库所在的主机
user = postuser    #####登陆数据库的用户
password = postuser #####登陆数据库的密码
dbname = email    #####postfix要查询的名字
table = emailuser ######postfix要查询的表的名字
select_field = username  #####postfix要查询的字段
where_field = username  ####用户给定postfix的查询条件

   35 postmap -q "lee@lee.com" mysql:/etc/postfix/mailuser.cf
   36 cp mailuser.cf maildomain.cf
   37 vim maildomain.cf  #### 用户域名查询
hosts = localhost
user = postuser
password = postuser
dbname = email
table = emailuser
select_field = domain
where_field = domain

   38 postmap -q "lee.com" mysql:/etc/postfix/maildomain.cf
   39 cp mailuser.cf mailbox.cf
   40 vim mailbox.cf  ####用户邮箱位置查询
hosts = localhost
user = postuser
password = postuser
dbname = email
table = emailuser
select_field = maildir
where_field = username
   41 postmap -q "lee@lee.com" mysql:/etc/postfix/mailbox.cf

   42 ls

wKiom1kkWRHzu03fAAEKQmYT9nA998.png-wh_50

   43 cat mailuser.cf
   44 cat maildomain.cf
   45 cat mailbox.cf
   46 history

wKioL1kkWRGgzuh4AACwCo185bA126.png-wh_50

二##配置postfix

[root@westos-mail ~]# groupadd -g 666 vmail 
[root@westos-mail ~]# useradd -s /sbin/nologin -u 666 vmail -g 666
[root@westos-mail ~]# id vmail
uid=666(vmail) gid=666(vmail) groups=666(vmail)

[root@westos-mail ~]# postconf -e "virtual_mailbox_base =/home/vmail"
##设定虚拟用户的邮件目录
[root@westos-mail ~]#  postconf -e"virtual_uid_maps = static:666"
##虚拟用户建立文件的uid
[root@westos-mail ~]# postconf -e "virtual_gid_maps =static:666"
##虚拟用户建立文件的gid
[root@westos-mail ~]# postconf -e "virtual_alias_maps =mysql:/etc/postfix/mailuser.cf"
[root@westos-mail ~]# postconf -e "virtual_mailbox_domains =mysql:/etc/postfix/maildomain.cf"
[root@westos-mail ~]# postconf -e "virtual_mailbox_maps =mysql:/etc/postfix/mailbox.cf"
[root@westos-mail ~]#  vim/etc/postfix/main.cf

wKiom1kkWvTBjX_cAACXWpj_Y9I276.png-wh_50

[root@westos-mail ~]#  systemctl restartpostfix
[root@westos-mail ~]#  ll/etc/postfix/mailbox.cf
-rw-r--r--. 1 root root 134 May 23 09:05 /etc/postfix/mailbox.cf
[root@westos-mail ~]# ll /etc/postfix/mailuser.cf
-rw-r--r--. 1 root root 135 May 23 09:03 /etc/postfix/mailuser.cf
[root@westos-mail ~]# ll /etc/postfix/maildomain.cf
-rw-r--r--. 1 root root 131 May 23 09:04 /etc/postfix/maildomain.cf

修改邮箱位置

wKioL1kkWvOwuMcSAACRnq59K8w357.png-wh_50

测试:
[root@westos-mail ~]# cd /home/vmail
[root@westos-mail vmail]# ls
[root@westos-mail vmail]# mail lee@lee.com
Subject: abcd
abcd
.
EOT
[root@westos-mail vmail]# ls
lee.com
[root@westos-mail vmail]# cd lee.com
[root@westos-mail lee.com]# ls
lee
[root@westos-mail lee.com]# cd lee
[root@westos-mail lee]# ls
cur  new tmp
[root@westos-mail lee]# catnew/1495545556.Vfd01I1a9eecdM433309.westos-mail.westos.com 

wKioL1kkWvThauZ_AADKtbbBeb8931.png-wh_50

wKiom1kkWvXCzEwAAAB5730BwwM486.png-wh_50










本文转自 如何何如  51CTO博客,原文链接:http://blog.51cto.com/12778805/1928816,如需转载请自行联系原作者
目录
相关文章
邮件(email)
邮件–发送邮件 1.准备工作 1.1.生成查长度为4的验证码
135 0
|
C++ Python
LeetCode 929. Unique Email Addresses
LeetCode 929. Unique Email Addresses
113 0
|
Python
Python: email-validator验证Email地址
Python: email-validator验证Email地址
160 0
|
Java 开发者
email 验证|学习笔记
快速学习 email 验证
107 0
email 验证|学习笔记
谋杀 Email
作为新来者,凭着技术的进步、企业提升效率的需求、大厂们留下的中小客户市场切口,Zoom、Slack们高歌猛进,抢夺“Email们”的市场,在“WinTel大厂”们没能涉足的市场切下一块蛋糕。但在未来,当深入到大厂腹地,深入大型客户市场,新老企服软件公司的一战似乎不可避免。面对这些老玩家,他们能成功么
246 0
JavaUtil_09_email_使用 commons-email 发送邮件
  二、参考资料 1.【commons】邮件发送工具——commons-email
1062 0
|
存储 数据库