POP3/SMTP/IMAP4 常用命令

POP3

连接服务器

c: telnet pop.sohu.com 110

s: +OK POP3 ready

输入用户名

c: USER ***

s: +OK

输入密码

c: PASS ***

s: +OK Authentication Succeeded

查看总状态

c : STAT

s: +OK 4 15068

注:4表示邮件总数,15068表示邮件总大小

列出每封邮件状态

c: LIST

s: 
+OK 
1 1562
2 1673
3 6443
4 5390

查看邮件ID

c: UIDL

s: 
1 170706.b69c11dd8708421b9dc05d47a5c589ef
2 161026.6464e0423ec84bc1aa8f8841e703835a
3 1438906152.V820I8ed722e9M636269.mx174.mail.sohu.com
4 welcome.0.eml
注: 前面数字表示邮件序号,后面的字符串表示邮件的id

根据序号查邮件id

c: UIDL 1
s: +OK 1 170706.b69c11dd8708421b9dc05d47a5c589ef

查看信头

c: TOP 1 0

s:
+OK 
Return-Path: <saymagic@sohu.com>
X-Original-To: saymagic@sohu.com
Delivered-To: saymagic@sohu.com
Received: from websmtp.sohu.com (unknown [10.16.57.141])
   by mx205.mail.sohu.com (Postfix) with ESMTP id 5CF4BDC022B
   for <saymagic@sohu.com>; Thu,  6 Jul 2017 17:45:31 +0800 (CST)
Received: from mx205.mail.sohu.com (unknown [10.16.22.120])
   by websmtp.sohu.com (Postfix) with ESMTP id 4659544A21
   for <saymagic@sohu.com>; Thu,  6 Jul 2017 17:45:31 +0800 (CST)
Received: from 41899455a386 (unknown [10.16.29.37])
   by mx205.mail.sohu.com (Postfix) with ESMTP id 384DEDC022B
   for <saymagic@sohu.com>; Thu,  6 Jul 2017 17:45:31 +0800 (CST)
Date: Thu, 6 Jul 2017 17:45:31 +0800 (CST)
From: saymagic <saymagic@sohu.com>
To: saymagic <saymagic@sohu.com>
Message-ID: <1499334331.74d440d1c57847e6b09eb263e515e774.saymagic@sohu.com>
Subject: sdsd
MIME-Version: 1.0
Content-Type: multipart/mixed; 
   boundary="----=_Part_485_1065173654.1499334331190"
X-Sohu-DeliverStatus: <1499334331.74d440d1c57847e6b09eb263e515e774.saymagic@sohu.com>
X-SHIP: 123.58.160.131
X-Sohu-Gateway: 1
X-Sohu-Antispam-Language: 0
X-Sohu-Antispam-Score: 10.0249998271


.

注: 1表示邮件序列号,0表示需要返回正文的行数(适合做摘要)

查看完整mime

c : RETR 1

S:
+OK 
Return-Path: <saymagic@sohu.com>
X-Original-To: saymagic@sohu.com
Delivered-To: saymagic@sohu.com
Received: from websmtp.sohu.com (unknown [10.16.57.141])
    by mx205.mail.sohu.com (Postfix) with ESMTP id 5CF4BDC022B
    for <saymagic@sohu.com>; Thu,  6 Jul 2017 17:45:31 +0800 (CST)
Received: from mx205.mail.sohu.com (unknown [10.16.22.120])
    by websmtp.sohu.com (Postfix) with ESMTP id 4659544A21
    for <saymagic@sohu.com>; Thu,  6 Jul 2017 17:45:31 +0800 (CST)
Received: from 41899455a386 (unknown [10.16.29.37])
    by mx205.mail.sohu.com (Postfix) with ESMTP id 384DEDC022B
    for <saymagic@sohu.com>; Thu,  6 Jul 2017 17:45:31 +0800 (CST)
Date: Thu, 6 Jul 2017 17:45:31 +0800 (CST)
From: saymagic <saymagic@sohu.com>
To: saymagic <saymagic@sohu.com>
Message-ID: <1499334331.74d440d1c57847e6b09eb263e515e774.saymagic@sohu.com>
Subject: sdsd
MIME-Version: 1.0
Content-Type: multipart/mixed; 
    boundary="----=_Part_485_1065173654.1499334331190"
X-Sohu-DeliverStatus: <1499334331.74d440d1c57847e6b09eb263e515e774.saymagic@sohu.com>
X-SHIP: 123.58.160.131
X-Sohu-Gateway: 1
X-Sohu-Antispam-Language: 0
X-Sohu-Antispam-Score: 10.0249998271

