介绍
Exim4 是 Debian 默认的 MTA (Message Transfer Agent) ,连基本系统里面都 有它,用他自然是和系统兼容性最好的了。在 Debian 下配置 Exim 很方便,系 统提供了一个配置脚本,可以通过回答问题的方式来进行配置。
CentOS 可以考虑使用 Postfix 来代替。
安装
apt-get remove sendmail-* #卸载 Sendmail apt-get install exim4
配置
执行命令
dpkg-reconfigure exim4-config
注:进行配置,第一项选择第一个“internet site; mail is sent and received directly using SMTP”,然后一路默认 Next 即可。
修改 php.ini
vi php.ini 找到sendmail_path = ,改为sendmail_path = /usr/sbin/sendmail -t -i 如果没有就直接添加,如果已经是了就没有必要修改了
修改信息
vi /etc/exim4/update-exim4.conf.conf
dc_eximconfig_configtype='internet' dc_other_hostnames='mf8.biz' dc_local_interfaces='127.0.0.1' dc_readhost='mf8.biz' dc_relay_domains='' dc_minimaldns='false' dc_relay_nets='' dc_smarthost='' CFILEMODE='644' dc_use_split_config='false' dc_hide_mailname='' dc_mailname_in_oh='true' dc_localdelivery='mail_spool' 注:dc_other_hostnames 改为自己的vps主机名,dc_readhost 改为你的邮箱后缀
注释
注释内容来自:http://lifegoo.pluskid.org/wiki/Exim4.html
Split configuration into small files?
配置文件可以存放成一个单一文 件,也可以分类存放,各有各的好处,因为后面我们还要手工修改配置文件,这 里就选择不分割了。
General type of mail configuration
这里选择 mail sent by smarthost; recieved via SMTP or fetchmail ,就是我们要配置的类型。
System mail name
这里就让他是 localhost.localdomain 吧。乱填的话有可 能导致本地投递的邮件投递失败。
IP-address to listen on for incoming SMTP connections
我只是自己使用 用,所以这里就是默认的 127.0.0.1 就可以了。
Other destinations for which mail is accepted
这里也只填 localhost.localdomain 。
Machines to relay mail for
这里我留空了。
Machine handling outgoing mail for this host (smarthost)
这里就是填 要用来发送邮件的 SMTP 服务器的地址。我这里填上了 zjuem.zju.edu.cn 。
Hide local mail name in outgoing mail?
这个随便了。我这里选择了是。
Visible domain name for local users
由于我上一个选项选了是,它让我填 这个内容,我就胡乱填了一个 kid.org 。
Keep number of DNS-queries minimal (Dial-on-Demand)?
这里我选择了他 默认选中的 No 。
via: vobe.io