邮件服务postfix+mysql
来源:互联网 发布:mac版大脚插件怎么用 编辑:程序博客网 时间:2024/05/22 08:25
postfix(作为发送邮件服务器)+mysql(作为数据库):
Postfix+mysql主要是把邮件服务的发与mysql结合使用,再以php的格式结合Apache通过网页的形式管理mysql。[root@westos-mail ~]# mv /etc/postfix/main.cf /mnt/ ######将之前postfix的主配置文件备份
[root@westos-mail ~]# yum reinstall postfix.x86_64 -y #####重新下载安装软件
[root@westos-mail ~]# vim /etc/postfix/main.cf #####修改主配置文件
76 myhostname = westos-mail.westos.com ####指定mta主机名称
83 mydomain = westos.com ##指定mta的域名
99 myorigin = westos.com ##指定邮件来源结尾(@后面的字符内容)
116 inet_interfaces = all ####25端口开启的网络接口
164 mydestination = $myhostname, $mydomain, localhost ##接收邮件结尾字符的指定
[root@westos-mail ~]# systemctl restart postfix.service ######重启服务
[root@westos-mail ~]# yum install httpd php php-mysql mariadb-server -y #####下载安装httpd,php,php-masql,mariadb-server
[root@westos-mail ~]# systemctl start mariadb #####开启数据库服务
[root@westos-mail ~]# vim /etc/my.cnf ####修改文件,关闭数据库的网络连接
[root@qq-mail ~]# systemctl restart mariadb #####重启数据库服务
[root@westos-mail ~]# systemctl restart postfix.service #####重启postfix服务
[root@westos-mail ~]# mysql_secure_installation ####mysql安全配置
[root@westos-mail html]# tar jxf phpMyAdmin-3.4.0-all-languages.tar.bz2 #####php安装包解压
[root@westos-mail html]# ls
phpMyAdmin-3.4.0-all-languages
[root@westos-mail html]# mv phpMyAdmin-3.4.0-all-languages/ myadmin ####将解压目录重命名
[root@westos-mail html]# cd myadmin
[root@westos-mail myadmin]# ls
[root@westos-mail myadmin]# cp config.sample.inc.php config.inc.php #####复制模板
[root@westos-mail myadmin]# vim config.inc.php
[root@qq-mail myadmin]# systemctl restart httpd #####重启httpd服务
创建数据库email,添加表emailuser,插入字段及内容
[root@westos-mail myadmin]# mysql -uroot -plee ####root用户登录数据库
MariaDB [(none)]> create user postuser@localhost identified by 'postuser'; ###创建并认证用户,数据库本地管理用户postuser ,密码为postuser
MariaDB [(none)]> grant select,update,insert on email.* to postuser@localhost; #####用户授权
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> quit
Bye
[root@westos-mail myadmin]# mysql -upostuser -ppostuser ####postuser用户登录,查看创建数据库的所有内容
配置postfix服务:
[root@westos-mail ~]# cd /etc/postfix/
[root@westos-mail postfix]# vim mailuser.cf ####用户名称查询
hosts = localhost ####数据库所在主机
user = postuser ####登录数据库的用户
password = postuser ####登录数据库的密码
dbname = email ####postfix要查询的数据库名称
table = emailuser ####postfix要查询的表的名称
select_field = username ###postfix要查询的字段
where_field = username ###用户给定postfix的查询字段
[root@westos-mail postfix]# postmap -q "lee@lee.com" mysql:/etc/postfix/mailuser.cf ###检查文件书写是否正确
lee@lee.com
[root@westos-mail postfix]# cp mailuser.cf maildomain.cf
[root@westos-mail postfix]# vim maildomain.cf ####用户域名查询
[root@westos-mail postfix]# postmap -q "lee.com" mysql:/etc/postfix/maildomain.cf
lee.com
[root@westos-mail postfix]# cp mailuser.cf mailbox.cf
[root@westos-mail postfix]# vim mailbox.cf ####用户邮箱位置查询
[root@westos-mail postfix]# postmap -q "lee@lee.com" mysql:/etc/postfix/mailbox.cf
/mnt/lee.com/lee/
[root@westos-mail ~]# groupadd -g 666 vmail ####建立gid为666的组
[root@westos-mail ~]# useradd -s /sbin/nologin -u 666 vmail -g 666 ####添加虚拟用户,uid为666
[root@westos-mail ~]# id vmail
uid=666(vmail) gid=666(vmail) groups=666(vmail)
[root@westos-mail ~]# cd /home/vmail ####基本配置路径
[root@westos-mail vmail]# ls
mail
[root@westos-mail vmail]# postconf -e "virtual_mailbox_base = /home/vmail" #####设定虚拟用户的邮件目录
[root@westos-mail vmail]# postconf -e "virtual_uid_maps = static:666" ####虚拟用户建立文件的uid
[root@westos-mail vmail]# postconf -e "virtual_gid_maps = static:666" ####虚拟用户建立文件的gid
[root@westos-mail vmail]# postconf -e "virtual_alias_maps = mysql:/etc/postfix/mailuser.cf" ###使数据库中信息与postfix关联
[root@westos-mail vmail]# postconf -e "virtual_mailbox_maps = mysql:/etc/postfix/mainbox.cf"
[root@westos-mail vmail]# postconf -e "virtual_mailbox_domains = mysql:/etc/postfix/maindomain.cf"
[root@westos-mail vmail]# systemctl restart postfix #####重启postfix服务
----在数据库email中修改maildir信息 /lee.com/lee/
----邮箱的基本配置路径为/home/vmail
[root@westos-mail vmail]# ll /etc/postfix/mailuser.cf #####查看是否生成文件
-rw-r--r--. 1 root root 134 May 21 04:10 /etc/postfix/mailuser.cf
[root@westos-mail vmail]# ll /etc/postfix/maindomain.cf
-rw-r--r--. 1 root root 130 May 21 04:12 /etc/postfix/maindomain.cf[root@westos-mail vmail]# cd /home/vmail/
测试:
[root@westos-mail vmail]# mail lee@lee.com
Subject: djsd
dbha
.
EOT
[root@westos-mail vmail]# ls
lee.com mail
[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]# cd new/
[root@westos-mail new]# ls
1495357308.Vfd01I1a9eeefM765586.qq-mail.qq.com
1495357369.Vfd01I1a9eef0M465476.qq-mail.qq.com
[root@westos-mail new]# cat new/1495357308.Vfd01I1a9eeefM765586.westos-mail.westos.com
- 邮件服务postfix+mysql
- 邮件服务搭建(postfix+mysql+maild…
- postfix空壳邮件服务
- 05-POSTFIX邮件服务
- Postfix邮件服务
- linux postfix邮件服务
- linux学习之邮件服务管理,postfix,dovecot,thunderbird,mysql
- 开源postfix邮件部署服务
- postfix邮件服务+mariadb数据库
- 简单邮件服务(Postfix+dovecot)
- CentOS 7.1 配置 postfix 服务发邮件
- 基于CentOS搭建Postfix、Dovecot邮件服务
- [App] Postfix 配置本地邮件服务
- Linux 部署邮件服务器 postfix mysql dovecot
- Ubuntu之邮件服务器(Postfix, Dovecot, MySql)
- Postfix+Dovecot+Mysql搭建邮件服务器
- postfix+mysql接收邮件+空壳服务器
- postfix邮件服务的基本配置、邮件别名与群发
- java8新特性-sorted排序
- 编程训练
- 关于微信支付的一个坑,在此记录一下。
- Maven框SocialConfigurerAdapter.class缺失
- svn 国内码云与国际Github的项目同步
- 邮件服务postfix+mysql
- RPC原理及RPC实例分析
- django-url调度器-中级篇
- Duilib自绘圆形进度条
- Spark Kudu 结合
- 一步一步带你搭建一个“摩登”的前端开发环境
- linux 怎么编译busybox
- 【GBA】2013年度-Dubbo超时机制导致的雪崩连接
- Android应用进程防杀指南1-常用套路