C# Outlook 不会在备用视图中加载 css
C# Outlook doesn't load css in alternate view
如题。我使用 Outlook 作为电子邮件程序,使用 SmtpClient 和 MailMessage 来发送电子邮件。我还添加了 AlternateViews,例如 "text/calendar"(.ics 文件)和 "text/html",这是一个 html 文档(我的意思是它具有所有标签:<html>,<head>,<body>
)。第二个备用视图 (html) 不加载 css(css 我位于 <head><style> my css </style>
)。 <body>
的内容是动态交换的。 MailMessage.Body
是 null
。当我一个备用视图(只有 html,没有 ics 文件)时,css 正在加载。我试图添加 css 作为另一个替代视图和附件。它不起作用。怎么做?
它适用于 Outlook Web App,但如何在 Outlook 中执行此操作?
Outlook 使用 Word 呈现 HTML 标记。您可以在以下文章中了解受支持和不受支持的 HTML 元素、属性和级联样式表属性:
- Word 2007 HTML and CSS Rendering Capabilities in Outlook 2007 (Part 1 of 2)
- Word 2007 HTML and CSS Rendering Capabilities in Outlook 2007 (Part 2 of 2)
Outlook 中的约会项目使用正文的 RTF 标记,而不是 HTML。请参阅 RTFBody 属性,其中 returns 一个字节数组,以 RTF 格式表示 Microsoft Outlook 项目的正文。
Sub GetRTFBodyForMeeting()
Dim oAppt As Outlook.AppointmentItem
Dim strRTF As String
If Application.ActiveInspector.CurrentItem.Class = olAppointment Then
Set oAppt = Application.ActiveInspector.CurrentItem
strRTF = StrConv(oAppt.RTFBody, vbUnicode)
Debug.Print strRTF
End If
End Sub
如题。我使用 Outlook 作为电子邮件程序,使用 SmtpClient 和 MailMessage 来发送电子邮件。我还添加了 AlternateViews,例如 "text/calendar"(.ics 文件)和 "text/html",这是一个 html 文档(我的意思是它具有所有标签:<html>,<head>,<body>
)。第二个备用视图 (html) 不加载 css(css 我位于 <head><style> my css </style>
)。 <body>
的内容是动态交换的。 MailMessage.Body
是 null
。当我一个备用视图(只有 html,没有 ics 文件)时,css 正在加载。我试图添加 css 作为另一个替代视图和附件。它不起作用。怎么做?
它适用于 Outlook Web App,但如何在 Outlook 中执行此操作?
Outlook 使用 Word 呈现 HTML 标记。您可以在以下文章中了解受支持和不受支持的 HTML 元素、属性和级联样式表属性:
- Word 2007 HTML and CSS Rendering Capabilities in Outlook 2007 (Part 1 of 2)
- Word 2007 HTML and CSS Rendering Capabilities in Outlook 2007 (Part 2 of 2)
Outlook 中的约会项目使用正文的 RTF 标记,而不是 HTML。请参阅 RTFBody 属性,其中 returns 一个字节数组,以 RTF 格式表示 Microsoft Outlook 项目的正文。
Sub GetRTFBodyForMeeting()
Dim oAppt As Outlook.AppointmentItem
Dim strRTF As String
If Application.ActiveInspector.CurrentItem.Class = olAppointment Then
Set oAppt = Application.ActiveInspector.CurrentItem
strRTF = StrConv(oAppt.RTFBody, vbUnicode)
Debug.Print strRTF
End If
End Sub