------=_Part_485_1065173654.1499334331190
Content-Type: text/html;charset=utf-8
Content-Transfer-Encoding: base64

PHA+c2RzZGFzZGFzZHNkc2Q8L3A+PGJyLz48YnIvPjxici8+PGRpdj48YSBocmVmPSIvL3Njb3Jl
Lm1haWwuc29odS5jb20vP3JlZj1tYWlsX3RhaWxhZCI+PGltZyAgYm9yZGVyPSIwIiBzcmM9Ii8v
YWQubWFpbC5zb2h1LmNvbS9tYWlsL2ltYWdlcy9zY29yZV9hZF9mb290MV83NTB4NzkucG5nIi8+
IDwvYT48L2Rpdj4NCjxici8+PGJyLz48YnIvPgo=
------=_Part_485_1065173654.1499334331190--

.

保持连接

c: NOOP

s: +OK NOOP

退出

c : QUIT

s : +OK byebye!

RFC文档:https://tools.ietf.org/html/rfc1939

SMTP

构建连接

c: telnet smtp.sohu.com 25

ECLO

c: EHLO smtp.sohu.com

s: 
250-zw_71_47
250-AUTH PLAIN LOGIN
250 STARTTLS

开始登录

c: AUTH LOGIN

s:
334 VXNlcm5hbWU6

输入用户名

c:  ***

s:
334 UGFzc3dvcmQ6

注:用户名需base64编码

输入密码

c:***

s: 
235 2.0.0 OK

注:密码需base64编码

邮件发送方:

c: MAIL FROM:<saymagic@sohu.com>

s: 250 2.1.0 Ok

邮件接收方

c: RCPT TO:<saymagic@sohu.com>

s: 250 2.1.5 Ok

开始发送正文

c: DATA

s: 
354 End data with <CR><LF>.<CR><LF>

发送正文

c:
TO: saymagic@sohu.com
FROM: saymagic@sohu.com
SUBJECT: test by telnet/smtp

test, just a test.

.

s:
250 2.0.0 Ok: queued as 3x3fd25ZGgzHr0hc

RFC地址:https://tools.ietf.org/html/rfc821

IMAP4

构建连接

c: telnet smtp.sohu.com 143

s:
Trying 220.181.90.34...
Connected to smtp.sohu.com.o.sohu.com.
Escape character is '^]'.
* OK IMAP4 ready

查看服务器支持的指令

c: a CAPABILITY

s:
* CAPABILITY IMAP4 IMAP4rev1 UIDPLUS IDLE AUTH=PLAIN STARTTLS
a OK completed

登录

c : a LOGIN username pass

s: a OK LOGIN completed

查看所有文件夹

c: a LIST "" "*"

s:
* LIST (\HasNoChildren \Trash) "/" "&XfJSIJZkkK5O9g-"
* LIST (\HasNoChildren \Junk) "/" "&V4NXPpCuTvY-"
* LIST (\HasNoChildren) "/" "INBOX"
* LIST (\HasNoChildren \Drafts) "/" "&g0l6P3ux-"
* LIST (\HasNoChildren \Sent) "/" "&XfJT0ZABkK5O9g-"
a OK LIST completed

查看信箱状态

c: a STATUS INBOX (MESSAGES UNSEEN RECENT)

s:
* STATUS "INBOX" (MESSAGES 1584 RECENT 3 UNSEEN 3)
a OK STATUS completed

选中信箱

c: a SELECT INBOX

s: 
* 3 RECENT
* OK [UIDVALIDITY 1] UIDs valid
* FLAGS (\Answered \Seen \Deleted \Draft \Flagged)
* OK [PERMANENTFLAGS (\Answered \Seen \Deleted \Draft \Flagged)] Limited
a OK [READ-WRITE] SELECT completed

查看信箱内邮件数量

c: a SEARCH *

s: 
* SEARCH 1584
a OK SEARCH completed

查看总邮件数量

c: a UID SEARCH *

s:
* SEARCH 1410797707
a OK SEARCH completed

注: IMAP 中包含Message Sequence Number与UID两种id概念,Message Sequence Number表示的是邮件在信箱中的id,可能发生变化(删除)。UID是邮件在该帐号下的全局ID,即使删除,服务器也应保证该id不发生变化。因此,对于SEARCH、FETCH 、STORE等命令都对应额外的UID SEARCH、UID FETCH、UID STORE 命令用来根据全局id操作邮件。后续命令都直接使用SEARCH等命令来做演示。

