【发布时间】:2018-09-21 19:49:30
【问题描述】:
我正在尝试使用复制命令复制邮件。
imapper.copy(email.uid, 'TEST')
email.uid = 本例中的 uid 1069
TEST = 邮件所在的地图
这是我的复制功能:
def copy(self, uid, to):
#typ, content = self._mailer.copy(bytes(uid), to)
print (uid)
typ, content = self._mailer.uid('copy', bytes(1069), 'TEST')
if typ == 'OK':
mail = _parse_email(content, include_raw=include_raw)
return mail
else:
raise Exception("Could not copy email.")
由于我遇到此错误,我决定不使用变量并对其进行硬编码,直到它工作为止,然后用变量替换它。
typ, content = self._mailer.uid('copy', bytes(1069), 'TEST')
这会返回错误:
UID 命令错误:BAD [b'Could not parse command']
我已添加 bytes() 否则我会收到此错误:
TypeError: can't concat int to bytes
【问题讨论】: