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.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?= <webmaster@m.wokan.cc>
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: <20100513073621.1981D20E333@linux-qebs.site>
Date: Thu, 13 May 2010 15:36:20 +0800 (CST)
PHRhYmxlIGNlbGxzcGFjaW5nPSIwIiBjZWxscGFkZGluZz0iMjAiPg0KPHRyPjx0ZD4NCjx0YWJs
ZSB3aWR0aD0iNTAwIiBjZWxsc3BhY2luZz0iMCIgY2VsbHBhZGRpbmc9IjEiPg0KPHRyPjx0ZCBi
Z2NvbG9yPSIjRkY4RTAwIiBhbGlnbj0ibGVmdCIgc3R5bGU9ImZvbnQtZmFtaWx5OidsdWNpZGEg
Z3JhbmRlJyx0YWhvbWEsJ2JpdHN0cmVhbSB2ZXJhIHNhbnMnLGhlbHZldGljYSxzYW5zLXNlcmlm
O2xpbmUtaGVpZ2h0OjE1MCU7Y29sb3I6I0ZGRjtmb250LXNpemU6MjRweDtmb250LXdlaWdodDpi
b2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6YOo
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' xhq6632@126.com

呵呵,收到,而且正常了。

时间: 2024-10-27 01:35:39

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

Linux安装配置php环境的方法_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

linux 安装配置lamp v2_Linux

版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章原始出版.作者信息和本声明.否则将追究法律责任.http://blog.csdn.net/mayongzhan - 马永占,myz,mayongzhan 最终安装的只有mysql+apache+php 系统里自带了zlib libxml2 libxslt libcurl openssl   经修改过后的linux安装配置lamp v2如下:   痛苦了N天啊.这东西真的很变态.N多个软件需要make 想到这里突然开始喜欢xmapp了

Linux简单配置SendMail发送邮件

本文简单整理了一下如何在Linux服务器上安装.配置SendMail发送邮件的步骤,此文不是配置邮件服务器,具体测试环境为CentOS Linux release 7.2.1511 (Core) ,如遇特殊平台有所差别,请以实际情况为准则. Linux 系统版本查看   检查.了解系统版本信息,主要是如果使用rpm安装时,需要下载合适的版本. [root@mylnx06 ~]# more /etc/redhat-release CentOS Linux release 7.2.1511 (Cor

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系统下的

Linux安装配置php环境2种方法

php安装配置方法一 1.获取安装文件: http://www.php.net/downloads.php  php-5.3.8.tar.gz   获取安装php需要的支持文件:http://download.111cn.net/download/netlong339/1351852     libxml2-2.6.32.tar.gz 2.安装libxml2 1 tar zxvf libxml2-2.6.32.tar.gz 2 cd libxml2-2.6.32 3 ./configure --

Linux安装使用Nylas N1邮件客户端教程

  Nylas N1 是一款可灵活配置并便于扩展的新型开源电子邮件客户端,这款来自旧金山的邮件程序专注于安全性,拥有直观的界面设计,并适用于所有流行的主流操作系统平台(包括 Windows/Linux/Mac). 安装和配置Nylas N1 大家先需要到官方网站下载安装包,下载网站可以自动判断用户操作系统来提供 Windows 的 .exe 安装程序或 Linux 的 .rpm 及.deb 包. Nylas N1下载网站:https://invite.nylas.com/download/ Ub

Linux安装配置memcached并启用PHP支持

最近在服务器上部缓存系统,记录一下PHP安装memcached扩展. # 安装服务端 yum install memcached -y I. launchpad 请于https://launchpad.net/libmemcached/+download下载目前最新版的libmemcached(20150524) cd /tmp wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar

linux安装配置免费杀毒软件Clam AntiVirus教程

Clam AntiVirus(ClamAV)是免费而且开放源代码的防毒软件,软件与病毒码的更新皆由社群免费发布.目前ClamAV主要是使用在由Linux.FreeBSD等Unix-like系统架设的邮件服务器上,提供电子邮件的病毒扫描服务. 安装 Clam AntiVirus 由于Clam Antivirus不存在于CentOS中yum的官方库中,所以用yum安装Clam Antivirus需要定义非官方的库.请先确认相应非官方库文件的存在. [root@sample ~]# ls -l /et

Linux 安装配置 Apache

Apache是世界使用排名第一的Web服务器软件.它可以运行在几乎所有广泛使用的计算机平台上,由于其跨平台和安全性被广泛使用,是最流行的Web服务器端软件.同时Apache音译为阿帕奇. 本文以在系统Red Hat Enterprise Linux Server release 7.1 (Maipo)上安装apache_2.4.16为例进行基本的安装配置说明. 官网地址:http://httpd.apache.org/ 本文使用的apache下载地址:http://apache.fayea.co