1) [root@cnsLinux Desktop]# fetchmail -u Tom -p POP3 pop3.163.com -k -l 300000 -t 2 -L /var/log/fetchmail.log --postmaster root
-k 收邮件时邮件保留在服务器上
-u Tom 邮箱用户名
-p POP3 pop3.163.com 邮箱的pop3服务器
-l 300000 只收取小于300k的邮件
-t 180 如果服务器反应超过180秒即断开连接
-L /var/log/fetchmail.log 日志文件目录
--postmaster root 把没有适当接收人的邮件, 转寄给root
2) [root@cnsLinux Desktop]# cat ~/.fetchmailrc
#fetchmail失败后通知root帐户
set postmaster "root"
#设置pope服务器
poll pop3.163.com with proto POP3
#用户名和密码
user "Tom" there with password "123456" is root here
#获取所有的新信件
options fetchall
3) 以常驻服务的方式执行fetchmail, 并设置每隔300秒检查邮件服务器上的邮件, 设置时一般应设置好~/.fetchmailrc
[root@cnsLinux Desktop]# ls ~/.fetchmailrc -l
-rwx------ 1 root root 167 06-08 11:06 /root/.fetchmailrc
[root@cnsLinux Desktop]# fetchmail -k -d 300 -L fetchmail.log
fetchmail: WARNING: Running as root is discouraged.
[root@cnsLinux Desktop]# cat fetchmail.log
fetchmail: starting fetchmail 6.3.7 daemon
取消常驻服务
[root@cnsLinux Desktop]# fetchmail -q
fetchmail: WARNING: Running as root is discouraged.
fetchmail: background fetchmail at 4626 killed.