added sender to maillisting in imapy

This commit is contained in:
TKE
2020-02-28 16:23:36 +01:00
parent b15019a400
commit f570c70927

View File

@@ -84,14 +84,21 @@ def decode(data):
res+= part[0].decode(part[1]) res+= part[0].decode(part[1])
return "".join(res.split()) return "".join(res.split())
def retrieve(num,field):
global im
res, data = im.fetch(num,"BODY.PEEK[HEADER.FIELDS ({})]".format(field))
x,y = data[0]
y=force_decode(y)
y=y.split(":",1)
y=y[1]
return decode(y)
def get_subject(num): def get_subject(num):
global im global im
res, data = im.fetch(num,'BODY.PEEK[HEADER.FIELDS (SUBJECT)]') # res, data2 = im.fetch(num,'BODY.PEEK[HEADER.FIELDS (FROM)]')
x,y = data[0] y=retrieve(num,"SUBJECT")
y=force_decode(y) z=retrieve(num,"FROM")
y=y[9:] return "{} von <{}>".format(y,z)
return decode(y)
def get_mail(num): def get_mail(num):
global im global im