指示电子邮件的类型

2024-03-28 23:20:16 发布

您现在位置:Python中文网/ 问答频道 /正文

我有以下自动化程序,通过添加特定链接将电子邮件发送给我自己:

import win32com.client as win32
import easygui
import tkinter as to
from tkinter import filedialog
import pywinauto
import pywinauto.controls
from pywinauto.application import Application

### easygui commands asking user for the inputs
fieldNames_text= ['','']
fieldNames= ['Subject','Link']
INPUT = easygui.multenterbox('Please fill in', 'FIN and PASSWORD', fieldNames, fieldNames_text)
answer = easygui.ynbox('Any attachement?', 'Attachement', ('Yes', 'No'))

### outlook handling
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = 'name.surname@company.com'
mail.Subject = INPUT[0]
mail.Body = INPUT[1]

### attachment addition
if answer == True:
    root = tk.Tk()
    root.withdraw()
    file_path = filedialog.askopenfilename()

    mail.Attachments.Add(file_path)
else:
    pass

### mail sending
mail.Send()

但是,根据公司规则,用户应指明电子邮件的类型(公开、一般、机密等)

这应该在outlook消息窗格本身中定义:

enter image description here

win32outlook处理中是否有指示电子邮件类型的方法


Tags: textfromimportinputapplicationtkinterasmail
1条回答
网友
1楼 · 发布于 2024-03-28 23:20:16

使用MailItem.Sensitivity属性,该属性在OlSensitivity enumeration中设置一个常数,指示Outlook项目的敏感度

示例

mail.Sensitivity = 3
mail.Send()

+        +   -+          +
|      Name      | Value |    Description     |
+        +   -+          +
| olConfidential |     3 | Confidential       |
| olNormal       |     0 | Normal sensitivity |
| olPersonal     |     1 | Personal           |
| olPrivate      |     2 | Private            |
+        +   -+          +

相关问题 更多 >