fetchmail是一个下载邮件的应用程序.他支持POP2,POP3,APOP,IMAP以及ETRN-capable server.他与其他收件程序(Pine,popclient等等)最大的不同是在从邮件服务器获得邮件后不是直接存入本地信箱,而是将邮件送入本地邮件系统进行再次投递. fetchmail近期更新速度很快,最新版本是4.7.0.新老版本的配置文件格式有所不同,下面主要是针对redhat-5.1带的 fetchmail-4.6.5-1进行介绍,其他版本的fetchmail可能有些差异.最新的fetchmail可以在 sunsite.unc.edu以及其mirror站点找到.
简单介绍一下fetchmail的使用方法.
fetchmail可以直接从命令行运行,最简单的用法: % fetchmail -p POP3 -u isee dns.nuaa.edu.cn isee是账户,dns.nuaa.edu.cn是邮件服务器,使用POP3协议.
如果只是想检查邮件可以 % fetchmail -p POP3 -u isee -c dns.nuaa.edu.cn -c(--check)就是只检查而不真正取信.
下面是一些常用的fetchmail命令行参数: -?, --help 显示帮助 -V, --version 显示版本号 -c, --check 检查信箱 -s, --silent 安静执行,及不输出任何信息 -v, --verbose 调试输出,会输出很详尽的运行信息 -d, --daemon 以守护进程方式运行 -L, --logfile 指定log文件 --syslog 使用系统log(syslog) -f, --fetchmailrc 指定运行控制文件 -I, --interface 指定网络界面 -p, --potocol 指定下载协议 -P, --port 指定端口号 -a, --all 下载所有邮件,包括老邮件 -K, --nokeep 下载后删除服务器上邮件 -k, --keep 下载后保留服务器上邮件 -F, --flush 删除服务器上老的邮件 -l, --limit 不下载超过指定大小的邮件 -B, --fetchlimit 指定一次最多下载多少邮件 -r, --folder 指定远程文件夹名
象其他unix程序一样,~/.fetchmailrc是fetchmail的缺省配置文件.配制文件中的关键字一般都和命令行参数有对应关系.命令行参数的优先级要高于配制文件.
下面是个配制文件的例子: # Configuration created Fri Nov 6 19:36:16 1998 by fetchmailconf set syslog set postmaster "isee" poll 202.119.64.127 with proto POP3 and options envelope Delivered-To user "mere" there with password "xxxxxxx" is isee@snail.home here no keep user "isee" there with password "yyyyyyy" is isee@snail.home here no keep
配制文件的语法非常简单,#号开头的行作为注释,同时忽略所有的there", "here", "and", "with", "has", "wants", "options" 这些单词在配制文件中只是起增加可读性的作用.
上面配制文件实际上就是 set syslog set postmaster "isee" poll 202.119.64.123 proto POP3 envelope Devlivered-To user "mere" with password "xxxxxxx" is isee@snail.home no keep user "isee" with password "yyyyyyy" is isee@snail.home no keep
意思就是使用系统log,Postmaster为isee(主要是投递发生错误时回信的from地址) Mail server是202.119.64.123 在受到的邮件中加Develivered-To标签. 邮件账户是mere,口令是xxxxxx,转发给isee@snail.home 邮件账户是isee,口令是yyyyyy,转发给isee@snail.home 都不用在mail服务器上保留邮件.
下面列表是配制文件常用的Keyword
Keyword Opt 功能 ------------------------------------------------------------------ set logfile 制定log文件 set syslog 使用系统log文件 via 指定DNS机器名来取代poll中的机器明 proto -p 指定协议 port -P 指定端口 timeout -t 指定超时时间 interface -I 指定网络界面 user -U 指定远程用户 is 将本地用户和远程用户联系起来 to 同is pass 口令 folder -r preconnect 连接开始前执行的外部命令 postconnect 连接结束后执行的外部命令 keep -k flush -F fetchall -a no keep -K no flush
以上只是对fetchmail的简单介绍,Fetchmail还有其他很多强大的功能,比如子信箱支持,对qmail虚拟主机后缀的支持等等.
要了解更多的fetchmail信息可以阅读man fetchmail及相关文档.
|