1

I was fetching mails locally using win32com library but now I am using exchangelib to do the same but I cannot find a funtion equivelant to this one (item.sender.getExchangerUser().Alias) how can I do this by exchangelib ??

I am also tried this

for mailbox, contact in a.protocol.resolve_names(['anne', 'bart'], 
return_full_contact_data=True):
    print(mailbox.email_address, contact.display_name)

and it would not help .. any help please ??

hesham ahmed
  • 141
  • 1
  • 10

1 Answers1

1

I extract the alias from the raw header:

def get_alias_from_header(item):
    try:
        rawheader = item.rawheaders
        cut1 = rawheader.split("\nTo: ")[1]
        cut2 = cut1.split("<")[1]
        alias = cut2.split(">")[0]
        return alias.lower()
    except:
        return None

It is not beautiful, but it works.