RHEL 6.5 ----Postfix邮件服务器
| 主机名 | IP | 服务 |
| master | 192.168.30.130 | |
| slave | 192.168.30.131 |
软件包介绍
| 包名 | 介绍 |
| postfix-2.6.6-2.2.el6_1.x86_64 | postfix的主程序包,必须安装 |
| dovecot.x86_64 1:2.0.9-7.el6 | 用于接收邮件 |
安装
[root@master ~]# yum install -y postfix dovecot
配置文件和日志文件位置
[root@master ~]# ls /etc/postfix/
access generic main.cf relocated virtual
canonical header_checks master.cf transport
[root@master ~]# ls /var/log/maillog
/var/log/maillog
启动postfix服务并查看
[root@master ~]# service postfix start
[root@master ~]# netstat -antup | grep
tcp 127.0.0.1: 0.0.0.0:* LISTEN /master
tcp ::: :::* LISTEN /master
[root@master ~]# ps -ef | grep postfix
root : ? :: /usr/libexec/postfix/master
postfix : ? :: qmgr -l -t fifo -u
postfix : ? :: pickup -l -t fifo -u
root : pts/ :: grep postfix
修改配置文件实现postfix发送邮件
[root@master ~]# vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
:: localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.30.130 master sishen.cn
192.168.30.131 slave
[root@master ~]# vim /etc/postfix/main.cf
mydomain = sishen.cn
mynetworks = 192.168.30.0/,127.0.0.0/
重启postfix测试
[root@master ~]# service postfix restart
Shutting down postfix: [ OK ]
Starting postfix: [ OK ]