查看信头

c: a FETCH 1 BODY[HEADER]

s:
* 1 FETCH (BODY[HEADER] {360}
From: webmaster@sohu.com
Content-Disposition: inline
Content-Transfer-Encoding: base64
Mime-Version: 1.0
To: saymagic@sohu.com
Date: Fri, 07 Aug 2015 00:07:30 -0000
Message-Id: <20150807000730.29200.45787@mx174.mail.sohu.com>
Content-Type: text/html; charset="utf-8"
Subject: =?utf-8?b?5qyi6L+O5oKo6L+b5YWl5paw54mI5pCc54uQ6Zeq55S16YKu566x77yBDQo=?=

)
A OK FETCH completed

查看正文

c : a FETCH 1 BODY[TEXT]

s:
* 1 FETCH (BODY[TEXT] {5120}
PCFET0NUWVBFIGh0bWwgUFVCTElDICItLy9XM0MvL0RURCBYSFRNTCAxLjAgVHJhbnNpdGlvbmFs
Ly9FTiIgImh0dHA6Ly93d3cudzMub3JnL1RSL3hodG1sMS9EVEQveGh0bWwxLXRyYW5zaXRpb25h
bC5kdGQiPgo8aHRtbC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+CiAg
ICAgICAgICAgICAgPHRyPgogICAgICAgICAgICAgICAgPHRkPjxpbWcgc3JjPSJodHRwOi8vanMu
c29odS5jb20vbWFpbC93ZWxjb21lL2ltYWdlcy9kYWlzaG91LmpwZyIgd2lkdGg9IjgyIiBoZWln
aHQ9Ijg3IiAvPjwvdGQ+CiAgICAgICAgICAgICAgICA8dGQ+5L6/5o2355qE5LiA566x5aSa6YKu
5Yqf6IO977yM5oKo5Y+v5Lul5bCG5YW25LuW6YKu566x55qE6YKu5Lu25Luj5pS25Yiw5pCc54uQ
6Zeq55S16YKu566x77yM57uf5LiA566h55CG44CCPC90ZD4KICAgICAgICAgICAgICA8L3RyPgog
ICAgICAgICAgICA8L3RhYmxlPjwvdGQ+CiAgICAgICAgICA8L3RyPgogICAgICAgICAgPHRyPgog
ICAgICAgICAgICA8dGQ+Jm5ic3A7PC90ZD4KICAgICAgICAgIDwvdHI+CiAgICAgICAgICA8dHI+
CiAgICAgICAgICAgIDx0ZD7or7fmgqjlnKjmjqXkuIvmnaXnmoTml6XlrZDph4zvvIzoh7PlsJE5
MOWkqeeZu+W9leS4gOasoemXqueUtemCrueuse+8jOS7peehruS/neaCqOeahOmCrueuseato+W4
uOS9v+eUqOOAgiA8L3RkPgogICAgICAgICAgPC90cj4KICAgICAgICAgPHRyPgogICAgICAgICAg
ICA8dGQ+Jm5ic3A7PC90ZD4KICAgICAgICAgIDwvdHI+CiAgICAgICAgIDx0cj4KICAgICAgICAg
ICAgPHRkPuS6huino+abtOWkmuaIkeS7rOeahOWKqOaAge+8jOivt+iuv+mXruaQnOeLkOmXqueU
temCrueusTxhIGhyZWY9aHR0cDovL2dvdG8ubWFpbC5zb2h1LmNvbS9nb3RvLnBocD9jb2RlPXdl
bGNvbWVkbSB0YXJnZXQ9X2JsYW5rPuWKn+iDveabtOaWsOaXpeW/lzwvYT48L3RkPgogICAgICAg
ICAgPC90cj4KICAgICAgICA8L3RhYmxlPiAgICAgICAgCiAgICAgICAgIAogICAgICAgICAgPC90
ZD4KICAgICAgPC90cj4KICAgICAgPHRyIGFsaWduPSJyaWdodCI+CiAgICAgICAgPHRkIGhlaWdo
dD0iMzAiIHZhbGlnbj0idG9wIiBzdHlsZT0iZm9udC1zaXplOjE0cHg7cGFkZGluZy1yaWdodDo1
NXB4OyIgPuaQnOeLkOmCruS7tuS4reW/g+aVrOS4iiA8L3RkPgogICAgICA8L3RyPgogICAgICA8
dHI+CiAgICAgICAgPHRkPjxpbWcgc3JjPSJodHRwOi8vanMuc29odS5jb20vbWFpbC93ZWxjb21l
L2ltYWdlcy9ib3R0b20yLmpwZyIgLz48L3RkPgogICAgICA8L3RyPgogICAgPC90YWJsZT48L3Rk
PgogIDwvdHI+CjwvdGFibGU+CjwvYm9keT4KPC9odG1sPgo=
)
A OK FETCH completed

