邮件收发系统

配置两台虚拟机的邮件环境

虚拟机

nm-connection-editor

//配置虚拟机1.ip为146虚拟机2.ip为246

更改两台主机名分别为mailwestos.westos.com和maillinux.linux.com

配置yum源

[rhel_dvd]

gpgcheck = 0

enabled = 1

baseurl = http://172.25.254.46/hzy

安装dns服务

yum install bind -y

systemctl start named

vim /etc/named.conf

-----------------------

10 options {

11 #       listen-on port 53 { 127.0.0.1; }

12 #       listen-on-v6 port 53 { ::1; };

13         directory       "/var/named";

14         dump-file       "/var/named/data

15         statistics-file "/var/named/data

16         memstatistics-file "/var/named/d

17 #       allow-query     { localhost; };

29         recursion yes;

30

31         dnssec-enable yes;

32         dnssec-validation no;

-------------------------

vim /etc/named.rfc1912.zones

-------------------------

25 zone "westos.com" IN {

26         type master;

27         file "westos.com.zone";

28         allow-update { none; };

29 };

30

31 zone "linux.com" IN {

32         type master;

33         file "linux.com.zone";

34         allow-update { none; };

35 };

---------------------------

cd /var/named

cp -p named.localhost  westos.com.zone

vim westos.com.zone

--------------------------------

$TTL 1D

@       IN SOA  dns.westos.com. root.westos.com. (

0       ; serial

1D      ; refresh

1H      ; retry

1W      ; expire

3H )    ; minimum

NS      dns.westos.com.

dns             A       172.25.254.146

westos.com.      MX 1    172.25.254.146.

-------------------------------------

cp -p westos.com.zone linux.com.zone

vim linux.com.zone

----------------------------------------

$TTL 1D

@       IN SOA  dns.linux.com. root.linux.com. (

0       ; serial

1D      ; refresh

1H      ; retry

1W      ; expire

3H )    ; minimum

NS      dns.linux.com.

dns             A       172.25.254.146

linux.com.       MX 1     172.25.254.246.

-------------------------------------------

systemctl restart named

---------------------------------------------------------------------

postfix

yum install postfix -y

mailwestos主机和maillinux主机配置如下:

vim /etc/postfix/main.cf

75 #myhostname = host.domain.tld

76 myhostname = mailwestos.westos.com

77

82 #

83 mydomain = westos.com

84

98 #myorigin = $myhostname

99 myorigin = $mydomain

113 inet_interfaces = all

114 #inet_interfaces = $myhostname

115 #inet_interfaces = $myhostname, localhost

116 #inet_interfaces = localhost

163 #

164 mydestination = $myhostname, $mydomain, localhost

systemctl restart postfix

在mailwestos.westos.com上设置

群发邮件

vim    /etc/postfix/users      //群发邮件的目标用户配置文件

student

root

vim /etc/aliases

95 # Person who should get root‘s mail

96 #root:          marc

97 admin:          root             //admin为root的别名

98 more:          :include:/etc/postfix/users   //群发用户的配置文件

postalias /etc/aliases    //更新设置

systemctl restart postfix.service

mail  [email protected]

在maiwestos.com查看邮件

mail -u student

mail -u root //查看root用户收到的邮件

postsuper -d       //删除未发送的邮件队列

空壳邮件客户端配置

(1)收件地址伪装

vim /etc/postfix/virtual

#        Yorktown Heights, NY 10598, USA

#

[email protected]      [email protected]

@qq.com           @westos.com             //将westos.com 伪装为qq.com

#VIRTUAL(5)

vim /etc/named.rfc1912.zones          //添加qq.com这个域

----------------------------------

zone "qq.com" IN {

32         type master;

33         file "qq.com.zone";

34         allow-update { none; };

35 };

-----------------------------------

vim /var/named/qq.com.zone

-----------------------------------

$TTL 1D

@       IN SOA  dns.qq.com. root.qq.com. (

0       ; serial

1D      ; refresh

1H      ; retry

1W      ; expire

3H )    ; minimum

NS      dns.qq.com.

dns             A       172.25.254.146

qq.com.       MX 1     172.25.254.246.

-------------------------------------

postmap /etc/postfix/virtual    //加密/virtual文件

postconf -e "virtual_alias_maps = hash:/etc/postfix/virtual" //使系统读取该加密文件,加密方式为hash加密

systemctl restart postfix.service

mail [email protected]

mailq

在 westos.com 上查看是否接受到邮件

mail

& 1     //查看详细信息

(2)邮件回送方伪装

vim /etc/postfix/generic

[email protected]    [email protected]        //将回送方伪装为qq.com

postmap /etc/postfix/generic          //加密generic文件

postconf -e "smtp_generic_maps = hash:/etc/postfix/generic" //使系统读取该加密文件,加密方式为hash加密

systemctl restart postfix.service  //重启

postfix服务

从westos主机向linux发送邮件

mail [email protected]

在linux上查看

mail

& 1 //查看那mail的详细信息

从linux回送邮件到westos

mail [email protected]

在westos上查看mail详细信息

telnet

yum install telnet -y

telnet 172.25.254.246 25

ehlo hello     //打招呼,查看是否连接成功

mail from:[email protected]

250 2.1.0 ok

rcpt to:[email protected]

250 2.1.5 ok

data

354 End data with <CR><LF>.<CR><LF>

hello

hello

.

250 2.0.0 ok:queque as 025E224630C

quit

221 2.0.0 Bye

在westos上查看mail详细信息

在数据库上创建postfix用户,并为postfix用户设置插入读取权限

create user [email protected] identified by ‘postfix‘;

grant insert,select on email.* to [email protected];

cd /etc/postfix

----------------------------

vim mysql-user.cf

hosts = localhost

user = postfix

password = postfix

dbname = email

table = hzy

select_field = username

where_field = username

-----------------------------

vim mysql-domain.cf

hosts = localhost

user = postfix

password = postfix

dbname = email

table = hzy

select_field = domain

where_field = domain

------------------------------

vim mysql-mailbox.cf

hosts = localhost

user = postfix

password = postfix

dbname = email

table = hzy

select_field = maildir

where_field = username

------------------------------

groupadd -g 888 vmail

useradd -u 888 -g 888 vmail

postconf -e "virtual_alias_maps = mysql:/etc/postfix/mysql-user.cf"

postconf -e "virtual_mailbox_domains = mysql:/etc/postfix/mysql-domain.cf"

postconf -e "virtual_mailbox_maps = mysql:/etc/postfix/mysql-mailbox.cf"

postconf -e "virtual_mailbox_base = /home/vmail"

postconf -e "virtual_minimum_uid = static:888"

postconf -e "virtual_minimum_gid = static:888"

************postfix的配置***********

vim /etc/postfix/main.cf

--------------------------------------

76 myhostname = mailwestos.westos.com    //发送邮件的主机名

83 mydomain = westos.com                 //本地发布的邮件域名

99 myorigin = $mydomain                   //显示邮件发送方的域

113 inet_interfaces = all                 //设定接收传入电子邮件的网络接口,这里设定为接收所有接口

164 mydestination = $myhostname, $mydomain, localhost   //设定邮件接收方的格式,

681 virtual_alias_maps = mysql:/etc/postfix/mysql-user.cf

682 virtual_mailbox_domains = mysql:/etc/postfix/mysql-domain.cf

683 virtual_mailbox_maps = mysql:/etc/postfix/mysql-mailbox.cf

684 virtual_mailbox_base = /home/vmail

685 virtual_minimum_uid = static:888

686 virtual_minimum_gid = static:888

-----------------------------------------

dovecot

yum install dovecot -y    //安装豆腐块

yum install dovecot-mysql -y //安装豆腐块与数据库联系的插件

mysql -uroot -pwestos         //登陆数据库

create user [email protected] identified by ‘postfix‘; //创建用户postfix,

grant insert,select on email.* to [email protected];   //给用户postfix赋予插入和读取权限

vim /etc/dovecot/dovecot.conf    //编辑豆腐块的配置文件

48 login_trusted_networks = 0.0.0.0/0     //允许登陆的网络ip

49 disable_plaintext_auth = no             //禁止明码登陆设定关闭

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

122 !include auth-system.conf.ext

123 !include auth-sql.conf.ext            //开启数据库的连接

cp /usr/share/doc/dovecot-2.2.10/example-config/dovecot-sql.conf.ext /etc/dovecot/dovecot-sql.conf.ext

vim /etc/dovecot/dovecot-sql.conf.ext

31 # Database driver: mysql, pgsql, sqlite

32 driver = mysql                       //添加数据库驱动

71 connect = host=localhost dbname=email user=postfix  password=postfix  //连接方式为:本地连接;数据库名:email;登陆用户名user为:postfix 登陆密码为:postfix

78 default_pass_scheme = PLAIN             //默认密码认证为明文

107 password_query = \

108   SELECT username, domain, password \

109   FROM hzy WHERE username = ‘%u‘ AND domain = ‘%d‘

125    user_query = SELECT maildir, 888 AS uid, 888 AS gid FROM hzy WHERE username = ‘%u‘           //hzy为表名,用户名格式为: %u (带域的完整用户名)  %d 为域

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

30 mail_location = maildir:/home/vmail/%d/%n      //接收到的邮件的存放目录

systemctl restart dovecot   //重启豆腐块服务

安装雷鸟

yum install thunderbird-31.2.0-1.el7.x86_64.rpm -y

测试:在172.25.254.146主机上发送邮件

mail [email protected]

在雷鸟上查看:read messages

时间: 2024-08-05 15:16:43

邮件收发系统的相关文章

centos7.2下搭建postfix++dovecot+courier-authlib+extmail邮件收发系统

专业的事由专业的人去做,现在DNS,mail邮箱系统基本都是专业的公司去做了,越来越少公司自己搭建DNS,mail等系统服务 这次由于服务器要迁移,公司的邮箱系统一直都是用开源的postfix的,只能自己折腾 在此记录一下,搭建全过程使用root账号,中间有一些错误调试的,都给忽略了,这里只给出最的配置 在文章最后面会有一些错误调试的记录 不管遇到什么错误,首先打印日志来看! 不管遇到什么错误,首先打印日志来看! 不管遇到什么错误,首先打印日志来看! 在网上大概了解了一下整个邮箱系统的组成: #

电子邮件收发协议总结

说明:本文仅供学习交流,转载请标明出处,欢迎转载!  电子邮件发送协议是一种基于"推"的协议,主要包括SMTP:邮件接收协议则是一种基于"拉"的协议,主要包括POP协议和IMAP协议,在正式介绍这些协议之前,我们先给出邮件收发的体系结构: 从上图可以看出邮件收发的整个过程大致如下: (1)发件人调用PC机中的用户代理编辑要发送的邮件. (2)发件人点击屏幕上的"发送邮件"按钮,把发送邮件的 工作全部交给用户代理来完成.用户代理通过SMTP协议将邮

什么是AOP?

AOP(Aspect-Oriented Programming,面向方面编程),可以说是OOP(Object-Oriented Programing,面向对象编程)的补充和完善.OOP引入封装.继承和多态性等概念来建立一种对象层次结构,用以模拟公共行为的一个集合.当我们需 要为分散的对象引入公共行为的时候,OOP则显得无能为力.也就是说,OOP允许你定义从上到下的关系,但并不适合定义从左到右的关系.例如日志功能.日 志代码往往水平地散布在所有对象层次中,而与它所散布到的对象的核心功能毫无关系.对

将应用程序中的商业逻辑同对其提供支持的通用服务进行分离(转)

AOP(Aspect-Oriented Programming,面向方面编程),可以说是OOP(Object-Oriented Programing,面向对象编程)的补充和完善.OOP引入封装.继承和多态性等概念来建立一种对象层次结构,用以模拟公共行为的一个集合.当我们需要为分散的对象引入公共行为的时候,OOP则显得无能为力.也就是说,OOP允许你定义从上到下的关系,但并不适合定义从左到右的关系.例如日志功能.日志代码往往水平地散布在所有对象层次中,而与它所散布到的对象的核心功能毫无关系.对于其

依赖注入(DI)有助于应用对象之间的解耦,而面向切面编程(AOP)有助于横切关注点与所影响的对象之间的解耦(转good)

依赖注入(DI)有助于应用对象之间的解耦,而面向切面编程(AOP)有助于横切关注点与所影响的对象之间的解耦.所谓横切关注点,即影响应用多处的功能,这些功能各个应用模块都需要,但又不是其主要关注点,常见的横切关注点有日志.事务和安全等. 将横切关注点抽离形成独立的类,即形成了切面.切面主要由切点和通知构成,通知定义了切面是什么,以及何时执行何种操作:切点定义了在何处执行通知定义的操作. http://ju.outofmemory.cn/entry/216839 引子: AOP(面向方面编程:Asp

毕业设计课题大全

标题: 交换机端口数据流量信息采集方法评述(1人) 目的: 本题目意在通过检索"截获交换机封包"的相关资料,研究对交换机端口流量进行实时监测的手段和方法及实现的原理. 内容:论文要求分析交换机内部封包的交换和计数原理,进而探查如何通过局域网络监测交换机端口的实时流量信息. 参考资料:思科CCNA和CCNP认证教材,及相关参考资料 计算机专业毕业设计题目大全 http://blog.renren.com/share/250527820/12343150865 重点考虑: 5.电子邮件服务

GitLab 之 Linux十分钟快装(转)

先把 Shell 命令贴出来,楼主以 CentOS release 6.5 (Final) 64位 为例: //配置系统防火墙,把HTTP和SSH端口开放. sudo yum install curl openssh-server postfix cronie sudo service postfix start sudo chkconfig postfix on sudo lokkit -s http -s ssh //下载rpm安装包 sudo curl -O https://downloa

AOP技术基础

AOP技术的诞生并不算晚,早在1990年开始,来自Xerox Palo Alto Research Lab(即PARC)的研究人员就对面向对象思想的局限性进行了分析.他们研究出了一种新的编程思想,借助这一思想或许可以通过减少代码重复模块从而帮助开发人员提高工作效率.随着研究的逐渐深入,AOP也逐渐发展成一套完整的程序设计思想,各种应用AOP的技术也应运而生. AOP技术在Java平台下是最先得到应用的.就在PARC对于面向方面编程进行研究的同时,美国Northeastern University

asp.net C# 题目大全

net001在线饰品销售系统 net002鲜花商城 net003商品销售管理系统 net004在线辅导答疑 net005土地税务管理系统 net006旅游管理 net007房产中介 net008房产信息网 net009小区车辆管理系统(CS) net010宾馆管理 net011net图书管理系统 net012个人博客管理 net013公交查询系统 net014客户管理系统 net015人才信息 net016美特好农产品 net017公司设备管理系统 net018长途汽车查询 net019网络投票