|
Debian下默认装的是exim4,而且也说的很清楚,唯一可以取代exim的是postfix,不推荐使用sendmail和qmail。所以,还是配置默认的exim4来的好一些。下面是我的配置过程,希望对大家能有所帮助!
#本指南指导Debian环境下,用Exim4 + fetchmail + mutt来收发电子邮件。
#需要安装的软件为:exim4, fetchmail, mutt, antiword(word转换为txt的工具)等
#假设已经apt-get安装好以上文件
本指南主要有三个步骤:
1、设置exim4,通过smarthost外发邮件;
2、设置fetchmail,接受pop邮件;
3、设置mutt,处理邮件(阅读、书写)。
首先,设置exim4:(以tom.com邮箱举例)
dpkg-reconfigure exim4-config
(1)将配置文档拆分成小文件么? 否
(2)选择“用smarthost发信;通过smtp或fetchmail接受邮件”
(3)系统邮件名称,随意;(这里我写了tom.com)
(4)要监听的入站 SMTP 连接的 IP 地址:127.0.0.1 (这样,就只有本机可以利用exim4)
(5)其它可接受的邮件目的地址:(empty)
(6)为这些主机进行邮件转发:(empty)
(7)负责处理从本机寄出的邮件的机器(smarthost):真正用来外发邮件的smtp地址
(我这里用smtp.tom.com)
(8)要在寄出的邮件中隐藏本地邮件名称吗? 是
(9)本地用户的可视域名:同(3)
(10)保持最小 DNS 查询量吗(按需拔号 Dial-on-Demand)? 否
还要修改几个配置文件:
(1)/etc/exim4/passwd.client,smtp的帐号密码设置
加入:tomsmtp.163.net:邮箱帐号:邮箱密码(这里之所以是tomsmtp.163.net,而非smtp.tom.com,是因为ping smtp.tom.com时候,会显示tomsmtp.163.net。你不是tom.com的邮箱的话,请换成您自己的smtp服务器地址)
(2)/etc/email-addresses,系统邮箱地址
加入:user: someone@isp.com
(3)/etc/exim4/exim4.conf.template,exim4配置文件
在最后加入一行:AUTH_CLIENT_ALLOW_NOTLS_PASSWORDS=1(意思是smtp的帐号密码以明文传输,因为目前大多数smtp服务器不支持tls,所以,加入这一行才能认证通过,这是关键,很多exim配置中都没提到)
(4)~/.muttrc,mutt配置文件
这里加入:
set envelope_from=yes
set sendmail="/usr/sbin/exim4"
set from=jamescsy@tom.com(根据你自己的邮箱,跟smtp服务器对应的帐号填写)
set realname="jameswang"
set use_from=yes
这样exim4算是设置好了,你可以通过mutt发邮件了。(当然,你可能需要dpkg-reconfigure exim4-config来重启一下mta,配置文件才能生效)
其次:配置fetchmail。
这个比较简单,修改~/.fetchmail文件,加入:
# Configuration created Mon Aug 29 16:08:29 2005 by fetchmailconf
set postmaster "jameswang"(改为你自己使用的linux用户名)
set bouncemail
set no spambounce
set properties ""
poll pop.zj.com
protocol POP3
user "jamescsy"
password "mypasswd"
poll pop.sina.com
protocol POP3
...
以后,在终端下输入fetchmail,就会把各个邮箱的邮件下载到/var/spool/mail/下
最后,配置mutt
(其实,刚才的~/.muttrc已经配置的差不多了,到现在位置,就已经可以通过mutt收发邮件了。)
为了和word附件的配合,需要在.muttrc中加入:
auto_view application/msword
另外,还需要在~/.mailcap中加入:
text/html; lynx -force_html %s; needsterminal;
application/msword; /usr/bin/antiword '%s'; copiousoutput; #这里用到antiword,apt-get install就行
description="Microsoft Word Text"; nametemplate=%s.doc
这样,就能够在mutt中显示word附件了。
ok |
|