[python-win32] mail Sensitivity doesn't work as expected(can not set the sensitivity label)
Steven Manross
steven at manross.net
Wed Nov 17 18:20:05 EST 2021
As best I remember, Microsoft considers the programming of Mail tasks (and most Outlook automation) as a security risk/issue, and limits your access to certain parts because so many people (malware writers) wrote stuff to programmatically abuse Outlook for unsavory (Evil?!?) purposes.
However, fear not... I have successfully and programmatically used something called Outlook Redemption to unlock these secured areas of Outlook when I have needed to do something Microsoft didn't allow you to programmatically perform in the past (I'm not the author of the software nor do I get a commission for referring people to it). I don't think I even have that software loaded anymore.
https://www.dimastr.com/redemption/home.htm
There is a "developer version" usable for free, but it is a saleable product. Read the license, use it at your own risk (since ultimately Microsoft locked certain aspects of Outlook off for a reason - and loading this product would in essence bypass those restrictions). The author of Redemption has great KB articles and examples, but most of my programming with this product was in VBScript, so I'm not going to be able to share examples in Python. A lot of what I was doing with the module was reading messages out to files or querying particular MAPI attributes for use with a Microsoft Exchange-based SpamAssassin filter - or - Monitor a mailbox for incoming emails and perform some task with the messages in a separate system (provided the message met certain criteria). The product has also been on the market for 10+ years, so it's a very mature product (NOT like a 1.0 or 0.9 version).
HTH
Steven
From: python-win32 <python-win32-bounces+steven=manross.net at python.org> On Behalf Of Victor Liu
Sent: Wednesday, November 17, 2021 7:31 AM
To: python-win32 at python.org
Subject: [python-win32] mail Sensitivity doesn't work as expected(can not set the sensitivity label)
Hi guys,
Gratitude to all the work of the library. I am trying to use it to send out some emails, but I have encountered this issue which might be a bug. It can be represented by this minimum working example.
import win32com.client
outlook = win32com.client.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = 'victor at example.com<mailto:victor at example.com>'
mail.Subject = 'Sample Email'
mail.HTMLBody = '<h3>This is HTML Body</h3>'
mail.Body = "This is the normal body"
mail.CC = 'victor at example.com<mailto:victor at example.com>'
mail.Sensitivity = 1
mail.Send()
This works well expect the mail.sensitivity =1 part, so it pops up a window to set the sensitivity label(Bear in mind, not all outlook has set up this restriction).
[Image removed by sender. image]<https://user-images.githubusercontent.com/7195126/141965903-30c23072-d41d-403a-a11c-69e6e98e9c60.png>
This makes the process is impossible to automate.
My understanding is mail.sensitivity =1 is for that Azure label. Please let me know if I missed something.
Thank you all in advance.
Victor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/python-win32/attachments/20211117/69a516d0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ~WRD0002.jpg
Type: image/jpeg
Size: 823 bytes
Desc: ~WRD0002.jpg
URL: <https://mail.python.org/pipermail/python-win32/attachments/20211117/69a516d0/attachment.jpg>
More information about the python-win32
mailing list