配置SENDMAIL服务器:
[root@homeserver ~]# vim /etc/sysconfig/network      //修改主机名(@后面的内容)
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=homeserver.home.net
NISDOMAIN=home
[root@homeserver ~]# vim /etc/hosts            //添加主机IP解析记录
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.1.222 homeserver.home.net
安装相关RPM包:
[root@homeserver ~]# rpm -ivh /var/rhcepkg/Server/sendmail-cf-8.13.8-2.el5.i386.rpm
[root@homeserver ~]# rpm -ivh /var/rhcepkg/Server/sendmail-8.13.8-2.el5.i386.rpm
[root@homeserver ~]# rpm -ivh /var/rhcepkg/Server/cyrus-sasl-lib-2.1.22-4.i386.rpm
[root@homeserver ~]# rpm -ivh /var/rhcepkg/Server/cyrus-sasl-plain-2.1.22-4.i386.rpm
[root@homeserver ~]# rpm -ivh /var/rhcepkg/Server/cyrus-sasl-2.1.22-4.i386.rpm
[root@homeserver ~]# rpm -ivh /var/rhcepkg/Server/perl-DBI-1.52-1.fc6.i386.rpm
[root@homeserver ~]# rpm -ivh /var/rhcepkg/Server/mysql-5.0.45-7.el5.i386.rpm
[root@homeserver ~]# rpm -ivh /var/rhcepkg/Server/dovecot-1.0.7-2.el5.i386.rpm
[root@homeserver ~]# vim /etc/mail/sendmail.mc       //修改SENDMAIL主配置文件
DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
[root@homeserver ~]# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf      //M4宏编译
[root@homeserver ~]# /usr/sbin/saslauthd -a shadow
[root@homeserver ~]# echo /usr/sbin/saslauthd -a shadow >> /etc/rc.local
[root@homeserver ~]# vim /etc/rc.local
[root@homeserver ~]# /etc/init.d/saslauthd restart
Stopping saslauthd: [ OK ]
Starting saslauthd: [ OK ]
[root@homeserver ~]# /etc/init.d/sendmail restart
Shutting down sm-client: [ OK ]
Shutting down sendmail: [ OK ]
Starting sendmail: [ OK ]
Starting sm-client: [ OK ]
[root@homeserver ~]# vim /etc/dovecot.conf           //修改dovecot配置文件
protocols = pop3
[root@homeserver ~]# /etc/init.d/dovecot restart
Stopping Dovecot Imap: [FAILED]
Starting Dovecot Imap: [ OK ]
[root@homeserver ~]# chkconfig sendmail on   //设定开机自启
[root@homeserver ~]# chkconfig dovecot on
[root@homeserver ~]# chkconfig saslauthd on
[root@homeserver ~]# netstat –tl      //检查服务是否开启
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 *:768 *:* LISTEN
tcp 0 0 localhost.localdomain:2208 *:* LISTEN
tcp 0 0 *:nfs *:* LISTEN
tcp 0 0 *:708 *:* LISTEN
tcp 0 0 *:39720 *:* LISTEN
tcp 0 0 *:netbios-ssn *:* LISTEN
tcp 0 0 *:5900 *:* LISTEN
tcp 0 0 *:sunrpc *:* LISTEN
tcp 0 0 *:dec_dlm *:* LISTEN
tcp 0 0 *:ftp *:* LISTEN
tcp 0 0 *:918 *:* LISTEN
tcp 0 0 localhost.localdomain:ipp *:* LISTEN
tcp 0 0 *:smtp *:* LISTEN
tcp 0 0 *:microsoft-ds *:* LISTEN
tcp 0 0 localhost.localdomain:2207 *:* LISTEN
tcp 0 0 *:pop3 *:* LISTEN
tcp 0 0 *:http *:* LISTEN
tcp 0 0 *:ssh *:* LISTEN
[root@homeserver ~]# iptables -L –n        //检查防火墙是否有阻止策略
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
[root@homeserver ~]# sendmail –d0      //查看sendmail所能识别的主机名
============ SYSTEM IDENTITY (after readcf) ============
(short domain name) $w = homeserver
(canonical domain name) $j = homeserver.home.net
(subdomain name) $m = home.net
(node name) $k = homeserver.home.net
=======================================================
Recipient names must be specified
[root@homeserver ~]# vim /etc/mail/local-host-names    //添加邮件主机名(@后面的内容)
# local-host-names - include all aliases for your machine here.
homeserver.home.net
[root@homeserver ~]# telnet 192.168.1.222 25    //进行本地测试
Trying 192.168.1.222...
Connected to homeserver.home.net (192.168.1.222).
Escape character is '^]'.
220 homeserver.home.net ESMTP Sendmail 8.13.8/8.13.8; Mon, 5 Apr 2010 13:55:35 +0800
HELO homeserver.home.net          //开始”握手”
250 homeserver.home.net Hello homeserver.home.net [192.168.1.222], pleased to meet you
MAIL From : irini@homeserver.home.net     //发件人地址
250 2.1.0 irini@homeserver.home.net... Sender ok
RCPT To : jessica@homeserver.home.net     //收件人地址
250 2.1.5 jessica@homeserver.home.net... Recipient ok
DATA                         //开始输入内容
354 Enter mail, end with "." on a line by itself
this is a test mail              //邮件内容
.                              //”点号”表示结束
250 2.0.0 o355tZQ3008174 Message accepted for delivery
Quit                          //退出
221 2.0.0 homeserver.home.net closing connection
Connection closed by foreign host.
[root@homeserver ~]# mailq            //查看当前邮件列队
/var/spool/mqueue is empty
Total requests: 0
[root@homeserver ~]# su – Jessica          //切换到JESSICA家目录下
-bash-3.2$ mail                  //查看邮件内容
Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/jessica": 1 message 1 new
>N 1 irini@homeserver.hom Mon Apr 5 13:57 11/457
& 1
Message 1:
From irini@homeserver.home.net Mon Apr 5 13:57:51 2010
Date: Mon, 5 Apr 2010 13:55:35 +0800
From: irini@homeserver.home.net
this is a test mail         //与之前的内容相符
& q
[root@homeserver ~]# mutt -f pop://frank@homeserver.home.net           //POP远程邮件接收测试, frank@homeserver.home.net 为邮件发送地址
Password for frank@homeserver.home.net: XXXXXX
q:Quit d:Del u:Undel s:Save m:Mail r:Reply g:Group ?:Help
---Mutt: pop://frank@homeserver.home.net/ [Msgs:0]---(date/date)------------------------------(all)---
To: feng9422@126.com      //邮件接收地址
Subject: check for this test
y:Send q:Abort t:To c:CC s:Subj a:Attach file d:Descrip ?:Help
From: root <root@homeserver.home.net>
To: feng9422@126.com
Have u received this test?        //写邮件内容
q:Quit d:Del u:Undel s:Save m:Mail r:Reply g:Group ?:Help
---Mutt: pop://frank@homeserver.home.net/ [Msgs:0]---(date/date)----------------------------------------------------------------(all)---
Mail sent.
邮件服务器优化:
1- 关闭邮件RELAY功能
[root@homeserver ~]# vim /etc/mail/access          //只留本地RELAY
Connect:localhost.localdomain RELAY
Connect:localhost RELAY
Connect:127.0.0.1 RELAY
[root@homeserver ~]# makemap hash access.db > /etc/mail/access         //修改后执行此命令
2- 设定帐号不可登录系统
#useradd test –s /sbin/nologin
3- 添加事实黑名单-RBL(realtime blackhole list),服务器在接受邮件时会先去RBL的服务器查询该邮件地址是否处于黑名单中.
[root@homeserver ~]# vim /etc/mail/sendmail.mc
FEATURE(`dnsbl',`relays.ordb.org',` ″Email blocked using ORDB.org - see <http://ORDB.org/lookup/﹖host=″$&{client_addr}″>″')
[root@homeserver ~]# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf       //M4宏编译
[root@homeserver ~]# /etc/init.d/sendmail restart
4- spamassassin 来防止垃圾邮件
[root@homeserver ~]# yum install spamassassinlain      //yum安装,因为依赖的包太多了
[root@homeserver ~]# /etc/init.d/spamassassin restart
Stopping spamd: [FAILED]
Starting spamd: [ OK ]
[root@homeserver ~]# chkconfig spamassassin on
默认规则(已经很充足了)都在/usr/share/spamassassin/目录下以.cf结尾的文件
[root@homeserver ~]# vim /usr/share/spamassassin/local.cf          //添加本地规则
whitelist_from_rcvd irinilu@theetonhotel.com       //允许这个地址的EM
whitelist_from_rcvd @theetonhotel.com          //允许这个域名的EM
#wget –N –P /usr/share.spamassassin/ www.ccert.edu.cn/spam/sa/Chinese_rules.cf        //下载中文反垃圾规则,也可做成计划任务,定期下载更新
--18:02:25-- http://www.ccert.edu.cn/spam/sa/Chinese_rules.cf
Resolving www.ccert.edu.cn... 202.112.57.9
Connecting to www.ccert.edu.cn|202.112.57.9|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 55342 (54K) [text/plain]
Remote file is newer, retrieving.
--18:02:26-- http://www.ccert.edu.cn/spam/sa/Chinese_rules.cf
Connecting to www.ccert.edu.cn|202.112.57.9|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 55342 (54K) [text/plain]
Saving to: `/usr/share/spamassassin/Chinese_rules.cf'
100%[=======================================================>]55,342 61.1K/s in 0.9s
18:02:27 (61.1 KB/s) - `/usr/share/spamassassin/Chinese_rules.cf' saved [55342/55342]