配置dovecot实现postfix的发送和接收
[root@master ~]# vim /etc/dovecot/dovecot.conf
protocols = imap pop3 lmtp #取消前面的注释
login_trusted_networks = 0.0.0.0 #允许所有网络
login_trusted_networks = 192.168.30.0/ #允许制定IP,两者选其一 [root@master ~]# vim /etc/dovecot/conf.d/-mail.conf
mail_location = mbox:~/mail:INBOX=/var/mail/%u #取消前面的注释,指定收件箱位置
mbox_write_locks = fcntl #默认开启,无需更改
修改.bash_profile文件
[root@master ~]# vim /etc/skel/.bash_profile
# .bash_profile # Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi # User specific environment and startup programs PATH=$PATH:$HOME/bin export PATH
if [ ! -d ~/mail/.imap/INBOX ]; then
mkdir -p ~/mail/.imap/INBOX
fi
重启服务
[root@master ~]# service dovecot restart
Stopping Dovecot Imap: [ OK ]
Starting Dovecot Imap: [ OK ]
创建用户测试
[root@master ~]# useradd xueji
[root@master ~]# echo "xueji:123456" | chpasswd
#以下是三种发送邮件的方式
[xueji@master ~]$ mail -s "【xueji】" xueji@sishen.cn < /etc/hosts #注意这里最好写成xueji@192.168.30.130,因为在实际测试过程中,虽然提示发送邮件成功,但实际上收件箱并没有邮件,可能是因为上述配置文件中写的是IP地址段的问题。(个人感觉)
[xueji@master ~]$ echo "aa################bb" | mail -s "sishen" sishen@sishen.cn < /etc/passwd [xueji@master ~]$ mail -s 'test-01' sishen@sishen.cn #直接回车
# 输入正文 # 这里想要结束必须回车换到新一行行首
EOT #然后Ctrl+d
查看邮件
[xueji@master ~]$ mail
Heirloom Mail version 12.4 //. Type ? for help.
"/var/spool/mail/xueji": messages unread
Mail Delivery System Thu May : / "Undelivered Mail Returne"
>U Mail Delivery System Thu May : / "Undelivered Mail Returne"
&
Message :
From MAILER-DAEMON Thu May ::
Return-Path: <>
X-Original-To: xueji@master.localdomain
Delivered-To: xueji@master.localdomain
Date: Thu, May :: + (CST)
From: MAILER-DAEMON@master.localdomain (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
To: xueji@master.localdomain
Auto-Submitted: auto-replied
Content-Type: multipart/report; report-type=delivery-status;
boundary="36CAFA06AC.1527107277/master.localdomain"
Status: RO Part :
Content-Description: Notification
Content-Type: text/plain; charset=us-ascii This is the mail system at host master.localdomain. I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below. For further assistance, please send mail to postmaster. If you do so, please include this problem report. You can
delete your own text from the attached returned message. The mail system <root@192.168.30.130>: bad address syntax Part :
Content-Description: Delivery report
Content-Type: message/delivery-status Part :
Content-Description: Undelivered Message
Content-Type: message/rfc822 From xueji@master.localdomain Thu May ::
Return-Path: <xueji@master.localdomain>
Date: Thu, May :: +
To: root@192.168.30.130
Subject: 【xueji】
User-Agent: Heirloom mailx 12.4 //
Content-Type: text/plain; charset=us-ascii
From: xueji@master.localdomain 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
:: localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.30.130 sishen.cn
RHEL 6.5 ----Postfix邮件服务器的更多相关文章
- 烂泥:Postfix邮件服务器搭建之准备工作
说实话,Postfix邮件服务器的搭建是一件很麻烦的事情,需要各种软件之间的配置和调试.在写这篇文章之前,我也是搭建测试了不下于10次才算把整个流程给走通,今天刚好有时间把整个搭建过程记录下来. 在正 ...
- 烂泥:Postfix邮件服务器搭建之软件安装与配置
本文由ilanniweb提供友情赞助,首发于烂泥行天下 想要获得更多的文章,可以关注我的微信ilanniweb Postfix邮件服务器的搭建需要使用到几个软件,分别是cyrus-sasl.postf ...
- 烂泥:Postfix邮件服务器搭建之虚拟用户配置
virtual_gid_maps = static: virtual_transport = dovecot dovecot_destination_recipient_limit = 1 注意:po ...
- Postfix邮件服务器搭建及配置
一.邮件服务器(Mail Server)的传输协议 1.简单邮件传输协议(SMTP):Simple Mail Transger Protocol 2.扩展的简单邮件传输协议(ESMTP):Extend ...
- Linux中postfix邮件服务器的搭建
postfix是Wietse Venema在IBM的GPL协议之下开发的MTA(邮件传输代理)软件.postfix是Wietse Venema想要为使用最广泛的sendmail提供替代品的一个尝试.在 ...
- Centos安装配置Postfix邮件服务器
发布时间:July 6, 2012 // 分类:Mail // No Comments 在安装邮件服务器之前先了解几个名词,以后会用到: 1 2 3 4 5 6 MUA:用户代理端,即用户使用的写信. ...
- linux平台搭建postfix邮件服务器
一,搭建邮件服务器前准备如下: Centos 7.2 64位Postfix-2.8.12.tar.gz Postfix MTA(邮件传输代理)Dovecot-2.1.8.tar.gz IMAP 和 P ...
- centos7搭建postfix邮件服务器
在使用qq等邮件服务器厂商提供的邮件服务后,发现他们的邮件发送数量是有限制的,随着公司的业务的需求下,我们需要搭建一个邮件服务器,邮件服务器可以帮助我们在一些提醒方面和消息推送方面起到帮助. 理论性语 ...
- Postfix 邮件服务器搭建
搭建服务环境: Centos 6 配置域名hosts: mail.demonC6.com 1.清理系统自带的邮件软件 # rpm -qa | grep sendmail* # rpm -e sendm ...
随机推荐
- quilt
1 什么是quilt quilt是一个patch管理工具,特别适合于对多个patch进行管理. quilt是基于gnu patch和diff的. 2 使用quilt创建一个patch 第一步,quil ...
- 在Windows上使用libcurl发起HTTP请求
curl下载地址https://curl.haxx.se/download.html 当前最新版本为7.61.0 将下载的curl-7.61.0.zip解压,得到curl-7.61.0 在目录curl ...
- Javascript正则中的exec和match
分几种情况说明 1.假设re中不是全局的也就是不带g var str = "cat3 hat4"; var re = /\w+\d/; var ex = re.exec(str); ...
- 皮尔逊相关系数的java实现
相关系数的值介于–1与+1之间,即–1≤r≤+1.其性质如下:当r>0时,表示两变量正相关,r<0时,两变量为负相关.当|r|=1时,表示两变量为完全线性相关,即为函数关系.当r=0时,表 ...
- HihoCoder1705: 座位问题(STL)
描述 HIHO银行等待区有一排N个座位,从左到右依次编号1~N.现在有M位顾客坐在座位上,其中第i位坐在编号Ai的座位上. 之后又陆续来了K位顾客,(K + M ≤ N) 他们都会选择坐在最" ...
- CTR预估经典模型总结
计算广告领域中数据特点: 1 正负样本不平衡 2 大量id类特征,高维,多领域(一个类别型特征就是一个field,比如上面的Weekday.Gender.City这是三个field),稀疏 ...
- 详述IntelliJ IDEA插件的安装及使用方法(图解)
intellij idea是一款非常优秀的软件开发工具,它拥有这强大的插件体系,可以帮助开发者完成很多重量级的功能.今天,我们来学习一下如何安装和卸载intellij idea的插件. Intelli ...
- 任务25:IHostEnvironment和 IApplicationLifetime介绍
任务25:IHostEnvironment和 IApplicationLifetime介绍 IHostingEnvironment这个里面有一些参数,比如我们当前应用程序的名称.目录的. await ...
- E20180430-hm
pants n. <英>(紧身的)短裤; <美> 裤子; 喘气( pant的名词复数 ); leggings n. 绑腿; 裹腿; 绷腿; 袜统; redundant adj. ...
- 洛谷 - P2055 - 假期的宿舍 - 最大流
https://www.luogu.org/problemnew/show/P2055 这是一个错误的示范. 一开始觉得就找一条路从外校同学连到本校同学然后最终从周末回家的同学流出,每个人睡后一个人的 ...