Log in

View Full Version : Scrape "Certified Mail" Permission from Outlook using VBA



KM88
10-05-2020, 08:54 AM
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)

macropod
10-05-2020, 07:49 PM
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.php?faq=new_faq_item#faq_new_faq_item3

KM88
10-06-2020, 06:09 AM
Thank you for letting me know, first time posting anywhere, will report the other post to be removed.

Wendy Dolan
09-28-2024, 04:11 AM
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.

macropod
09-28-2024, 04:28 AM
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.