查看完整mime

c: a  FETCH 1 BODY[]

s:
* 1 FETCH (BODY[] {5466}
Content-Type: text/html; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
From: webmaster@sohu.com
To: saymagic@sohu.com
Date: Fri, 07 Aug 2015 00:07:30 -0000
Subject: =?utf-8?b?5qyi6L+O5oKo6L+b5YWl5paw54mI5pCc54uQ?=
    =?utf-8?b?6Zeq55S16YKu566x77yBDQo=?=
Message-ID: <20150807000730.29200.45787@mx174.mail.sohu.com>

PCFET0NUWVBFIGh0bWwgUFVCTElDICItLy9XM0MvL0RURCBYSFRNTCAxLjAgVHJhbnNpdGlvbmFs
Ly9FTiIgImh0dHA6Ly93d3cudzMub3JnL1RSL3hodG1sMS9EVEQveGh0bWwxLXRyYW5zaXRpb25h
bC5kdGQiPgo8aHRtbCB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94aHRtbCI+CjxoZWFk
Pgo8bWV0YSBodHRwLWVxdWl2PSJDb250ZW50LVR5cGUiIGNvbnRlbnQ9InRleHQvaHRtbDsgY2hh
cnNldD1nYjIzMTIiIC8+Cjx0aXRsZT7mkJzni5Dpl6rnlLXpgq7nrrHmrKLov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gICAgICA8L3RyPgogICAgICAgICAgPHRyPgog
ICAgICAgICAgICA8dGQ+44CA44CA5qyi6L+O5oKo6L+b5YWl5pCc54uQ6Zeq55S16YKu566x77yB
IOaQnOeLkOmXqueUtemCrueuseS7peeUqOaIt+S4uuS4reW/g++8jOiHtOWKm+S6juS4uuaCqOaP
kOS+m+abtOW/q+OAgeabtOWuieWFqOOAgeabtOaZuuiDveeahOacjeWKoeOAgjwvdGQ+CiAgICAg
ICAgICA8L3RyPgogICAgICAgICAgPHRyPgogICAgICAgICAgICA8dGQ+Jm5ic3A7PC90ZD4KICAg
ICAgICAgIDwvdHI+CiAgICAgICAgICA8dHI+CiAgICAgICAgICAgIDx0ZD48c3Ryb25nPuabtOW/
qzwvc3Ryb25nPuOAgCDjgIDpobXpnaLlk43lupTlv6vvvIzmgqjlnKjmtY/op4jjgIHpmIXor7vp
gq7ku7bml7blh6DkuY7ml6DpnIDnrYnlvoUgPGJyIC8+CiAgICAgICAgICAgIDxzdHJvbmc+5pu0
5a6J5YWoPC9zdHJvbmc+44CAIOiHtOWKm+S6juWPjeWeg+WcvumCruS7tuWSjOmYsueXheavku+8
jOiuqeaCqOaLpeacieecn+ato+eahOe7v+iJsuWutuWbrSA8YnIgLz4KICAgICAgICAgICAgPHN0
cm9uZz7mm7Tmmbrog708L3N0cm9uZz7jgIAg5Yqf6IO95LiN5pat5o6o6ZmI5Ye65paw77yM6K6p
5oKo55qE6YKu5Lu2566h55CG5pu05pm66IO9IDwvdGQ+CiAgICAgICAgICA8L3RyPgogICAgICAg
ICAgPHRyPgogICAgICAgICAgICA8dGQ+Jm5ic3A7PC90ZD4KICAgICAgICAgIDwvdHI+CiAgICAg
ICAgICA8dHI+CiAgICAgICAgICAgIDx0ZD48dGFibGUgd2lkdGg9IjEwMCUiIGJvcmRlcj0iMCIg
Y2VsbHNwYWNpbmc9IjUiIGNlbGxwYWRkaW5nPSIwIj4KICAgICAgICAgICAgICA8dHI+CiAgICAg
ICAgICAgICAgICA8d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+5L6/5o2355qE5LiA566x5aSa6YKu
5Yqf6IO977yM5oKo5Y+v5Lul5bCG5YW25LuW6YKu566x55qE6YKu5Lu25Luj5pS25Yiw5pCc54uQ
6Zeq55S16YKu566x77yM57uf5LiA566h55CG44CCPC90ZD4KICAgICAgICAgICAgICA8L3RyPgog
ICAgICAgICAgICA8L3RhYmxlPjwvdGQ+CiAgICAgICAgICA8L3RyPgogICAgICAgICAgPHRyPgog
ICAgICAgICAgICA8dGQ+Jm5ic3A7PC90ZD4KICAgICAgICAgIDwvdHI+CiAgICAgICAgICA8dHI+
CiAgICAgICAgICAgIDx0ZD7or7fmgqjlnKjmjqXkuIvmnaXnmoTml6XlrZDph4zvvIzoh7PlsJE5
MOWkqeeZu+W9leS4gOasoemXqueUtemCrueuse+8jOS7peehruS/neaCqOeahOmCrueuseato+W4
uOS9v+eUqOOAgiA8L3RkPgogICAgICAgICAgPC90cj4KICAgICAgICAgPHRyPgogICAgICAgICAg
ICA8dGQ+Jm5ic3A7PC90ZD4KICAgICAgICAgIDwvdHI+CiAgICAgICAgIDx0cj4KICAgICAgICAg
ICAgPHRkPuS6huino+abtOWkmuaIkeS7rOeahOWKqOaAge+8jOivt+iuv+mXruaQnOeLkOmXqueU
temCrueusTxhIGhyZWY9aHR0cDovL2dvdG8ubWFpbC5zb2h1LmNvbS9nb3RvLnBocD9jb2RlPXdl
bGNvbWVkbSB0YXJnZXQ9X2JsYW5rPuWKn+iDveabtOaWsOaXpeW/lzwvYT48L3RkPgogICAgICAg
ICAgPC90cj4KICAgICAgICA8L3RhYmxlPiAgICAgICAgCiAgICAgICAgIAogICAgICAgICAgPC90
ZD4KICAgICAgPC90cj4KICAgICAgPHRyIGFsaWduPSJyaWdodCI+CiAgICAgICAgPHRkIGhlaWdo
dD0iMzAiIHZhbGlnbj0idG9wIiBzdHlsZT0iZm9udC1zaXplOjE0cHg7cGFkZGluZy1yaWdodDo1
NXB4OyIgPuaQnOeLkOmCruS7tuS4reW/g+aVrOS4iiA8L3RkPgogICAgICA8L3RyPgogICAgICA8
dHI+CiAgICAgICAgPHRkPjxpbWcgc3JjPSJodHRwOi8vanMuc29odS5jb20vbWFpbC93ZWxjb21l
L2ltYWdlcy9ib3R0b20yLmpwZyIgLz48L3RkPgogICAgICA8L3RyPgogICAgPC90YWJsZT48L3Rk
PgogIDwvdHI+CjwvdGFibGU+CjwvYm9keT4KPC9odG1sPgo=
)
A OK FETCH completed

