我真的开始掌握 IMAPClient 的窍门了。代码:'BODY[HEADER.FIELDS (FROM)]'
返回
From: First Last <first.last@domain.com>
我真的很希望它返回这样的电子邮件地址:
first.last@lbox.com
我需要先将它传递给一个变量并修剪它还是fetch
我可以使用另一个修饰符?
response = server.fetch(messages, ['FLAGS', 'RFC822.SIZE', 'BODY[HEADER.FIELDS (FROM)]'])
for msgid, data in response.iteritems():
print ' ID %d: %d bytes, From: %s flags=%s' % (msgid,
data['RFC822.SIZE'],
data['BODY[HEADER.FIELDS (FROM)]'],
data['FLAGS'])