Consulting

Results 1 to 5 of 5

Thread: Scrape "Certified Mail" Permission from Outlook using VBA

  1. #1
    VBAX Newbie
    Joined
    Oct 2020
    Posts
    2
    Location

    Scrape "Certified Mail" Permission from Outlook using VBA

    Hi all, having a terrible time trying to figure this one out. When you send an email in Outlook, if you go under permissions and send it with certified mail, it will send to the recipient and display a little blurb about how it's certified mail along the top of the email.

    I need to scrape emails using VBA and record ones that are certified mail. This is what I have so far. I've tried Multipartsigned and other variations of message classes but nothing has worked so far, I'm hoping someone can help me out? Much appreciated for any ideas!

    Set OutlookSetFolder = OutlookSetNameSpace.GetDefaultFolder(6) ' 6 for Inbox folder

    Set objAllMails= OutlookSetFolder.Items

    MailProperty="'IPM.Note.SMIME'"

    MailPropertyValue= "John Smith"

    filter = "[MessageClass] = " & MailProperty & " AND [From] = '" & MailPropertyValue & "'"

    Set ObjFilteredMails=objAllMails.Restrict(filter)

  2. #2
    VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,442
    Location
    Cross-posted at: https://www.tek-tips.com/viewthread.cfm?qid=1806280
    Please read VBA Express' policy on Cross-Posting in Rule 3: http://www.vbaexpress.com/forum/faq...._new_faq_item3
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    VBAX Newbie
    Joined
    Oct 2020
    Posts
    2
    Location
    Thank you for letting me know, first time posting anywhere, will report the other post to be removed.

  4. #4
    To scrape "Certified Mail" permissions from Outlook using VBA, use the following concise script:
    Sub ScrapeCertifiedMail()
        Dim OutlookApp As Object
        Dim Inbox As Object
        Dim Mail As Object
        Dim Items As Object
        Dim i As Integer    
        ' Initialize Outlook objects
        Set OutlookApp = CreateObject("Outlook.Application")
        Set Inbox = OutlookApp.GetNamespace("MAPI").GetDefaultFolder(6)
        Set Items = Inbox.Items    ' Loop through emails
        For i = 1 To Items.Count
            Set Mail = Items(i)
           ' Identify certified mail
           If Mail.MessageClass = "IPM.Note.SMIME" Then 
               Debug.Print "Certified Mail: " & Mail.Subject
           End If
        Next i
    End Sub
    This script identifies emails marked as certified mail by checking the message class.
    Last edited by Aussiebear; 09-28-2024 at 12:43 PM. Reason: Indented code sample

  5. #5
    VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,442
    Location
    This thread was last active four years ago. The subject matter is unlikely to be a current concern.

    Kindly also don't include commercial links in your posts: doing so is liable to result in your account being suspended or even terminated.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •