IMAP常用命令汇总
2016-06-23 11:29
302 查看
转自http://busylog.net/telnet-imap-commands-note/
Sometimes I need to debug issues on email box… manually on IMAP port.
Sometimes I need to see my notes.
Here some notes just to use as cut&modify&paste.
>(extra notes here)<
Example :
axyz login test@dom.it p4ssw0rd
axyz OK login successful
where <RandomStringID> is chars axyz or
simply char a
A command, usually, has to be executed in the proper sequence and only if IMAP automa has the correct status for that command.
In sequence…
system defined folder is “INBOX”.
Format : ‘LIST “(folder directory)” “(search argument)”.
“(search argument)” is case-sensitive and accept
*
“(folder directory)” if empty list shows all content from
root
(=> all folder)
(=> folder
“folder-name-1”)
(=> all
folder fol*)
(=> number
of MESSAGES)
(=>number
of MESSAGES and number flaged as UNSEEN RECENT)
see more about flags at end of this post #3 and #4
below.
see more about flags at end of this post #3 and #4
below.
(=> list
all emails and show flags)
(=> list
all emails and show internal date)
(=> show
email with UID 1)
see more about flags at end of this post #3 and #4
below.
=> all
emails :
=> all
emails showing from, to, subject and date :
=> all
emails showing from, to, subject and date :
Set massivelly (bulk set) flags such as read, unread …
Emails wich are set as “deleted” are actually still present in “trash” folder.
If you need to delete them you have to run “EXPURGE” command.
\Seen Message has been read
\Answered Message has been answered
\Flagged Message is “flagged”for urgent/special
attention
\Deleted Message is “deleted”for removal
by later EXPUNGE
\Draft Message has not completed composition
\Recent Message has arrived since the previous
time this mailbox was selected.
Some commands (store 1:*) have possibility to specify range (for example STORE command).
Possible sequences :
1:*
2,4,5,6,7,9,12,13,14,15
*:3,8,0
sequence-set
= (seq-number / seq-range) *(“,”sequence-set)
; set of seq-number values, regardless
of order.
; Servers MAY coalesce overlaps and/or
execute the
; sequence in any order.
; Example: a message sequence number
set of
; 2,4:7,9,12:* for a mailbox with 15
messages is
; equivalent to 2,4,5,6,7,9,12,13,14,15
; Example: a message sequence number
set of *:4,5:7
; for a mailbox with 10 messages is
equivalent to
; 10,9,8,7,6,5,4,5,6,7 and MAY be reordered
and
; overlap coalesced to be 4,5,6,7,8,9,10.
Sometimes I need to debug issues on email box… manually on IMAP port.
Sometimes I need to see my notes.
Here some notes just to use as cut&modify&paste.
>(extra notes here)<
#0 IMAP PORT 143
telnet <IP> 143
#1 Commands format
Command Input : <RandomStringID> Command
Answer : <RandomStringID> OK <ANSWER DETAIL>
Example :
axyz login test@dom.it p4ssw0rd
axyz OK login successful
where <RandomStringID> is chars axyz or
simply char a
#2 Commands:
A command, usually, has to be executed in the proper sequence and only if IMAP automa has the correct status for that command.In sequence…
2.1 Login Authorization
telnet <SERVER> 143 Trying <SERVER-IP>... Connected to <SERVER-IP> Escape character is '^]'. * OK IMAP4 server ready
a login <username>@<domain> <password> a OK login successful
2.2 CAPABILITY
a capability * CAPABILITY IMAP4rev1 UIDPLUS IDLE LOGIN-REFERRALS NAMESPACE QUOTA CHILDREN ... a OK capabilities listed
2.3 LIST of folder
system defined folder is “INBOX”.Format : ‘LIST “(folder directory)” “(search argument)”.
“(search argument)” is case-sensitive and accept
*
“(folder directory)” if empty list shows all content from
root
(=> all folder)
a LIST "" "*" * LIST (HasNoChildren) "/" folder-name-1 * LIST (HasNoChildren) "/" folder-name-2 * LIST (HasChildren) "/" folder-name-3 * LIST (HasNoChildren) "/" folder-name-1/folder-name-1.2 ... * LIST (HasNoChildren) "/" INBOX ... * LIST (HasNoChildren) "/" Trash a OK LIST completed
(=> folder
“folder-name-1”)
a LIST "folder-name-1" "*" * LIST (HasNoChildren) "/" folder-name-1/folder-name-1.2 a OK LIST completed
(=> all
folder fol*)
a LIST "" "fol*" * LIST (HasNoChildren) "/" folder-name-1 * LIST (HasNoChildren) "/" folder-name-2 * LIST (HasChildren) "/" folder-name-3 * LIST (HasNoChildren) "/" folder-name-1/folder-name-1.2 a OK LIST completed
2.4 Status of a Folder
(=> numberof MESSAGES)
a STATUS INBOX (MESSAGES) * STATUS INBOX (MESSAGES 22) a OK STATUS complete
(=>number
of MESSAGES and number flaged as UNSEEN RECENT)
see more about flags at end of this post #3 and #4
below.
a STATUS INBOX (MESSAGES UNSEEN RECENT) * STATUS INBOX (MESSAGES 22 RECENT 0 UNSEEN 0) a OK STATUS complete
2.5 SELECT a folder on which work
a SELECT INBOX * 22 EXISTS * 0 RECENT * FLAGS (Answered Flagged Deleted Seen Draft ) * OK [PERMANENTFLAGS (Answered Flagged Deleted Seen Draft)] flags can be changed * OK [UIDVALIDITY 1339682095] mailbox UID validity * OK [UIDNEXT 745] predicted next UID a OK [READ-WRITE] SELECT complete
2.6 LIST of emails
see more about flags at end of this post #3 and #4below.
(=> list
all emails and show flags)
a fetch 1:* flags * 1 FETCH (FLAGS (Seen)) * 2 FETCH (FLAGS (Seen)) a OK FETCH complete
(=> list
all emails and show internal date)
a fetch 1:* INTERNALDATE * 1 FETCH (INTERNALDATE "13-Jun-2012 11:04:18 +0200") * 2 FETCH (INTERNALDATE "20-Aug-2012 16:29:21 +0200") ... * 22 FETCH (INTERNALDATE "23-Oct-2012 15:31:05 +0200") a OK FETCH complete
(=> show
email with UID 1)
a fetch 1 body[header] * 1 FETCH (BODY[HEADER] {1316} Return-Path: <rmsbox@test1.priv> ... email ... a OK FETCH complete
… Other examples which use “UID Range”
see more about flags at end of this post #3 and #4below.
=> all
emails :
a fetch 1:* body[header]
=> all
emails showing from, to, subject and date :
a fetch 1:* (body[header.fields (from to subject date)])
=> all
emails showing from, to, subject and date :
a fetch 1:* (body[header.fields (subject)])
2.7 SET FLAG Massively
Set massivelly (bulk set) flags such as read, unread …a store 1:* +flags seen ... set read all emails a store 1:* -flags seen ... set unread all emails a store 10:100 +flags seen ... set as read emails from 10 to 100 (meaning as UID range) a store 22 +flags deleted ... set as deleted email 22 (meaning as UID 22) a store 22 -flags deleted ... retore, undelete ... email 22 (meaning as UID 22)
2.5 EXPURGE
Emails wich are set as “deleted” are actually still present in “trash” folder.If you need to delete them you have to run “EXPURGE” command.
a expunge * 2 EXPUNGE a OK EXPUNGE complete
#3 List of Flags
\Seen Message has been read\Answered Message has been answered
\Flagged Message is “flagged”for urgent/special
attention
\Deleted Message is “deleted”for removal
by later EXPUNGE
\Draft Message has not completed composition
\Recent Message has arrived since the previous
time this mailbox was selected.
#4 UID Range
Some commands (store 1:*) have possibility to specify range (for example STORE command).Possible sequences :
1:*
2,4,5,6,7,9,12,13,14,15
*:3,8,0
sequence-set
= (seq-number / seq-range) *(“,”sequence-set)
; set of seq-number values, regardless
of order.
; Servers MAY coalesce overlaps and/or
execute the
; sequence in any order.
; Example: a message sequence number
set of
; 2,4:7,9,12:* for a mailbox with 15
messages is
; equivalent to 2,4,5,6,7,9,12,13,14,15
; Example: a message sequence number
set of *:4,5:7
; for a mailbox with 10 messages is
equivalent to
; 10,9,8,7,6,5,4,5,6,7 and MAY be reordered
and
; overlap coalesced to be 4,5,6,7,8,9,10.
相关文章推荐
- PHP基于imap获取邮件实例
- xampp连接ssl后,用php发邮件,显示成功,但邮箱中没看到邮件
- nginx 代理imap pop smtp
- MAC OS的Mail使用教程(1)
- MAC OS的Mail使用教程(2)
- 邮箱客户端设置
- C#使用 LumiSoft.Net.dll 通过IMAP 登陆QQ邮箱读取未读邮件
- JavaMail介绍
- 邮件服务器端口协议
- JavaMail学习笔记(五)使用IMAP协议接收并解析电子邮件
- Outlook2013客户端配置Exchange2013邮箱帐户
- Foxmail 7 客户端配置 Exchange2013 邮箱帐户
- [Linux] 邮件服务器的工作原理
- 你真的会用email?
- 使用JavaMail接收邮件的示例
- openssl 使用IMAP接收邮件
- 【Android应用场景】Android开发邮箱APP(二)
- JavaMail通过IMAP和POP3接收未读以及设置已读邮件
- android pop3与imap方式接收邮件(javamail)
- JavaMail通过IMAP和POP3接收未读以及设置已读邮件