Extract SMTP address from Exchange User in the FROM field of a message

前端 未结 2 1800
长情又很酷
长情又很酷 2021-01-26 17:02

I want to organize messages in folders by domain (and possibly user). I have a script but it can\'t get the SMTP addresses from exchange users. The below code is an excerpt from

2条回答
  •  囚心锁ツ
    2021-01-26 17:25

    I have a work-around that seems decently efficient.

    Const PR_TRANSPORT_MESSAGE_HEADERS = "http://schemas.microsoft.com/mapi/proptag/0x007D001E"
    
    a = Split(obj.PropertyAccessor.GetProperty(PR_TRANSPORT_MESSAGE_HEADERS), vbCrLf)
    For i = 0 To UBound(a)
        If InStr(1, a(i), "From:", vbTextCompare) = 1 Then
        MsgBox Replace(Split(a(i), "<")(1), ">", "")
        End If
    Next
    

    This pulls the SMTP address directly from the header and does not care what type of message it is.

    There still has to be a better way though...

提交回复
热议问题