转载于:https://blog.51cto.com/irinilu/292526

Sendmail 邮件服务器安装和优化相关推荐

  1. RHEL5中配置Sendmail邮件服务 收藏二

    19              ☆sendmail别名 sendmail的主要的别名配置文件是/etc/aliases. 在sendmail决定消息的接受者的目的地的之前,其先试图在别名中查找. 为了 ...

  2. linux服务sendmail邮件服务

    sendmail邮件服务器 程序名  sendmail 软件包  sendmail 监听端口号 25 sendmail是最重要的邮件传输代理程序 电子邮件程序可分解成用户代理(mua),传输代理(mt ...

  3. 【实战】使用Java结合Sendmail邮件服务器+Quartz开源框架定时发邮件

    [实战]废话不多说,直接教你如何搭建以及使用,具体细节需要你自己细细品味. 环境:Centos7,window10 64bit 第一步: 搭建Sendmail邮件服务器.[不能在本地linux搭建,因 ...

  4. Linux运维之(七)邮件服务器安装与配置squirrelmail-webmail

    邮件服务器安装 邮件服务器原理和架设过程 发件人:MUA --发送–> MTA -> 若干个MTA- -> MTA -> MDA <–收取-- MUA:收件人 MUA到M ...

  5. linux搭建sendmail邮件服务器,Linux系统Sendmail架设Mail服务器

    一.安装Sendmail 完全安装Red Hat Linux 9.0时,Sendmail就会自动内置,版本号为8.12.8-4.如果你不确定Linux是否已经安装有sendmail,可以输入以下命令查 ...

  6. sendmail邮件服务器支持账户名大小写

    在sendmail默认的配置下,如果有些用户账号名包含大写字母,比如San.Zhang,则他们都无法成功接收到电子邮件.因此,为使这些用户也能正常收发邮件,必须修改/etc/mail/sendmail ...

  7. 在RHEL-4下半小时搭建Sendmail邮件服务器(下)

    上一篇已经介绍了SMTP部分的相关搭建,现在来说说POP3或者IMAP的部分,只 有客户端跟邮件服务器同时支持SMTP和POP3/IMAP,才能实现完整的邮件收发功能. sendmail服务器不为MU ...

  8. sendmail邮件服务搭建详细解   小小子

    Sendmail+Openwebmail 1.1.软件安装sendmaills yum install  sendmail*  perl-Compress-Zlib perl-suidperl per ...

  9. sendmail邮件服务器配置

    原理图:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> < ...

  10. linux下sendmail邮件系统安装操作记录

    电子邮件系统的组成: 1)邮件用户代理(Mail User Agent , MUA),MUA是一个邮件系统的客户端程序,它提供了阅读,发送和接受电子邮件的用户接口. 最常用的 MUA 有: linux ...

最新文章

  1. blast程序 介绍 简介
  2. 【Java】异常处理体系概述
  3. win7+cuda8.0+cudnn6.0+tensorflow-gpu1.3.0安装过程总结
  4. 机器学习基石12-Nonlinear Transformation
  5. 搭建自己的 CDN 会有哪些乐趣和好处?
  6. python问卷星微信登录_python
  7. Linux正则表达式详解
  8. MATLAB线性方程组的两种求解,matlab求解线性方程组
  9. ZJYYC LSH去年买了个表(也是LZY去年买了个表) DFS
  10. 卷积神经网络CNN的实战知识
  11. 并发编程——线程协作
  12. sql tuning advisor
  13. matlab之ARMA(p,q)模型
  14. 地球罕见的九大自然现象
  15. 三参数或七参数计算工具使用帮助
  16. oracle如何导入用户数据库,oracle数据库创建用户导入导出详解
  17. 机器人曲轴上下料_曲轴自动上下料机器人
  18. AD转换和DA转换的应用
  19. 模拟赛DAY1 T2腐草为萤
  20. 互联网公司时尚穿搭指南 1

热门文章

  1. WPF太阳、地球、月球运动轨迹模拟
  2. springboot vue组件写的个人博客系统
  3. 类中添加log4j日志
  4. 首个万人远程培训项目顺利启动
  5. 118 Python程序中的线程操作-守护线程
  6. BigDecimal浮点精度加减乘除运算
  7. 如何在一个项目中兼容Wepy和Taro?
  8. ldap 测试表设计
  9. swiper控件(回调函数)
  10. [ActionScript 3.0] 通过as3操作web内容