LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
12
返回列表 发新帖
楼主: jamescsy

[指南]Exim4+fetchmail+mutt在debian下收发电子邮件

[复制链接]
发表于 2005-9-18 18:07:18 | 显示全部楼层
Post by jamescsy
Debian下默认装的是exim4,而且也说的很清楚,唯一可以取代exim的是postfix,不推荐使用sendmail和qmail。所以,还是配置默认的exim4来的好一些。下面是我的配置过程,希望对大家能有所帮助!

其实你现在说的还不够啊,这个配置的mutt具有了基本的功能,不过有很多都没有设置好,用起来会很不舒服,到时候可能碰到中文乱码、主题乱码等诸多问题的;另外mutt和procmail bogofilter接合对邮件、mail list分类、垃圾邮件过滤等,其实工作还是很多的;

另外现在muttrc里并不需要设置set sendmail="/usr/sbin/exim4"
回复 支持 反对

使用道具 举报

发表于 2005-9-18 20:22:58 | 显示全部楼层
刚才反复试验了楼主说的和楼上说的
需要指出来的以下:
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:passwd(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的话,不需要进行任何设置就可以看到中文,而且你可以在里面输入中文,绝对不乱吗。
回复 支持 反对

使用道具 举报

发表于 2005-9-18 20:43:47 | 显示全部楼层
有关明文验证的东西我在newsmth.net上写过一篇文章是讲这个的,我看作者似乎提到了
AUTH_CLIENT_ALLOW_NOTLS_PASSWORDS=1选项,我也就没有注意。

有关passwd.client的问题,按道理来说指定了smtp.163.com应该是可以的,但是实际上不行,这个好象是exim4的一个bug,mail list上有讨论

另外乱码问题,我说的中文乱码并不是一般的中文显示不了,你慢慢用吧,总会碰到的,呵呵
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-9-19 09:23:45 | 显示全部楼层
关于明文验证,我想主要是设置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服务器的帐号。
回复 支持 反对

使用道具 举报

发表于 2005-9-19 12:42:44 | 显示全部楼层
我加了 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,当然它发不出去. 这怎么办呢?
回复 支持 反对

使用道具 举报

发表于 2005-9-21 18:24:47 | 显示全部楼层
最后的问题解决了,把 系统邮件名称 改成 自己的主机名.
就是/etc/mailname里的
回复 支持 反对

使用道具 举报

发表于 2007-9-21 17:09:04 | 显示全部楼层
很好,赞一个!今天我也用Mutt+Fetchmail+Exim4收发电子邮件了!谢谢!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表