codewalker@codehost:~

$ cat .fetchmailrc

poll pop.qq.com with proto POP3

user “你的qq号码” there with password “你的qq密码” is “本地用户名称” here

poll pop.mail.yahoo.com.cn with proto POP3

user “你的yahoo帐号不包括@后面的部分” there with password “你的yahoo密码” is “本地用户名称” here

poll pop.gmail.com with proto POP3

user “你的gmail帐号不包括@后面的部分” there with password “你的gmail密码” is “本地用户名称” here

mda “/usr/bin/procmail -d %s”

codewalker@codehost:~

$ cat .procmailrc

PATH=$HOME/bin:/usr/bin:/bin:/usr/local/bin:.

MAILDIR=$HOME/Maildir/

DEFAULT=$HOME/Maildir/

LOGFILE=$MAILDIR/procmail.log

测试 =>$ fetchmail -av

之后会在你的~/下面自动生成一个Maildir文件夹, 打印目录结构

codewalker@codehost:~

$ tree Maildir/

Maildir/

├── cur

├── new

│ ├── 1355547737.9422_0.codehost <=codehost 是我本地计算机名称

│ └── 1355547827.9453_0.codehost

├── procmail.log

└── tmp

3 directories, 3 files

这样就成功安装了。下面是我写的一个perl脚本来获取邮件同时写入零时文件,用去在conky中读取。

codewalker@codehost:~/conky

$ cat checkMail.pl

#!/usr/bin/perl

##script by codewalkertse at Dec 15 2012

use strict;

my $timeout = ‘-t 10’;

my $is_silent = ‘’;#[-s or ‘’]

my $message = ‘’;

my $tmp_file= ‘/tmp/fetchmail.message’;

my $num_color = “orange”;

my $num_font = “Digital Readout Thick Upright”;

my $num_size = “20”;

my $error_color = “red”;

$_ = `fetchmail -c $timeout $is_silent`;

if (/([1-9]{0,2}) message/ig) {

$message = 'You have ${voffset -3}${color '.$num\_color.'}${font '.$num\_font.':pixelsize='.$num_size.'}'.$1.'${font}${color}${voffset -1} mail';

}else{

$message =  '${voffset -3}Mail ${color '.$error\_color.'}${font '.$num\_font.':pixelsize='.$num_size.'}error${font}${color}';

}

open (FO, “> $tmp_file “);

print FO"$message";

close (FO);

在conky中的调用切记!切记!切记!一定是${execpi}我就是在这个地方卡了1个小时都没有办法把颜色显示出来,直接显示的是color orange 1 color

${execpi 300 cat /tmp/fetchmail.message}

最后把checkMail.pl加入计划任务就ok了

邮件我是放在左边上面的。送上一张现在的桌面截图以后有更好的脚本也会更新上来

fetchmail <wbr>命令行下的邮件客户端命令行下的邮件客户端” TITLE=”fetchmail 命令行下的邮件客户端” />