linux安装配置sendmail实现邮件发送

sendmail配置

yum -y update sendmail sendmail-cf

SendMail相关目录
1. 设定档目录:/etc/mail
2. 记录档:/var/log/maillog
3. 己收信件之暂存目录:/var/spool/mail/
4. 寄出信件之暂存目录:/var/spool/mqueue/

先备份,后修改

cd /etc/mail
mv sendmail.cf sendmail.cf.bak

解除只有Server本身可以递送信件的设定

vi /etc/mail/sendmail.mc

DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA‘) 改成
dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA‘)

加入广告信来源过滤机制

在以下两行
FEATURE(`blacklist_recipients‘)dnl
.
.
EXPOSED_USER(`root‘)dnl
之间加入

dnl # use DNSBL for spam mail
FEATURE(`dnsbl‘, `rbl.maps.vix.com‘, `Rejected - see http://www.mail-abuse.org/rbl/‘)dnl
FEATURE(`dnsbl‘, `dul.maps.vix.com‘, `Dialup - see http://www.mail-abuse.org/dul/‘)dnl
FEATURE(`dnsbl‘, `relays.mail-abuse.org‘, `Open spam relay - see http://www.mail-abuse.org/rss‘)dnl
dnl FEATURE(`dnsbl‘, `relays.ordb.org‘, `"Email blocked using ORDB.org - see http://ordb.org"‘)dnl
FEATURE(`dnsbl‘, `blackholes.mail-abuse.org‘, `"Spam blocked see: http://mail-abuse.org/cgi-bin/lookup?"$&{client_addr}‘)dnl
FEATURE(`dnsbl‘, `bl.spamcop.net‘, `"Spam blocked see: http://spamcop.net/bl.shtml?"$&{client_addr}‘)dnl
dnl FEATURE(`dnsbl‘,`dnsbl.sorbs.net‘, `"554 Rejected " $&{client_addr} " found in dnsbl.sorbs.net"‘)dnl
dnl FEATURE(`dnsbl‘, `rbl.softworking.com‘, `"550 Mail from "$&{client_addr}" rejected based on external blacklist - See also http://www.111cn.net/"‘)dnl

配置防止广告

yum install milter-greylist

vi /etc/mail/sendmail.mc,在FEATURE(`dnsbl‘...描述后面加入

dnl # use GREYLIST for spam mail
FEATURE(`milter-greylist‘)dnl

避免relay范围内的机器每次都要寄两次以上才会寄出信件

vi /etc/mail/greylist.conf

# Your own network, which should not suffer greylisting

list "my network" addr { 127.0.0.1/8 163.32.244.0/24 }

# This is a list of broken MTAs that break with greylisting. Derived from # http://cvs.puremagic.com/viewcvs/greylisting/schema/whitelist_ip.txt?rev=1.16

list "broken mta" addr {

12.5.136.141/32 # Southwest Airlines (unique sender)

12.5.136.142/32 # Southwest Airlines

163.32.250.21/32 # KH mail server
163.32.250.51/32 # Epass server
163.32.250.12/32 # kiecc.server
# 另可在底下列出安全无虞(确定不会寄广告信)的mail server IP

chkconfig --level 345 milter-greylist on
service milter-greylist start

完成修改sendmail.mc档后,产生正确的sendmail.cf

cd /etc/mail
make -C /etc/mail

避免造成MX loop back的问题,必须将这台Server的主机别称及所有主机别名登入进来

vi /etc/mail/local-host-names

设定负责转信(帮Outlook送信)的范围(RELAY)及挡掉广告信主机(DENY)

vi /etc/mail/access

Connect:localhost.localdomain RELAY
Connect:localhost RELAY
Connect:127.0.0.1 RELAY
Connect:163.18.225 RELAY
Connect:sgrsms.sg-rs.com.hk REJECT
Connect:mail.uhome.net.tw REJECT

存档后

make all
service sendmail restart

procmail广告信过滤规则
yum install procmail

vi /etc/procmailrc

MAILDIR=/var/mail
VERBOSE=off
PATH=/bin:/sbin:/usr/bin:/usr/sbin/:/usr/local/bin:/usr/local/sbin
LOGFILE=/var/log/procmail.log
# 广告信过滤机制
# 原则上因考量误判的机率较高,因为部份电子期刊也是利用相关的程式来寄发的,因此特别将这些特微的信,予以转存至特定的档案,以便日后人工确认。待确认无误后,再将设定改转存至/dev/null,以便直接删除信件,以免造成硬碟空间之浪费。
# 过滤伪装寄件者
:0 HBw
#* ^Return-Path: .*@mail.kh.edu.tw.*
* ^Received: from mail.kh.edu.tw .*
* !^Received: from mail.kh.edu.tw .*163.32.250.
* !^Received: from mail.kh.edu.tw .*163.32.119.
* !^Received: from mail.kh.edu.tw .*163.29.241.
* !^Received: from mail.kh.edu.tw .*163.29.242.
* !^Received: from mail.kh.edu.tw .*163.32.(www.111cn.net)137.
* !^Received: from mail.kh.edu.tw (localhost.localdomain [127.0.0.1])
* !^Received: from 163.32.250.21 .*163.32.250.
/home/mailfilter/spam.local
# 过滤广告信发送软体(1)
:0 HBw
* ^X-Library: (Indy.*|Dynamailer.*)
/home/mailfilter/spam.library
# 过滤广告信发送软体(2)
:0 HBw
* ^X-Mailer: (Dynamailer.*|EhooPost.*|Mail Bomber.*|QuickSender.*|made from pascual|RET.*| FoxMail*)
/home/mailfilter/spam.mailer

建立告信过滤的收集目录:
mkdir /home/mailfilter

设定后,到目录中编译

cd /etc/mail
make all
service sendmail restar

dovecot(POP、IMAP)

安装软体111cn.net

yum -y install dovecot
cp /etc/dovecot.conf /etc/dovecot.conf.bak
vi /etc/dovecot.conf

protocols = imap imaps 修改成--> protocols = pop3
ssl_disable = no 修改成--> ssl_disable = yes

重新启动

/etc/rc.d/init.d/dovecot start
chkconfig dovecot on

sendmail不能正常发邮件

发邮件内容如下:

From: =?utf-8?B?5b2x6KeG5L+x5LmQ6YOo?= <[email protected]>
X-Priority: 3
X-Mailer: UCENTER_HOME 2.0
MIME-Version: 1.0
Content-type: text/html; charset=utf-8
Content-Transfer-Encoding: base64
Message-Id: <[email protected]>
Date: Thu, 13 May 2010 15:36:20 +0800 (CST)
PHRhYmxlIGNlbGxzcGFjaW5nPSIwIiBjZWxscGFkZGluZz0iMjAiPg0KPHRyPjx0ZD4NCjx0YWJs
ZSB3aWR0aD0iNTAwIiBjZWxsc3BhY2luZz0iMCIgY2VsbHBhZGRpbmc9IjEiPg0KPHRyPjx0ZCBi
Z2NvbG9yPSIjRkY4RTAwIiBhbGlnbj0ibGVmdCIgc3R5bGU9ImZvbnQtZmFtaWx5OidsdWNpZGEg
Z3JhbmRlJyx0YWhvbWEsJ2JpdHN0cmVhbSB2ZXJhIHNhbnMnLGhlbHZldGljYSxzYW5zLXNlcmlm
O2xpbmUtaGVpZ2h0OjE1MCU7Y29sb3I6I0ZG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GU+DQo8YnI+DQo8YnI+5b2x6KeG5L+x5LmQ6YOo
PGJyPjxhIGhyZWY9Imh0dHA6Ly92Lndva2FuLmNjL2hvbWUvIiB0YXJnZXQ9Il9ibGFuayI+aHR0
cDovL3Yud29rYW4uY2MvaG9tZS88L2E+DQo8YnI+MjAxMC0wNS0xMyAxNTozNjxicj4NCjxicj7m
raTpgq7ku7bkuLrns7vnu5/oh6rliqjlj5Hlh7rnmoTpgq7ku7bvvIzor7fli7/nm7TmjqXlm57l
pI3jgIINCjwvdGQ+PC90cj48L3RhYmxlPg0KPC90ZD48L3RyPjwvdGFibGU+DQo8L3RkPjwvdHI+
DQo8L3RhYmxlPg==

显然不行,肯定有问题

找原因中

没有找到,对它的配置也不熟悉,网上没有找到方法

运行yast删除了,重新安装

linux-qebs:/srv/www/htdocs # rpm -qa | grep sendmail
sendmail-8.14.3-51.5.1.i586

sendmail -bd -q12h

vi /etc/sendmail.cf

修改配置

原来为

Timeout.ident=5s

修改后

Timeout.ident=0s

/etc/init.d/sendmail status

没有自动启动

/etc/init.d/sendmail restart

sendmail ‘aaaa‘ [email protected]

呵呵,收到,而且正常了。
from:http://www.111cn.net/sys/linux/56538.htm

时间: 2024-11-10 07:22:08

linux安装配置sendmail实现邮件发送的相关文章

Linux安装配置apache

Linux安装配置apache 1.获取软件: http://httpd.apache.org/  httpd-2.2.21.tar.gz 2.安装步骤: 解压源文件: 1 tar zvxf httpd-2.2.21.tar.gz 2 cd httpd-2.2.213 ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite 4 make5 make install 运行./configure 命令进行编译源代码,

Linux安装配置varnish web加速器

Linux安装配置varnish web加速器 Varnish是一款高性能的开源HTTP加速器,它可以来做纯粹的代理服务器,负载均衡,但varnish最主要的功能是缓存加速,也是它最出色的地方.下面介绍如何安装和使用. wget -c http://repo.varnish-cache.org/source/varnish-3.0.1.tar.gz tar xzvf varnish-3.0.1.tar.gz cd varnish-3.0.1 ./configure --prefix=/usr/l

Linux安装配置MariaDB数据库全程详解

MariaDB在很多方面强于MySQL,在Linux下如何安装MariaDB数据库成为大家比较头疼的一个问题,下面用实例为大家讲解下 MariaDB是采用Maria存储引擎的MySQL分支版本,在很多方面强于MySQL,那么在Linux下如何安装MariaDB数据库呢?下面小编就给大家介绍下Linux安装配置MariaDB数据库的方法. 说明: 操作系统:CentOS 5.10 32位 MariaDB版本:mariadb-5.5.33a MariaDB数据库存放目录:/data/mysql 准备

Linux 安装配置maven3.0 以及搭建nexus私服

一.软件准备 1.apache-maven-3.0-bin.tar.gz 下载地址:http://www.apache.org/dyn/closer.cgi/maven/binaries/apache-maven-3.0-bin.tar.gz 2.nexus-oss-webapp-1.8.0-bundle.tar.gz 下载地址:http://nexus.sonatype.org/downloads/ 二.maven安装配置 1.创建需要操作maven的用户组以及用户(如果用root用户安装不用

linux常用(一)linux 安装配置 jdk之 安装后找不到安装后的文件目录 解决

linux 安装配置 jdk 应该算是一个很基本的东西.但是我到现在才自己第一次 正式安装.果然出现了问题.. 问题就是 安装之后 找不到 安装路径 ,进而没法配置环境变量. 现象如下: 提示 already installed 之后  用find命令查找 结果还是: 没有显示/usr/java/jdk-1.6.0_27/ 这样的目录 整了很长时间搞不定 ,没别的办法  看到了 安装的包 有.bin的 也有.rpm的 所以决定先百度下 搞清楚 这两种格式有什么区别 整理如下: 用bin文件和用w

Linux安装配置php环境的方法

本文实例讲述了Linux安装配置php环境的方法.分享给大家供大家参考,具体如下: 1.获取安装文件: http://www.php.net/downloads.php php-5.3.8.tar.gz 获取安装php需要的支持文件:http://download.csdn.net/download/netlong339/1351852 libxml2-2.6.32.tar.gz 2.安装libxml2 复制代码 代码如下: tar zxvf libxml2-2.6.32.tar.gz cd l

Centos6.4安装配置sendmail

一.安装sendmail yum install -y sendmail yum install -y sendmail-cf 二. 安装salauthd //使用SMTP认证,需要安装saslauthd服务 yum install -y saslauthd (安装可能失败,直接start) //启动saslauthd服务 service saslauthd start //设置saslauthd开机自动启动 chkconfig saslauthd on 三. 配置sendmail //配置sa

Linux安装配置Flume

概述 Apache Flume是一个分布式,可靠且可用的系统,用于高效地收集,汇总和将来自多个不同源的大量日志数据移动到集中式数据存储.Apache Flume的使用不仅限于日志数据聚合.由于数据源是可定制的,因此Flume可用于传输大量事件数据,包括但不限于网络流量数据,社交媒体生成的数据,电子邮件消息以及几乎任何可能的数据源. Apache Flume是Apache Software Foundation的顶级项目,目前有两个发布代码行,版本0.9.x和1.x. 系统要求 1.Java运行时

linux 安装配置 rsync服务

本文的原文连接是: http://blog.csdn.net/freewebsys/article/details/50456670 未经博主允许不得转载. 博主地址是:http://blog.csdn.net/freewebsys 1,rsync服务 摘自:http://www.oschina.net/p/rsync 官网:https://rsync.samba.org/ 文档:https://rsync.samba.org/documentation.html rsync是类unix系统下的