|
|
第 1 帖 | |
|
|
标题: [指南]Exim4+fetchmail+mutt在debian下收发电子邮件 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,比如,我linux...mescsy@tom.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 |
|
|
|
|
|
|
|
第 2 帖 | |
|
|
好
这些天刚想用用mutt,不用自己找了,顶一个
__________________
there is common vision building our heart together, there is common hope steering our feet in a common path! |
|
|
|
|
|
|
|
第 3 帖 | |
|
|
能设置自己的smtp吗?
__________________
PII 赛阳300A,196M内存,4G硬盘,realtalk网卡两张,triend显卡,华硕mvp6主板 我的blog:[url]http://groups-beta.google.com/group/linuxroad/[/url] |
|
|
|
|
|
|
|
第 4 帖 | ||
|
|
引用:
当然可以啦,选择永远在线的选项,然后再网上查一下资料吧。 好像还是能找到的。 |
||
|
|
|
||
|
|
第 5 帖 | ||||||
|
|
谢谢共享。
楼主要是能用颜色和代码格式,会更清晰可读。 俺有几个问题 引用:
引用:
引用:
引用:
引用:
请楼主再接再厉,争取速出2.0版本。
__________________
与其咒骂黑暗不如点亮一只蜡烛。 ---------------- 12点以前睡觉; 先把必须要做的事做完; 多读自己的专业书; 开会的时候不要迟到; |
||||||
|
|
|
||||||
|
|
第 6 帖 | |
|
|
补充问题:
不知exim的邮件队列功能怎样? 如果有一个很大的邮件没有发出去,它会如何处理?会不会阻隔后面的邮件? |
|
|
|
|
|
|
|
第 7 帖 | |
|
|
网上关于简单配置exim4的资料实在太少,我也是花了好久时间才摸通了这么点点,楼上的问题,希望大家能够再接再厉,一块儿解决。
|
|
|
|
|
|
|
|
第 8 帖 | |
|
|
我按照你的设置,mutt发不了邮件阿,fetchmail也接不到邮件
发邮件时,看了exim4的日志,它显示如下: fwyxww@163.com smtp error from remote mail server after Mail FROM:<fwyxwww@163.com>: host smtp.163.split.netease.com[202.108.44.205]: 533 You are not authorized to send mail as <MAIL FROM:<fwyxww@163.com>>,authentication is requried 我已经在client.passwd里加入了用户名和密码拉,同时也按照你的muttrc文件设置拉。 不知道怎么回事 |
|
|
|
|
|
|
|
第 9 帖 | |
|
|
代码:
代码:
代码:
gmail-smtp.l.google.com:account@gmail.com asswd的格式,否则smtp的验证不会通过的代码:
那么只需要在muttrc里设置 set reverse_name=yes,注意不要使用my_hdr这个option,这个会是reverse_name失效 此帖于 05-09-18 18:00 被 halcyon79 编辑. |
|
|
|
|
|
|
|
第 10 帖 | ||
|
|
引用:
此帖于 05-09-18 18:08 被 halcyon79 编辑. |
||
|
|
|
||
|
|
第 11 帖 | ||
|
|
引用:
另外现在muttrc里并不需要设置set sendmail="/usr/sbin/exim4" 此帖于 05-09-18 18:10 被 halcyon79 编辑. |
||
|
|
|
||
|
|
第 12 帖 | |
|
|
刚才反复试验了楼主说的和楼上说的
需要指出来的以下: 1.AUTH_CLIENT_ALLOW_NOTLS_PASSWORDS=1 这个设置并不是在文件的最后,写在文件的最后丝毫不起作用。你可以查看/var/spool/exim4/mslog/文件夹里的日志,它会说认证错误。在/etc/exim4/exim4.conf.template,找到如下一段: # These examples below are the equivalent for client side authentication. # They get the passwords from CONFDIR/passwd.client. This file should have # three columns separated by colons, the first contains the name of the # mailserver to authenticate against, the second the username and the third # contains the password. ### # example for CONFDIR/passwd.client ### mail.server:blah:secret ### # default entry: ### *:bar:foo 大家可以仔细的看这一段,它说的是这个位置的配置是exim作为客户短认证时的设置,下面就是一些脚本拉,因此需要在这里设置:AUTH_CLIENT_ALLOW_NOTLS_PASSWORDS=1,这样下面的脚本才可能根据这个来 判断执行,因此,如果你加在最后,显然是不起任何作用的,因此exim4在执行玩脚本之后才看到AUTH_CLIENT_ALLOW_NOTLS_PASSWORDS=1。 2.passwd.client 上面的引用中可以看到passwd.client的设置方法,我试了一下楼主的方法,刚开始的时候设为smtp.163.com,发现不起作用,改为实际的地址smtp.163.split.netease.com可以起作用,并且你用*:longin asswd(longin是你的用户名,passwd是你的密码)是可以顺利发送的,仔细思考了一下,弄明白了,因为在执行了dpkg-reconfigure exim4-config的时候我们已经告诉了exim4邮件服务器的域名,它不需要你再告诉它, 3.mutt muttrc文件里确实不需要set sendmail="/usr/sbin/exim4",因为我们在dpkg-reconfigure exim4-config时就等于告诉系统用exim4发送邮件 4.关于乱码 如果你用的term是mlterm的话,并且locale是zh_CN.UTF-8的话,不需要进行任何设置就可以看到中文,而且你可以在里面输入中文,绝对不乱吗。 |
|
|
|
|
|
|
|
第 13 帖 | |
|
|
有关明文验证的东西我在newsmth.net上写过一篇文章是讲这个的,我看作者似乎提到了
AUTH_CLIENT_ALLOW_NOTLS_PASSWORDS=1选项,我也就没有注意。 有关passwd.client的问题,按道理来说指定了smtp.163.com应该是可以的,但是实际上不行,这个好象是exim4的一个bug,mail list上有讨论 另外乱码问题,我说的中文乱码并不是一般的中文显示不了,你慢慢用吧,总会碰到的,呵呵 |
|
|
|
|
|
|
|
第 14 帖 | |
|
|
关于明文验证,我想主要是设置3个地方:
1、AUTH_CLIENT_ALLOW_NOTLS_PASSWORDS=1,位置应该紧跟在 # Because AUTH PLAIN and AUTH LOGIN send the password in clear, we # only allow these mechanisms over encrypted connections by default. # You can set AUTH_CLIENT_ALLOW_NOTLS_PASSWORDS to allow unencrypted # clear text password authentication on all connections. 下面。(其实我自己是这么设置的,不过有看到文章说加在最后就行,我也就没有验证过了) 2、/etc/exim4/passwd.client里面的smtp服务器,一定要设置实际地址,可以通过ping smtp.xyz.com来获得该smtp服务器的真实地址。 3、~/.muttrc,mutt配置文件这里加入: set envelope_from=yes set sendmail="/usr/sbin/exim4" set from=jamescsy@tom.com(根据你自己的邮箱,跟smtp服务器对应的帐号填写) set realname="jameswang" set use_from=yes 填入from对应smtp服务器的帐号。 |
|
|
|
|
|
|
|
第 15 帖 | |
|
|
我加了 AUTH_CLIENT_ALLOW_NOTLS_PASSWORDS=1 后,配置怎么也通不过,提示错误:
configuration error in line 395 of /var/lib/exim4/config.autogenerated.tmp: authenticator name missing 打开 /etc/exim4/exim4.conf.template 找到这里: # Because AUTH PLAIN sends the password in clear, per default we only allow it # over encrypted connections. If you want to change this disable the existing # "client send" entry and enable the one below without the "if !eq{$tls_cipher}{}" # by removing the hash-mark (#) at the beginning of the line. 它的意思是说,要用明文验证,只需要把下面的带 "if !eq{$tls_cipher}{}" 的 client_send 有关的注释掉(每一行都要注释掉),再去掉不带 "if !eq{$tls_cipher}{}" 的 client_send 前的注释.结果看上去就像这样: plain: driver = plaintext public_name = PLAIN # client_send = "${if !eq{$tls_cipher}{}{\ # ^${extract{1}{::}\ # {${lookup{$host}lsearch*{CONFDIR/passwd.client}{$value}fail}}}\ # ^${extract{2}{::}\ # {${lookup{$host}lsearch*{CONFDIR/passwd.client}{$value}fail}}}\ # }fail}" client_send = "^${extract{1}{::}{${lookup{$host}lsearch*{CONFDIR/passwd.client}{$value}fail}}}^${extract{2}{::}{${lookup{$host}lsearch*{CONFDIR/passwd.client}{$value}fail}}}" 这样就行了,不需要 AUTH_CLIENT_ALLOW_NOTLS_PASSWORDS=1 另外,能通过exim发邮件后,又遇到了一个问题,一些系统内部的邮件比如root的邮件会通过exim发到 root@163.com,当然它发不出去. 这怎么办呢?
__________________
Were you wondering was the gamble worth the price? 此帖于 05-09-19 13:01 被 guoke 编辑. |
|
|
|
|
|