下面代码段是关于python从mailbox打印电子邮件的的代码。
import mailbox
mailboxname = “/tmp/mymailbox”
mbox = mailbox.UnixMailbox(open(mailboxname))文章来源:https://www.toymoban.com/news/detail-408821.html
msgcounter = 0
while 1:
mailmsg = mbox.next()
if not mailmsg:
break
msgcounter = msgcounter + 1
messagebody = mailmsg.fp.read()
print messagebody
print
print “The message counter is %d” % (msgcounter)文章来源地址https://www.toymoban.com/news/detail-408821.html
到了这里,关于python从mailbox打印电子邮件的源码的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!