主机名 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邮件服务器的更多相关文章

  1. 烂泥:Postfix邮件服务器搭建之准备工作

    说实话,Postfix邮件服务器的搭建是一件很麻烦的事情,需要各种软件之间的配置和调试.在写这篇文章之前,我也是搭建测试了不下于10次才算把整个流程给走通,今天刚好有时间把整个搭建过程记录下来. 在正 ...

  2. 烂泥:Postfix邮件服务器搭建之软件安装与配置

    本文由ilanniweb提供友情赞助,首发于烂泥行天下 想要获得更多的文章,可以关注我的微信ilanniweb Postfix邮件服务器的搭建需要使用到几个软件,分别是cyrus-sasl.postf ...

  3. 烂泥:Postfix邮件服务器搭建之虚拟用户配置

    virtual_gid_maps = static: virtual_transport = dovecot dovecot_destination_recipient_limit = 1 注意:po ...

  4. Postfix邮件服务器搭建及配置

    一.邮件服务器(Mail Server)的传输协议 1.简单邮件传输协议(SMTP):Simple Mail Transger Protocol 2.扩展的简单邮件传输协议(ESMTP):Extend ...

  5. Linux中postfix邮件服务器的搭建

    postfix是Wietse Venema在IBM的GPL协议之下开发的MTA(邮件传输代理)软件.postfix是Wietse Venema想要为使用最广泛的sendmail提供替代品的一个尝试.在 ...

  6. Centos安装配置Postfix邮件服务器

    发布时间:July 6, 2012 // 分类:Mail // No Comments 在安装邮件服务器之前先了解几个名词,以后会用到: 1 2 3 4 5 6 MUA:用户代理端,即用户使用的写信. ...

  7. linux平台搭建postfix邮件服务器

    一,搭建邮件服务器前准备如下: Centos 7.2 64位Postfix-2.8.12.tar.gz Postfix MTA(邮件传输代理)Dovecot-2.1.8.tar.gz IMAP 和 P ...

  8. centos7搭建postfix邮件服务器

    在使用qq等邮件服务器厂商提供的邮件服务后,发现他们的邮件发送数量是有限制的,随着公司的业务的需求下,我们需要搭建一个邮件服务器,邮件服务器可以帮助我们在一些提醒方面和消息推送方面起到帮助. 理论性语 ...

  9. Postfix 邮件服务器搭建

    搭建服务环境: Centos 6 配置域名hosts: mail.demonC6.com 1.清理系统自带的邮件软件 # rpm -qa | grep sendmail* # rpm -e sendm ...

随机推荐

  1. InspectIT_EUM 实现原理概述

    在Git上查看 InspectIT 实现原理概述: 实现原理详解:  1.jsAgent如何注入到浏览器 通过ASM框架修改HttpService.service()方法,加入相关逻辑,对每一个Htt ...

  2. 使用C语言获取字符串或文件的MD5值

    libmd5地址:https://sourceforge.net/projects/libmd5-rfc/ MD5Demo1.c #include <stdio.h> #include & ...

  3. babel的安装和使用方法

    要使用Babel, 我们需要nodeJS的环境和npm, 主要安装了nodeJS, npm就默认安装了 , 现在安装nodeJS很简单了, 直接下载安装就好了: 安装es-checker 在使用Bab ...

  4. log4j 路径环境变量配置和log4j加载配置

    1.lo4j日志路径从环境变量读取,log4j.xml配置如下: 具体配置如下: log4j.appender.R.Encoding=UTF-8 log4j.appender.R=org.apache ...

  5. 序列化FastReport,重要提示少走弯路 good

    原本在开发一个报表插件,因为需要远程传输,因此需要序列化报表,序列化FastReport有两种方式, 1.仅序列化数据,由客户端接受到数据,并呈现报表,这种方式需要在客户端存储报表格式文件xxx.Fr ...

  6. Parameter 'username' not found. Available parameters are [1, 0, param1, param2]

    只要把dao层的***Mapper.java代码的参数加上@param 才可以 修改前的代码 public User selectLogin(String username,String passwo ...

  7. hdu1226

    hdu1226 :点击打开题目链接 本题目由于题目意思,容易得知是一道广搜的题目. 首先. 我们需要知道 ,大数取模,比如 如何判断1234567 对15 取模的数为多少?答案是7,但是如果他是大数怎 ...

  8. java socket 以及 流 关闭的问题

    首先我一下几个提出问题:稍后再做出解答. 问题一:A如果仅仅将输入流关闭(inA.close()),对A与B之间的连接是否有影响? A能否再次获得输入流(inA = socketA.getInputS ...

  9. python中的编码和解码

    计算机中常见的编码方式有多种,英文一般是ascii编码,其他有unicode,utf-8,gbk,utf-16等编码. 常见编码方式: ASCII编码:ASCII是早期的编码,包含英文字母.数字和 ...

  10. wireshark分析ssl协议

    1.什么是ssl SSL(Secure Sockets Layer 安全套接层),及其继任者传输层安全(Transport Layer Security,TLS)是为网络通信提供安全及数据完整性的一种 ...