TA的每日心情 | 慵懒 2015-12-1 10:31 |
---|
签到天数: 1 天 连续签到: 1 天 [LV.1]测试小兵
|
原本我只是想调试读取收件箱中的邮件体,所以使用先读取固定一封邮件的方式来试,开始脚本如下:
........
imap_fetch_ex(&imap1, "FetchMessages",
"Mode=",
"Fetch=2 UID", ENDITEM,
LAST);
imap_fetch_ex(&imap1, "FetchMessages",
"Mode=",
"Fetch=2 BODY[]", ENDITEM,
LAST);
imap_logout_ex(&imap1);
imap_free_ex(&imap1);
.......
固定读取一封邮件,然后就logout时会存在楼主说的问题,也是我前面遇到的问题,后面通过以下方式可以达到我预想的效果:
方式一:
........
imap_fetch_ex(&imap1, "FetchMessages",
"Mode=",
"Fetch=2 UID", ENDITEM,
LAST);
imap_fetch_ex(&imap1, "FetchMessages",
"Mode=",
"Fetch=2 BODY[]", ENDITEM,
LAST);
imap_fetch_ex(&imap1, "FetchMessages",
"Mode=",
"Fetch=1 UID", ENDITEM,
LAST);
imap_logout_ex(&imap1);
imap_free_ex(&imap1);
.......
即在读取UID为2的邮件体后面,再加一个读取UID为1的动作,这样读取该邮件夹中UID为2的邮件体,编译正常通过
方式二:
imap_fetch_ex(&imap1, "FetchMessages",
"Mode=",
"Fetch=2 UID", ENDITEM,
LAST);
imap_fetch_ex(&imap1, "FetchMessages",
"Mode=",
"Fetch=2:* BODY[]", ENDITEM,
LAST);
imap_logout_ex(&imap1);
imap_free_ex(&imap1);
即"Fetch=2 BODY[]"用"Fetch=2:* BODY[]"代替,这样读取该邮件夹中所有的邮件体,编译通过 |
|