- 论坛徽章:
- 0
|
SMTP不是主要用来发邮件的么?
试了下Net: OP3,有个问题咨询下。
试了qq邮箱和163邮箱,对login返回的message数量一直搞不懂。
先通过QQ邮箱和163把邮件全部标记为已读,试下面的例子为什么会返回出XX封邮件啊?
是qq邮箱客户端等标记后pop3服务器上邮件状态不变么?还是说这个message返回有其他的规则?
麻烦哪位帮忙解答下,谢谢!
- my $host="pop.163.com";
- my $pop3conn=Net::POP3->new($host);
- print "The pop3 Server is : " . $pop3conn->host() . "\n";
- print "The banner is : " . $pop3conn->banner() . "\n";
- my $username="xxxxx\@163\.com";
- my $password="xxxxx";
- my $nummsgs = $pop3conn->login($username,$password);
- if ($nummsgs > 0) {
- print "You've Got Mail!\n";
- print "$nummsgs\n";
- # foreach my $msg (keys %{$messages}) {
- # print "Message $msg is $messages->{$msg} bytes\n";
- # }
- for (my $i=1;$i<=$nummsgs;$i++) {
- # my $message = $pop3conn->get($i);
- my $message = $pop3conn->top($i);
- print "Message $i: ";
- print grep (/^Date:/, @{$message});
- # print "@{$message}";
- print "retrieved message $i\n";
- }
复制代码 执行结果:
The pop3 Server is : pop.163.com
The banner is : Welcome to coremail Mail Pop3 Server (163coms[8db726ec93e9d4e3e9a2fd3d31b05251s])
You've Got Mail!
18
Message 1: Date: Mon, 19 Nov 2012 23:38:39 +0800
retrieved message 1
Message 2: Date: Mon, 3 Dec 2012 04:06:27 +0800
retrieved message 2
Message 3: Date: Tue, 25 Dec 2012 22:08:57 +0800
retrieved message 3
Message 4: Date: Wed, 23 Jan 2013 02:27:16 +0800
retrieved message 4
Message 5: Date: 30 Jan 2013 03:13:22 +0800
retrieved message 5
Message 6: Date: Fri, 15 Feb 2013 04:23:16 +0800
retrieved message 6
Message 7: Date: Fri, 01 Mar 2013 11:14:21 +0800
retrieved message 7
Message 8: Date: Sun, 10 Mar 2013 23:51:06 +0800
retrieved message 8
Message 9: Date: Fri, 29 Mar 2013 15:02:00 +0800
retrieved message 9
Message 10: Date: Mon, 01 Apr 2013 18:34:45 +0800 (CST)
retrieved message 10
Message 11: Date: Mon, 15 Apr 2013 05:18:43 +0800 (CST)
retrieved message 11
Message 12: Date: Wed, 17 Apr 2013 09:28:32 +0800 (CST)
retrieved message 12
Message 13: Date: Fri, 19 Apr 2013 12:13:10 +0800 (CST)
retrieved message 13
Message 14: Date: Tue, 23 Apr 2013 07:04:10 -0500
retrieved message 14
Message 15: Date: Wed, 24 Apr 2013 17:24:17 +0800
retrieved message 15
Message 16: Date: Sun, 28 Apr 2013 11:03:45 +0800
retrieved message 16
Message 17: Date: Sun, 28 Apr 2013 18:48:07 +0800 (CST)
retrieved message 17
Message 18: Date: Tue, 30 Apr 2013 08:50:38 +0800 (CST)
retrieved message 18
回复 4# anyevent
|
|