标为为读

c: a STORE 1 -FLAGS \Seen

s:
* 1 FETCH (FLAGS (\Recent))
a OK STORE completed

注:标为未读、标为红旗、删除都属于邮件的flag,都使用STORE命令来触发,所有flag整理如下:
- \Seen            已读
- \Answered   是否被回复
- \Flagged       红旗
- \Deleted       删除,后续执行EXPUNGE命令可被彻底删除
- \Draft             草稿
- \Recent         自从上次信箱被选中后新到来的邮件

Message Sequence Number转UID

c: a UID SEARCH 1000

s:
* SEARCH 1410797122
a OK SEARCH completed

UID 转Message Sequence Number

c:a SEARCH UID 1410797122

s:
* SEARCH 1000
a OK SEARCH completed

创建文件夹

c:
a CREATE MAGIC

s:
a OK mailbox created

重命名文件夹

c:
a RENAME MAGIC MAGIC_ONCE 

s:
a OK mailbox renamed

删除文件夹

c:
a DELETE MAGIC_ONCE

s:
a OK mailbox deleted

rfc文档地址:https://tools.ietf.org/html/rfc3501

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 204,921评论 6 478
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 87,635评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 151,393评论 0 338
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,836评论 1 277
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,833评论 5 368
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,685评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,043评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,694评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 42,671评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,670评论 2 321
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,779评论 1 332
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,424评论 4 321
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,027评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,984评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,214评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,108评论 2 351
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,517评论 2 343

推荐阅读更多精彩内容